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_DARWIN60_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_DARWIN80_ENV) && !defined(AFS_DARWIN90_ENV)) || (defined(AFS_LINUX22_ENV))
56 static_inline void afs_vprintf(const char *fmt, va_list ap) {
59 vsnprintf(buf, sizeof(buf), fmt, ap);
63 # define afs_vprintf(fmt, ap) vprintf(fmt, ap)
68 afs_warn(fmt, a, b, c, d, e, f, g, h, i)
70 void *a, *b, *c, *d, *e, *f, *g, *h, *i;
73 afs_warn(char *fmt, ...)
76 AFS_STATCNT(afs_warn);
78 if (afs_showflags & GAGCONSOLE) {
79 #if defined(AFS_AIX_ENV)
82 /* cf. console_printf() in oncplus/kernext/nfs/serv/shared.c */
84 ("/dev/console", O_WRONLY | O_NOCTTY | O_NDELAY, 0666, 0, FP_SYS,
90 sprintf(buf, fmt, a, b, c, d, e, f, g, h, i);
92 fp_write(fd, buf, len, 0, UIO_SYSSPACE, &count);
107 afs_warnuser(fmt, a, b, c, d, e, f, g, h, i)
109 void *a, *b, *c, *d, *e, *f, *g, *h, *i;
112 afs_warnuser(char *fmt, ...)
115 AFS_STATCNT(afs_warnuser);
116 if (afs_showflags & GAGUSER) {
117 #if !defined(AFS_AIX_ENV)
120 #ifdef AFS_GLOBAL_SUNLOCK
121 int haveGlock = ISAFS_GLOCK();
124 #endif /* AFS_GLOBAL_SUNLOCK */
126 #if defined(AFS_AIX_ENV)
127 uprintf(fmt, a, b, c, d, e, f, g, h, i);
131 afs_vprintf(fmt, ap);
135 #ifdef AFS_GLOBAL_SUNLOCK
138 #endif /* AFS_GLOBAL_SUNLOCK */