irix stdarg printing
authorDerrick Brashear <shadow@dementia.org>
Wed, 10 Feb 2010 20:57:48 +0000 (15:57 -0500)
committerDerrick Brashear <shadow@dementia.org>
Fri, 12 Feb 2010 19:37:06 +0000 (11:37 -0800)
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 <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/afs/afs_osi.h
src/afs/afs_warn.c
src/rx/rx_kcommon.c
src/rx/rx_prototypes.h

index ff43371..5f6588b 100644 (file)
@@ -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
index 8666e49..f65f04e 100644 (file)
 
 #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)
index 54df00e..90e68d1 100644 (file)
@@ -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)
index d9f067c..35020be 100644 (file)
@@ -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, ...)