blob: 6e4b1ba125e9a106082ca953dfa2c7dccf4fa5e5 [file] [log] [blame]
Dmitry V. Levinb21e2fb2014-12-03 21:01:35 +00001#include "defs.h"
2
3enum {
4 SYSLOG_ACTION_CLOSE = 0,
5 SYSLOG_ACTION_OPEN,
6 SYSLOG_ACTION_READ,
7 SYSLOG_ACTION_READ_ALL,
8 SYSLOG_ACTION_READ_CLEAR,
9 SYSLOG_ACTION_CLEAR,
10 SYSLOG_ACTION_CONSOLE_OFF,
11 SYSLOG_ACTION_CONSOLE_ON,
12 SYSLOG_ACTION_CONSOLE_LEVEL,
13 SYSLOG_ACTION_SIZE_UNREAD,
14 SYSLOG_ACTION_SIZE_BUFFER
15};
16
17#include "xlat/syslog_action_type.h"
18
19int
20sys_syslog(struct tcb *tcp)
21{
22 int type = tcp->u_arg[0];
23
24 if (entering(tcp)) {
25 /* type */
26 printxval(syslog_action_type, type, "SYSLOG_ACTION_???");
27 tprints(", ");
28 }
29
30 switch (type) {
31 case SYSLOG_ACTION_READ:
32 case SYSLOG_ACTION_READ_ALL:
33 case SYSLOG_ACTION_READ_CLEAR:
34 if (entering(tcp))
35 return 0;
36 break;
37 default:
38 if (entering(tcp)) {
39 tprintf("%#lx, %lu",
40 tcp->u_arg[1], tcp->u_arg[2]);
41 }
42 return 0;
43 }
44
45 /* bufp */
46 if (syserror(tcp))
47 tprintf("%#lx", tcp->u_arg[1]);
48 else
49 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
50 /* len */
51 tprintf(", %d", (int) tcp->u_arg[2]);
52
53 return 0;
54}