From e78f6f33b53798e4c742641746d3df9e7435eeff Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Wed, 10 Feb 2010 15:57:48 -0500 Subject: [PATCH] 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 --- src/afs/afs_osi.h | 5 ----- src/afs/afs_warn.c | 11 +++++++---- src/rx/rx_kcommon.c | 24 ++++++++++++++++++++---- src/rx/rx_prototypes.h | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index ff43371b1..5f6588b03 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 8666e4973..f65f04e38 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 54df00eb7..90e68d15f 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 d9f067c65..35020be86 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, ...) -- 2.39.5