From: Derrick Brashear Date: Wed, 10 Feb 2010 20:57:48 +0000 (-0500) Subject: irix stdarg printing X-Git-Tag: openafs-devel-1_5_73~187 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=e78f6f33b53798e4c742641746d3df9e7435eeff irix stdarg printing use icmn_err facility to print error (and panic for osi_Panic) note that solaris vcmn_err is basically the same, but there may be issues per some commenters. Change-Id: I56e825e16d69a232a2cdc5108071a00858ecf45c Reviewed-on: http://gerrit.openafs.org/1287 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index ff43371..5f6588b 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -197,13 +197,8 @@ typedef struct timeval osi_timeval_t; #ifdef AFS_GLOBAL_SUNLOCK -# if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) -#define AFS_ASSERT_GLOCK() \ - do { if (!ISAFS_GLOCK()) osi_Panic("afs global lock not held at %s:%d%s\n", __FILE__, (void *)__LINE__, ""); } while (0) -# else #define AFS_ASSERT_GLOCK() \ do { if (!ISAFS_GLOCK()) osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__); } while (0) -# endif /* defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) */ #endif /* AFS_GLOBAL_SUNLOCK */ #ifdef RX_ENABLE_LOCKS diff --git a/src/afs/afs_warn.c b/src/afs/afs_warn.c index 8666e49..f65f04e3 100644 --- a/src/afs/afs_warn.c +++ b/src/afs/afs_warn.c @@ -52,12 +52,15 @@ #if defined(AFS_LINUX26_ENV) # define afs_vprintf(fmt, ap) vprintk(fmt, ap) +#elif defined(AFS_SGI_ENV) +# define afs_vprintf(fmt, ap) icmn_err(CE_WARN, fmt, ap) #elif (defined(AFS_DARWIN80_ENV) && !defined(AFS_DARWIN90_ENV)) || (defined(AFS_LINUX22_ENV)) -static_inline void afs_vprintf(const char *fmt, va_list ap) { - char buf[256]; +static_inline void +afs_vprintf(const char *fmt, va_list ap) { + char buf[256]; - vsnprintf(buf, sizeof(buf), fmt, ap); - printf(buf); + vsnprintf(buf, sizeof(buf), fmt, ap); + printf(buf); } #else # define afs_vprintf(fmt, ap) vprintf(fmt, ap) diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 54df00e..90e68d1 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -1308,18 +1308,34 @@ osi_StopListener(void) #if !defined(AFS_LINUX26_ENV) void -#if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) +#if defined(AFS_AIX_ENV) osi_Panic(char *msg, void *a1, void *a2, void *a3) #else osi_Panic(char *msg, ...) #endif { -#if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) +#ifdef AFS_AIX_ENV if (!msg) - msg = "Unknown AFS panic"; + msg = "Unknown AFS panic"; + /* + * we should probably use the errsave facility here. it is not + * varargs-aware + */ + printf(msg, a1, a2, a3); panic(msg); -#elif (defined(AFS_DARWIN80_ENV) && !defined(AFS_DARWIN90_ENV)) || (defined(AFS_LINUX22_ENV) && !defined(AFS_LINUX_26_ENV)) +#elif defined(AFS_SGI_ENV) + va_list ap; + + /* Solaris has vcmn_err, Sol10 01/06 may have issues. Beware. */ + if (!msg) { + cmn_err(CE_PANIC, "Unknown AFS panic"); + } else { + va_start(ap, msg); + icmn_err(CE_PANIC, msg, ap); + va_end(ap); + } +#elif defined(AFS_DARWIN80_ENV) || (defined(AFS_LINUX22_ENV) && !defined(AFS_LINUX_26_ENV)) char buf[256]; va_list ap; if (!msg) diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index d9f067c..35020be 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -376,7 +376,7 @@ extern osi_socket rxi_GetHostUDPSocket(u_int host, u_short port); do { if (!(expr)) { osi_AssertFailK(#expr, __FILE__, __LINE__); BUG(); } } while (0) # elif (defined(AFS_AIX_ENV) && !defined(AFS_AIX61_ENV)) extern void osi_Panic(char *fmt, void *a1, void *a2, void *a3); -# elif defined(AFS_AIX61_ENV) || defined(AFS_SGI_ENV) +# elif defined(AFS_AIX61_ENV) /* No prototype. Deliberate, since there's no vprintf et al */ # else extern void osi_Panic(char *fmt, ...)