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 */
23 #if !defined(AFS_LINUX20_ENV)
27 #include <netinet/in.h>
30 #include "h/hashing.h"
32 #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
33 #include <netinet/in_var.h>
34 #endif /* ! AFS_HPUX110_ENV */
35 #endif /* !defined(UKERNEL) */
37 #include "afsincludes.h" /* Afs-based standard headers */
38 #include "afs/afs_stats.h" /* afs statistics */
40 #if defined(AFS_SUN56_ENV)
42 #include <inet/common.h>
43 #if defined(AFS_SUN58_ENV)
44 #include <netinet/ip6.h>
49 #if defined(AFS_AIX_ENV)
50 #include <sys/fp_io.h>
53 #if defined(AFS_LINUX26_ENV)
54 # define afs_vprintf(fmt, ap) vprintk(fmt, ap)
55 #elif defined(AFS_SGI_ENV)
56 # define afs_vprintf(fmt, ap) icmn_err(CE_WARN, fmt, ap)
57 #elif (defined(AFS_DARWIN80_ENV) && !defined(AFS_DARWIN90_ENV)) || (defined(AFS_LINUX22_ENV))
59 afs_vprintf(const char *fmt, va_list ap)
63 vsnprintf(buf, sizeof(buf), fmt, ap);
67 # define afs_vprintf(fmt, ap) vprintf(fmt, ap)
72 afs_warn(fmt, a, b, c, d, e, f, g, h, i)
74 void *a, *b, *c, *d, *e, *f, *g, *h, *i;
77 afs_warn(char *fmt, ...)
80 AFS_STATCNT(afs_warn);
82 if (afs_showflags & GAGCONSOLE) {
83 #if defined(AFS_AIX_ENV)
86 /* cf. console_printf() in oncplus/kernext/nfs/serv/shared.c */
88 ("/dev/console", O_WRONLY | O_NOCTTY | O_NDELAY, 0666, 0, FP_SYS,
94 sprintf(buf, fmt, a, b, c, d, e, f, g, h, i);
96 fp_write(fd, buf, len, 0, UIO_SYSSPACE, &count);
103 afs_vprintf(fmt, ap);
111 afs_warnuser(fmt, a, b, c, d, e, f, g, h, i)
113 void *a, *b, *c, *d, *e, *f, *g, *h, *i;
116 afs_warnuser(char *fmt, ...)
119 #if defined(AFS_WARNUSER_MARINER_ENV)
122 AFS_STATCNT(afs_warnuser);
123 if (afs_showflags & GAGUSER) {
124 #if !defined(AFS_AIX_ENV)
127 #ifdef AFS_GLOBAL_SUNLOCK
128 int haveGlock = ISAFS_GLOCK();
129 #if defined(AFS_WARNUSER_MARINER_ENV)
130 /* gain GLOCK for mariner */
134 /* drop GLOCK for uprintf */
138 #endif /* AFS_GLOBAL_SUNLOCK */
140 #if defined(AFS_AIX_ENV)
141 uprintf(fmt, a, b, c, d, e, f, g, h, i);
144 #if defined(AFS_WARNUSER_MARINER_ENV)
145 /* mariner log the warning */
146 snprintf(buf, sizeof(buf), "warn$");
147 vsnprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), fmt, ap);
148 afs_MarinerLog(buf, NULL);
153 afs_vprintf(fmt, ap);
158 #ifdef AFS_GLOBAL_SUNLOCK
159 #if defined(AFS_WARNUSER_MARINER_ENV)
160 /* drop GLOCK we got for mariner */
164 /* regain GLOCK we dropped for uprintf */
168 #endif /* AFS_GLOBAL_SUNLOCK */