Debian Codegraph @

testsuite/systemtap.syscall/syslog.c

raw
1 /* COVERAGE: syslog */
2
3 #include <stdio.h>
4 #include <sys/klog.h>
5
6 int main()
7 {
8 char buf[1024];
9
10 /* The glibc wrapper function around the kernel's syslog syscall
11 * is called klogctl(), to avoid conflicts with syslog(3). */
12
13 klogctl(0 /* SYSLOG_ACTION_CLOSE */, NULL, 0);
14 //staptest// syslog (0, 0x0, 0)
15
16 /* NB: we can't test SYSLOG_ACTION_READ here, because it can
17 block in the case of an empty kernel kmsg buffer. */
18
19 klogctl(3 /* SYSLOG_ACTION_READ_ALL */, buf, sizeof(buf) - 1);
20 //staptest// syslog (3, XXXX, 1023)
21
22 klogctl(-1, buf, sizeof(buf) - 1);
23 //staptest// syslog (-1, XXXX, 1023)
24
25 klogctl(0 /* SYSLOG_ACTION_CLOSE */, (char *)-1, 0);
26 #ifdef __s390__
27 //staptest// syslog (0, 0x[7]?[f]+, 0)
28 #else
29 //staptest// syslog (0, 0x[f]+, 0)
30 #endif
31
32 klogctl(0 /* SYSLOG_ACTION_CLOSE */, NULL, -1);
33 //staptest// syslog (0, 0x0, -1)
34
35 return 0;
36 }