linux-mmap-antirecursion-20081020
[openafs.git] / src / afs / afs_warn.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 /*
11  * afs_warn.c - afs_warn
12  *
13  * Implements: afs_warn, afs_warnuser
14  */
15 #include <afsconfig.h>
16 #include "afs/param.h"
17
18 RCSID
19     ("$Header$");
20
21 #include "afs/stds.h"
22 #include "afs/sysincludes.h"    /* Standard vendor system headers */
23
24 #if !defined(UKERNEL)
25 #if !defined(AFS_LINUX20_ENV)
26 #include <net/if.h>
27 #endif
28 #include <netinet/in.h>
29
30 #ifdef AFS_SGI62_ENV
31 #include "h/hashing.h"
32 #endif
33 #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN60_ENV)
34 #include <netinet/in_var.h>
35 #endif /* ! AFS_HPUX110_ENV */
36 #endif /* !defined(UKERNEL) */
37
38 #include "afsincludes.h"        /* Afs-based standard headers */
39 #include "afs/afs_stats.h"      /* afs statistics */
40
41 #if     defined(AFS_SUN56_ENV)
42 #include <inet/led.h>
43 #include <inet/common.h>
44 #if     defined(AFS_SUN58_ENV)
45 #include <netinet/ip6.h>
46 #endif
47 #include <inet/ip.h>
48 #endif
49
50 #if     defined(AFS_AIX_ENV)
51 #include <sys/fp_io.h>
52 #endif
53
54
55
56 /* * * * * * *
57  * this code badly needs to be cleaned up...  too many ugly ifdefs.
58  * XXX
59  */
60 #if 0
61 void
62 afs_warn(char *a, long b, long c, long d, long e, long f, long g, long h,
63          long i, long j)
64 #else
65 void
66 afs_warn(a, b, c, d, e, f, g, h, i, j)
67      char *a;
68 #if defined( AFS_USE_VOID_PTR)
69      void *b, *c, *d, *e, *f, *g, *h, *i, *j;
70 #else
71      long b, c, d, e, f, g, h, i, j;
72 #endif
73 #endif
74 {
75     AFS_STATCNT(afs_warn);
76
77     if (afs_showflags & GAGCONSOLE) {
78 #if defined(AFS_AIX_ENV)
79         struct file *fd;
80
81         /* cf. console_printf() in oncplus/kernext/nfs/serv/shared.c */
82         if (fp_open
83             ("/dev/console", O_WRONLY | O_NOCTTY | O_NDELAY, 0666, 0, FP_SYS,
84              &fd) == 0) {
85             char buf[1024];
86             ssize_t len;
87             ssize_t count;
88
89             sprintf(buf, a, b, c, d, e, f, g, h, i, j);
90             len = strlen(buf);
91             fp_write(fd, buf, len, 0, UIO_SYSSPACE, &count);
92             fp_close(fd);
93         }
94 #else
95         printf(a, b, c, d, e, f, g, h, i, j);
96 #endif
97     }
98 }
99
100 #if 0
101 void
102 afs_warnuser(char *a, long b, long c, long d, long e, long f, long g, long h,
103              long i, long j)
104 #else
105 void
106 afs_warnuser(a, b, c, d, e, f, g, h, i, j)
107      char *a;
108      long b, c, d, e, f, g, h, i, j;
109 #endif
110 {
111     AFS_STATCNT(afs_warnuser);
112     if (afs_showflags & GAGUSER) {
113 #ifdef AFS_GLOBAL_SUNLOCK
114         int haveGlock = ISAFS_GLOCK();
115         if (haveGlock)
116             AFS_GUNLOCK();
117 #endif /* AFS_GLOBAL_SUNLOCK */
118
119         uprintf(a, b, c, d, e, f, g, h, i, j);
120
121 #ifdef AFS_GLOBAL_SUNLOCK
122         if (haveGlock)
123             AFS_GLOCK();
124 #endif /* AFS_GLOBAL_SUNLOCK */
125     }
126 }