From ccb6e3a5d64aced06c3ff415806735bddf0a900d Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Wed, 17 Nov 2010 12:43:07 +0000 Subject: [PATCH] Add snprintf to roken for Unix builds vsyslog on AIX (added to rokenafs by commit f21fbf6b9ce1dfcb0ea1ef52c686d1370c810609) requires rk_*printf, add them to the libroken build. Change-Id: I243cb89b5715be03920c562559b326786a9e9518 Reviewed-on: http://gerrit.openafs.org/3320 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- acinclude.m4 | 15 ++++++--- src/crypto/hcrypto/Makefile.in | 9 +++++- src/crypto/hcrypto/roken.h | 59 ++++++++++++++++++++++++++++++++++ src/roken/Makefile.in | 8 ++++- 4 files changed, 85 insertions(+), 6 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 540ed1270..7faeb65cb 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1279,12 +1279,9 @@ AC_CHECK_FUNCS([ \ setprogname \ setvbuf \ sigaction \ - snprintf \ strcasestr \ strerror \ timegm \ - vsnprintf \ - vsyslog \ ]) OPENAFS_ROKEN() @@ -1310,8 +1307,17 @@ AC_CHECK_FUNCS([ \ strsep \ ]) -dnl Functions that we're going to try and get from libroken +dnl Functions that are in objects that we always build from libroken +AC_CHECK_FUNCS([ \ + asprintf \ + asnprintf \ + vasprintf \ + vasnprintf \ + vsnprintf \ + snprintf \ +]) +dnl Functions that we're going to try and get from libroken AC_REPLACE_FUNCS([ \ daemon \ ecalloc \ @@ -1426,6 +1432,7 @@ AC_CHECK_TYPES([struct addrinfo], [], [], [ #include #endif ]) +AC_CHECK_TYPES([long long], [], [], []) AC_SIZEOF_TYPE(long) diff --git a/src/crypto/hcrypto/Makefile.in b/src/crypto/hcrypto/Makefile.in index fdf68fd40..ea2ae1e44 100644 --- a/src/crypto/hcrypto/Makefile.in +++ b/src/crypto/hcrypto/Makefile.in @@ -60,7 +60,8 @@ COMMON_OBJS= aes.o camellia.o camellia-ntt.o des.o engine.o evp.o \ rand-egd.o rand-timer.o rand-unix.o rand.o rc2.o rc4.o \ rijndael-alg-fst.o rnd_keys.o sha.o sha256.o sha512.o ui.o \ validate.o \ - cloexec.o ct.o issuid.o net_read.o net_write.o warnerr.o + cloexec.o ct.o issuid.o net_read.o net_write.o snprintf.o \ + warnerr.o OBJECTS = $(COMMON_OBJS) rand-fortuna.o $(ROKEN_LIBOBJS) @@ -268,6 +269,12 @@ net_read.o: ${UPSTREAM}/roken/net_read.c net_write.o: ${UPSTREAM}/roken/net_write.c $(AFS_CCRULE) $(UPSTREAM)/roken/net_write.c +# The upstream snprintf.c has some pointer warnings in it +CFLAGS_snprintf.o = @CFLAGS_NOERROR@ + +snprintf.o: ${UPSTREAM}/roken/snprintf.c + $(AFS_CCRULE) $(UPSTREAM)/roken/snprintf.c + # These bits of libroken are compatibility functions. They should get moved # out into a new libroken top level target, which allows the use of an # existing libroken, if one is available. diff --git a/src/crypto/hcrypto/roken.h b/src/crypto/hcrypto/roken.h index dfdf4ec12..a84a24ee9 100644 --- a/src/crypto/hcrypto/roken.h +++ b/src/crypto/hcrypto/roken.h @@ -55,6 +55,10 @@ typedef int ssize_t; #endif #endif +#ifndef HAVE___ATTRIBUTE__ +#define __attribute__(x) +#endif + typedef int rk_socket_t; ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL @@ -72,6 +76,60 @@ ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL issuid(void); +#if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO) +#ifndef HAVE_SNPRINTF +#define snprintf rk_snprintf +#endif +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_snprintf (char *, size_t, const char *, ...) + __attribute__ ((format (printf, 3, 4))); +#endif + +#if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO) +#ifndef HAVE_VSNPRINTF +#define vsnprintf rk_vsnprintf +#endif +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_vsnprintf (char *, size_t, const char *, va_list) + __attribute__((format (printf, 3, 0))); +#endif + +#if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO) +#ifndef HAVE_ASPRINTF +#define asprintf rk_asprintf +#endif +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_asprintf (char **, const char *, ...) + __attribute__ ((format (printf, 2, 3))); +#endif + +#if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO) +#ifndef HAVE_VASPRINTF +#define vasprintf rk_vasprintf +#endif +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_vasprintf (char **, const char *, va_list) + __attribute__((format (printf, 2, 0))); +#endif + +#if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO) +#ifndef HAVE_ASNPRINTF +#define asnprintf rk_asnprintf +#endif +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_asnprintf (char **, size_t, const char *, ...) + __attribute__ ((format (printf, 3, 4))); +#endif + +#if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO) +#ifndef HAVE_VASNPRINTF +#define vasnprintf rk_vasnprintf +#endif +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + vasnprintf (char **, size_t, const char *, va_list) + __attribute__((format (printf, 3, 0))); +#endif + #ifndef HAVE_STRLCPY #define strlcpy rk_strlcpy ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL @@ -99,4 +157,5 @@ ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void); #define _PATH_DEVNULL "/dev/null" #endif + #endif /* OPENAFS_ROKEN_H */ diff --git a/src/roken/Makefile.in b/src/roken/Makefile.in index 93b914477..b7db25153 100644 --- a/src/roken/Makefile.in +++ b/src/roken/Makefile.in @@ -36,7 +36,7 @@ clean: OBJECTS = $(ROKEN_LIBOBJS) \ cloexec.o ct.o hex.o issuid.o net_read.o net_write.o socket.o \ - warnerr.o + snprintf.o warnerr.o $(TOP_LIBDIR)/$(SHLIBOBJ): $(SHLIBOBJ) $(TOP_OBJDIR)/src/config/shlib-install -d $(TOP_LIBDIR) \ @@ -112,6 +112,12 @@ net_write.o: ${UPSTREAM}/net_write.c socket.o: ${UPSTREAM}/socket.c $(AFS_CCRULE) $(UPSTREAM)/socket.c +# The upstream snprintf.c has some pointer warnings in it +CFLAGS_snprintf.o = @CFLAGS_NOERROR@ + +snprintf.o: ${UPSTREAM}/snprintf.c + $(AFS_CCRULE) $(UPSTREAM)/snprintf.c + strlcat.o: ${UPSTREAM}/strlcat.c $(AFS_CCRULE) $(UPSTREAM)/strlcat.c -- 2.39.5