Remove support for Solaris pre-8
[openafs.git] / src / afs / afs_warn.c
index f65f04e..58a5920 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
 #include "afs/sysincludes.h"   /* Standard vendor system headers */
 
 #if !defined(UKERNEL)
+
 #if !defined(AFS_LINUX20_ENV)
-#include <net/if.h>
-#include "stdarg.h"
+# include <net/if.h>
+# if defined(AFS_SUN5_ENV)
+#  include <sys/varargs.h>
+# else
+#  include <stdarg.h>
+# endif
 #endif
 #include <netinet/in.h>
 
 #ifdef AFS_SGI62_ENV
 #include "h/hashing.h"
 #endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN60_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
 #include <netinet/in_var.h>
 #endif /* ! AFS_HPUX110_ENV */
 #endif /* !defined(UKERNEL) */
 #include "afsincludes.h"       /* Afs-based standard headers */
 #include "afs/afs_stats.h"     /* afs statistics */
 
-#if    defined(AFS_SUN56_ENV)
+#if    defined(AFS_SUN5_ENV)
 #include <inet/led.h>
 #include <inet/common.h>
-#if     defined(AFS_SUN58_ENV)
 #include <netinet/ip6.h>
-#endif
 #include <inet/ip.h>
 #endif
 
@@ -56,7 +59,8 @@
 # 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) {
+afs_vprintf(const char *fmt, va_list ap)
+{
     char buf[256];
 
     vsnprintf(buf, sizeof(buf), fmt, ap);
@@ -115,6 +119,9 @@ void
 afs_warnuser(char *fmt, ...)
 #endif
 {
+#if defined(AFS_WARNUSER_MARINER_ENV)
+    char buf[256];
+#endif
     AFS_STATCNT(afs_warnuser);
     if (afs_showflags & GAGUSER) {
 #if !defined(AFS_AIX_ENV)
@@ -122,22 +129,45 @@ afs_warnuser(char *fmt, ...)
 #endif
 #ifdef AFS_GLOBAL_SUNLOCK
        int haveGlock = ISAFS_GLOCK();
+#if defined(AFS_WARNUSER_MARINER_ENV)
+       /* gain GLOCK for mariner */
+       if (!haveGlock)
+           AFS_GLOCK();
+#else
+       /* drop GLOCK for uprintf */
        if (haveGlock)
            AFS_GUNLOCK();
+#endif
 #endif /* AFS_GLOBAL_SUNLOCK */
 
 #if defined(AFS_AIX_ENV)
        uprintf(fmt, a, b, c, d, e, f, g, h, i);
 #else
-
        va_start(ap, fmt);
+#if defined(AFS_WARNUSER_MARINER_ENV)
+       /* mariner log the warning */
+       snprintf(buf, sizeof(buf), "warn$");
+       vsnprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), fmt, ap);
+       afs_MarinerLog(buf, NULL);
+       va_end(ap);
+       va_start(ap, fmt);
+       vprintf(fmt, ap);
+#else
        afs_vprintf(fmt, ap);
+#endif
        va_end(ap);
 #endif
 
 #ifdef AFS_GLOBAL_SUNLOCK
+#if defined(AFS_WARNUSER_MARINER_ENV)
+       /* drop GLOCK we got for mariner */
+       if (!haveGlock)
+           AFS_GUNLOCK();
+#else
+       /* regain GLOCK we dropped for uprintf */
        if (haveGlock)
            AFS_GLOCK();
+#endif
 #endif /* AFS_GLOBAL_SUNLOCK */
     }
 }