2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * afs_warn.c - afs_warn
13 * Implements: afs_warn, afs_warnuser
15 #include <afsconfig.h>
16 #include "afs/param.h"
20 #include "afs/sysincludes.h" /* Standard vendor system headers */
24 #if !defined(AFS_LINUX20_ENV)
26 # if defined(AFS_SUN5_ENV)
27 # include <sys/varargs.h>
32 #include <netinet/in.h>
35 #include "h/hashing.h"
37 #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
38 #include <netinet/in_var.h>
39 #endif /* ! AFS_HPUX110_ENV */
40 #endif /* !defined(UKERNEL) */
42 #include "afsincludes.h" /* Afs-based standard headers */
43 #include "afs/afs_stats.h" /* afs statistics */
45 #if defined(AFS_SUN5_ENV)
47 #include <inet/common.h>
48 #include <netinet/ip6.h>
52 #if defined(AFS_AIX_ENV)
53 #include <sys/fp_io.h>
56 #if defined(AFS_LINUX26_ENV)
57 # define afs_vprintf(fmt, ap) vprintk(fmt, ap)
58 #elif defined(AFS_SGI_ENV)
59 # define afs_vprintf(fmt, ap) icmn_err(CE_WARN, fmt, ap)
60 #elif (defined(AFS_DARWIN80_ENV) && !defined(AFS_DARWIN90_ENV)) || (defined(AFS_LINUX22_ENV))
62 afs_vprintf(const char *fmt, va_list ap)
66 vsnprintf(buf, sizeof(buf), fmt, ap);
70 # define afs_vprintf(fmt, ap) vprintf(fmt, ap)
75 afs_warn(fmt, a, b, c, d, e, f, g, h, i)
77 void *a, *b, *c, *d, *e, *f, *g, *h, *i;
80 afs_warn(char *fmt, ...)
83 AFS_STATCNT(afs_warn);
85 if (afs_showflags & GAGCONSOLE) {
86 #if defined(AFS_AIX_ENV)
89 /* cf. console_printf() in oncplus/kernext/nfs/serv/shared.c */
91 ("/dev/console", O_WRONLY | O_NOCTTY | O_NDELAY, 0666, 0, FP_SYS,
97 sprintf(buf, fmt, a, b, c, d, e, f, g, h, i);
99 fp_write(fd, buf, len, 0, UIO_SYSSPACE, &count);
106 afs_vprintf(fmt, ap);
114 afs_warnuser(fmt, a, b, c, d, e, f, g, h, i)
116 void *a, *b, *c, *d, *e, *f, *g, *h, *i;
119 afs_warnuser(char *fmt, ...)
122 #if defined(AFS_WARNUSER_MARINER_ENV)
125 AFS_STATCNT(afs_warnuser);
126 if (afs_showflags & GAGUSER) {
127 #if !defined(AFS_AIX_ENV)
130 #ifdef AFS_GLOBAL_SUNLOCK
131 int haveGlock = ISAFS_GLOCK();
132 #if defined(AFS_WARNUSER_MARINER_ENV)
133 /* gain GLOCK for mariner */
137 /* drop GLOCK for uprintf */
141 #endif /* AFS_GLOBAL_SUNLOCK */
143 #if defined(AFS_AIX_ENV)
144 uprintf(fmt, a, b, c, d, e, f, g, h, i);
147 #if defined(AFS_WARNUSER_MARINER_ENV)
148 /* mariner log the warning */
149 snprintf(buf, sizeof(buf), "warn$");
150 vsnprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), fmt, ap);
152 afs_MarinerLog(buf, NULL);
157 afs_vprintf(fmt, ap);
162 #ifdef AFS_GLOBAL_SUNLOCK
163 #if defined(AFS_WARNUSER_MARINER_ENV)
164 /* drop GLOCK we got for mariner */
168 /* regain GLOCK we dropped for uprintf */
172 #endif /* AFS_GLOBAL_SUNLOCK */