GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.bin/kdump/kdump_subr.c Lines: 361 997 36.2 %
Date: 2017-11-13 Branches: 371 1795 20.7 %

Line Branch Exec Source
1
#include <stdio.h>
2
#include <sys/param.h>
3
#include <sys/event.h>
4
#include <sys/fcntl.h>
5
#include <sys/stat.h>
6
#include <sys/unistd.h>
7
#define _KERNEL
8
#include <sys/mman.h>
9
#undef _KERNEL
10
#include <sys/wait.h>
11
#include <sys/proc.h>
12
#include <sys/socket.h>
13
#include <netinet/in.h>
14
#include <sys/param.h>
15
#include <sys/mount.h>
16
#include <sys/poll.h>
17
#include <sys/ptrace.h>
18
#include <sys/resource.h>
19
#include <sys/reboot.h>
20
#include <sys/uio.h>
21
#include <sys/ktrace.h>
22
#include <sched.h>
23
#if 0
24
#include <sys/linker.h>
25
#define _KERNEL
26
#include <sys/thr.h>
27
#undef _KERNEL
28
#include <sys/extattr.h>
29
#include <sys/acl.h>
30
#include <aio.h>
31
#endif
32
#include <sys/sem.h>
33
#include <sys/ipc.h>
34
#if 0
35
#include <sys/rtprio.h>
36
#endif
37
#include <sys/shm.h>
38
#if 0
39
#include <nfsserver/nfs.h>
40
#endif
41
#include <ufs/ufs/quota.h>
42
#include <sys/syslog.h>
43
#include <sys/futex.h>
44
45
#include "kdump_subr.h"
46
47
/* AUTO */
48
void
49
modename (int arg)
50
{
51
	int	or = 0;
52
1023034
	if (arg == 0) {
53
		printf("0<>");
54
		return;
55
	}
56
511517
	printf("%#o<", arg);
57
511517
	if(!((arg>0)^((S_ISUID)>0)))
58

511517
		if_print_or(arg, S_ISUID, or);
59
511517
	if(!((arg>0)^((S_ISGID)>0)))
60

511517
		if_print_or(arg, S_ISGID, or);
61
511517
	if(!((arg>0)^((S_ISTXT)>0)))
62

511517
		if_print_or(arg, S_ISTXT, or);
63
511517
	if(!((arg>0)^((S_IRUSR)>0)))
64

1533511
		if_print_or(arg, S_IRUSR, or);
65
511517
	if(!((arg>0)^((S_IWUSR)>0)))
66

2555505
		if_print_or(arg, S_IWUSR, or);
67
511517
	if(!((arg>0)^((S_IXUSR)>0)))
68

1872741
		if_print_or(arg, S_IXUSR, or);
69
511517
	if(!((arg>0)^((S_IRGRP)>0)))
70

2555745
		if_print_or(arg, S_IRGRP, or);
71
511517
	if(!((arg>0)^((S_IWGRP)>0)))
72

515205
		if_print_or(arg, S_IWGRP, or);
73
511517
	if(!((arg>0)^((S_IXGRP)>0)))
74

1873261
		if_print_or(arg, S_IXGRP, or);
75
511517
	if(!((arg>0)^((S_IROTH)>0)))
76

2555745
		if_print_or(arg, S_IROTH, or);
77
511517
	if(!((arg>0)^((S_IWOTH)>0)))
78

515725
		if_print_or(arg, S_IWOTH, or);
79
511517
	if(!((arg>0)^((S_IXOTH)>0)))
80

1873261
		if_print_or(arg, S_IXOTH, or);
81
511517
	if(!((arg>0)^((S_IFIFO)>0)))
82

511517
		if_print_or(arg, S_IFIFO, or);
83
511517
	if(!((arg>0)^((S_IFCHR)>0)))
84

511517
		if_print_or(arg, S_IFCHR, or);
85
511517
	if(!((arg>0)^((S_IFDIR)>0)))
86

511517
		if_print_or(arg, S_IFDIR, or);
87
511517
	if(!((arg>0)^((S_IFBLK)>0)))
88

511517
		if_print_or(arg, S_IFBLK, or);
89
511517
	if(!((arg>0)^((S_IFREG)>0)))
90

511517
		if_print_or(arg, S_IFREG, or);
91
511517
	if(!((arg>0)^((S_IFLNK)>0)))
92

511517
		if_print_or(arg, S_IFLNK, or);
93
511517
	if(!((arg>0)^((S_IFSOCK)>0)))
94

511517
		if_print_or(arg, S_IFSOCK, or);
95
511517
	if(!((arg>0)^((S_ISVTX)>0)))
96

511517
		if_print_or(arg, S_ISVTX, or);
97
511517
	printf(">");
98
511517
	if (or == 0)
99
		(void)printf("<invalid>%d", arg);
100
1023034
}
101
102
/* AUTO */
103
void
104
doflagsname (int arg, int show_accmode)
105
{
106
	int	or = 0;
107
108
683018
	printf("%#x<", arg);
109

342301
	if (show_accmode || (arg & O_ACCMODE)) {
110
		or = 1;
111

341249
		switch (arg & O_ACCMODE) {
112
		case O_RDONLY:
113
7664
			printf("O_RDONLY");
114
7664
			break;
115
		case O_WRONLY:
116
2222
			printf("O_WRONLY");
117
2222
			break;
118
		case O_RDWR:
119
331363
			printf("O_RDWR");
120
331363
			break;
121
		default:
122
			printf("<invalid>O_ACCMODE");
123
			break;
124
		}
125
	}
126

355125
	if_print_or(arg, O_NONBLOCK, or);
127

343909
	if_print_or(arg, O_APPEND, or);
128

341509
	if_print_or(arg, O_SHLOCK, or);
129

341509
	if_print_or(arg, O_EXLOCK, or);
130

341509
	if_print_or(arg, O_ASYNC, or);
131

341509
	if_print_or(arg, O_FSYNC, or);
132

341509
	if_print_or(arg, O_NOFOLLOW, or);
133

341509
	if_print_or(arg, O_SYNC, or);
134

1023753
	if_print_or(arg, O_CREAT, or);
135

342597
	if_print_or(arg, O_TRUNC, or);
136

342309
	if_print_or(arg, O_EXCL, or);
137

341509
	if_print_or(arg, O_NOCTTY, or);
138

359821
	if_print_or(arg, O_CLOEXEC, or);
139

341557
	if_print_or(arg, O_DIRECTORY, or);
140
341509
	printf(">");
141
341509
}
142
143
/*
144
 * Wrappers of the above to use with pn()
145
 */
146
void
147
flagsname(int flags)
148
{
149
520
	doflagsname(flags, 0);
150
260
}
151
152
void
153
openflagsname(int flags)
154
{
155
681434
	doflagsname(flags, 1);
156
340717
}
157
158
159
/* AUTO */
160
void
161
atflagsname (int arg)
162
{
163
	int	or = 0;
164
	if (arg == 0) {
165
		printf("0<>");
166
		return;
167
	}
168
	printf("%#x<", arg);
169
	if(!((arg>0)^((AT_EACCESS)>0)))
170
		if_print_or(arg, AT_EACCESS, or);
171
	if(!((arg>0)^((AT_SYMLINK_NOFOLLOW)>0)))
172
		if_print_or(arg, AT_SYMLINK_NOFOLLOW, or);
173
	if(!((arg>0)^((AT_SYMLINK_FOLLOW)>0)))
174
		if_print_or(arg, AT_SYMLINK_FOLLOW, or);
175
	if(!((arg>0)^((AT_REMOVEDIR)>0)))
176
		if_print_or(arg, AT_REMOVEDIR, or);
177
	printf(">");
178
	if (or == 0)
179
		(void)printf("<invalid>%d", arg);
180
}
181
182
/* AUTO */
183
void
184
accessmodename (int arg)
185
{
186
	int	or = 0;
187
1448
	printf("%#x<", arg);
188
724
	if(!((arg>0)^((F_OK)>0)))
189
		if_print_or(arg, F_OK, or);
190
724
	if(!((arg>0)^((X_OK)>0)))
191

1188
		if_print_or(arg, X_OK, or);
192
724
	if(!((arg>0)^((W_OK)>0)))
193

724
		if_print_or(arg, W_OK, or);
194
724
	if(!((arg>0)^((R_OK)>0)))
195

1708
		if_print_or(arg, R_OK, or);
196
724
	printf(">");
197
724
	if (or == 0)
198
		(void)printf("<invalid>%d", arg);
199
724
}
200
201
/* AUTO */
202
void
203
mmapprotname (int arg)
204
{
205
	int	or = 0;
206
363912
	printf("%#x<", arg);
207
181956
	if(!((arg>0)^((PROT_NONE)>0)))
208

19323
		if_print_or(arg, PROT_NONE, or);
209
181956
	if(!((arg>0)^((PROT_READ)>0)))
210

526545
		if_print_or(arg, PROT_READ, or);
211
181956
	if(!((arg>0)^((PROT_WRITE)>0)))
212

762463
		if_print_or(arg, PROT_WRITE, or);
213
181956
	if(!((arg>0)^((PROT_EXEC)>0)))
214

185927
		if_print_or(arg, PROT_EXEC, or);
215
181956
	printf(">");
216
181956
	if (or == 0)
217
		(void)printf("<invalid>%d", arg);
218
181956
}
219
220
/* AUTO */
221
void
222
mmapflagsname (int arg)
223
{
224
	int	or = 0;
225
275286
	printf("%#x<", arg);
226
137643
	if(!((arg>0)^((MAP_SHARED)>0)))
227

287733
		if_print_or(arg, MAP_SHARED, or);
228
137643
	if(!((arg>0)^((MAP_PRIVATE)>0)))
229

262833
		if_print_or(arg, MAP_PRIVATE, or);
230
137643
	if(!((arg>0)^((MAP_FIXED)>0)))
231

177523
		if_print_or(arg, MAP_FIXED, or);
232
137643
	if(!((arg>0)^((__MAP_NOREPLACE)>0)))
233

137643
		if_print_or(arg, __MAP_NOREPLACE, or);
234
137643
	if(!((arg>0)^((MAP_ANON)>0)))
235

344289
		if_print_or(arg, MAP_ANON, or);
236
137643
	if(!((arg>0)^((__MAP_NOFAULT)>0)))
237

137643
		if_print_or(arg, __MAP_NOFAULT, or);
238
137643
	if(!((arg>0)^((MAP_FLAGMASK)>0)))
239

137643
		if_print_or(arg, MAP_FLAGMASK, or);
240
137643
	printf(">");
241
137643
	if (or == 0)
242
		(void)printf("<invalid>%d", arg);
243
137643
}
244
245
/* AUTO */
246
void
247
wait4optname (int arg)
248
{
249
	int	or = 0;
250
2404
	if (arg == 0) {
251
20
		printf("0<>");
252
20
		return;
253
	}
254
1182
	printf("%#x<", arg);
255
1182
	if(!((arg>0)^((WCOREFLAG)>0)))
256

1182
		if_print_or(arg, WCOREFLAG, or);
257
1182
	if(!((arg>0)^((WNOHANG)>0)))
258

3546
		if_print_or(arg, WNOHANG, or);
259
1182
	if(!((arg>0)^((WUNTRACED)>0)))
260

3022
		if_print_or(arg, WUNTRACED, or);
261
1182
	if(!((arg>0)^((WCONTINUED)>0)))
262

1182
		if_print_or(arg, WCONTINUED, or);
263
1182
	printf(">");
264
1182
	if (or == 0)
265
		(void)printf("<invalid>%d", arg);
266
2384
}
267
268
/* AUTO */
269
void
270
mountflagsname (int arg)
271
{
272
	int	or = 0;
273
	printf("%#x<", arg);
274
	if(!((arg>0)^((MNT_RDONLY)>0)))
275
		if_print_or(arg, MNT_RDONLY, or);
276
	if(!((arg>0)^((MNT_SYNCHRONOUS)>0)))
277
		if_print_or(arg, MNT_SYNCHRONOUS, or);
278
	if(!((arg>0)^((MNT_NOEXEC)>0)))
279
		if_print_or(arg, MNT_NOEXEC, or);
280
	if(!((arg>0)^((MNT_NOSUID)>0)))
281
		if_print_or(arg, MNT_NOSUID, or);
282
	if(!((arg>0)^((MNT_NODEV)>0)))
283
		if_print_or(arg, MNT_NODEV, or);
284
	if(!((arg>0)^((MNT_NOPERM)>0)))
285
		if_print_or(arg, MNT_NOPERM, or);
286
	if(!((arg>0)^((MNT_ASYNC)>0)))
287
		if_print_or(arg, MNT_ASYNC, or);
288
	if(!((arg>0)^((MNT_WXALLOWED)>0)))
289
		if_print_or(arg, MNT_WXALLOWED, or);
290
	if(!((arg>0)^((MNT_EXRDONLY)>0)))
291
		if_print_or(arg, MNT_EXRDONLY, or);
292
	if(!((arg>0)^((MNT_EXPORTED)>0)))
293
		if_print_or(arg, MNT_EXPORTED, or);
294
	if(!((arg>0)^((MNT_DEFEXPORTED)>0)))
295
		if_print_or(arg, MNT_DEFEXPORTED, or);
296
	if(!((arg>0)^((MNT_EXPORTANON)>0)))
297
		if_print_or(arg, MNT_EXPORTANON, or);
298
	if(!((arg>0)^((MNT_LOCAL)>0)))
299
		if_print_or(arg, MNT_LOCAL, or);
300
	if(!((arg>0)^((MNT_QUOTA)>0)))
301
		if_print_or(arg, MNT_QUOTA, or);
302
	if(!((arg>0)^((MNT_ROOTFS)>0)))
303
		if_print_or(arg, MNT_ROOTFS, or);
304
	if(!((arg>0)^((MNT_NOATIME)>0)))
305
		if_print_or(arg, MNT_NOATIME, or);
306
	if(!((arg>0)^((MNT_VISFLAGMASK)>0)))
307
		if_print_or(arg, MNT_VISFLAGMASK, or);
308
	if(!((arg>0)^((MNT_UPDATE)>0)))
309
		if_print_or(arg, MNT_UPDATE, or);
310
	if(!((arg>0)^((MNT_DELEXPORT)>0)))
311
		if_print_or(arg, MNT_DELEXPORT, or);
312
	if(!((arg>0)^((MNT_RELOAD)>0)))
313
		if_print_or(arg, MNT_RELOAD, or);
314
	if(!((arg>0)^((MNT_FORCE)>0)))
315
		if_print_or(arg, MNT_FORCE, or);
316
	if(!((arg>0)^((MNT_WANTRDWR)>0)))
317
		if_print_or(arg, MNT_WANTRDWR, or);
318
	if(!((arg>0)^((MNT_SOFTDEP)>0)))
319
		if_print_or(arg, MNT_SOFTDEP, or);
320
	if(!((arg>0)^((MNT_DOOMED)>0)))
321
		if_print_or(arg, MNT_DOOMED, or);
322
	printf(">");
323
	if (or == 0)
324
		(void)printf("<invalid>%d", arg);
325
}
326
327
/* AUTO */
328
void
329
rebootoptname (int arg)
330
{
331
	int	or = 0;
332
	printf("%#x<", arg);
333
	if(!((arg>0)^((RB_ASKNAME)>0)))
334
		if_print_or(arg, RB_ASKNAME, or);
335
	if(!((arg>0)^((RB_SINGLE)>0)))
336
		if_print_or(arg, RB_SINGLE, or);
337
	if(!((arg>0)^((RB_NOSYNC)>0)))
338
		if_print_or(arg, RB_NOSYNC, or);
339
	if(!((arg>0)^((RB_HALT)>0)))
340
		if_print_or(arg, RB_HALT, or);
341
	if(!((arg>0)^((RB_INITNAME)>0)))
342
		if_print_or(arg, RB_INITNAME, or);
343
	if(!((arg>0)^((RB_DFLTROOT)>0)))
344
		if_print_or(arg, RB_DFLTROOT, or);
345
	if(!((arg>0)^((RB_KDB)>0)))
346
		if_print_or(arg, RB_KDB, or);
347
	if(!((arg>0)^((RB_RDONLY)>0)))
348
		if_print_or(arg, RB_RDONLY, or);
349
	if(!((arg>0)^((RB_DUMP)>0)))
350
		if_print_or(arg, RB_DUMP, or);
351
	if(!((arg>0)^((RB_MINIROOT)>0)))
352
		if_print_or(arg, RB_MINIROOT, or);
353
	if(!((arg>0)^((RB_CONFIG)>0)))
354
		if_print_or(arg, RB_CONFIG, or);
355
	if(!((arg>0)^((RB_TIMEBAD)>0)))
356
		if_print_or(arg, RB_TIMEBAD, or);
357
	if(!((arg>0)^((RB_POWERDOWN)>0)))
358
		if_print_or(arg, RB_POWERDOWN, or);
359
	if(!((arg>0)^((RB_SERCONS)>0)))
360
		if_print_or(arg, RB_SERCONS, or);
361
	if(!((arg>0)^((RB_USERREQ)>0)))
362
		if_print_or(arg, RB_USERREQ, or);
363
	printf(">");
364
	if (or == 0)
365
		(void)printf("<invalid>%d", arg);
366
}
367
368
/* AUTO */
369
void
370
flockname (int arg)
371
{
372
	int	or = 0;
373
300184
	printf("%#x<", arg);
374
150092
	if(!((arg>0)^((LOCK_SH)>0)))
375

150092
		if_print_or(arg, LOCK_SH, or);
376
150092
	if(!((arg>0)^((LOCK_EX)>0)))
377

300184
		if_print_or(arg, LOCK_EX, or);
378
150092
	if(!((arg>0)^((LOCK_NB)>0)))
379

150092
		if_print_or(arg, LOCK_NB, or);
380
150092
	if(!((arg>0)^((LOCK_UN)>0)))
381

300184
		if_print_or(arg, LOCK_UN, or);
382
150092
	printf(">");
383
150092
	if (or == 0)
384
		(void)printf("<invalid>%d", arg);
385
150092
}
386
387
/* AUTO */
388
void
389
mlockallname (int arg)
390
{
391
	int	or = 0;
392
	printf("%#x<", arg);
393
	if(!((arg>0)^((MCL_CURRENT)>0)))
394
		if_print_or(arg, MCL_CURRENT, or);
395
	if(!((arg>0)^((MCL_FUTURE)>0)))
396
		if_print_or(arg, MCL_FUTURE, or);
397
	printf(">");
398
	if (or == 0)
399
		(void)printf("<invalid>%d", arg);
400
}
401
402
/* AUTO */
403
void
404
shmatname (int arg)
405
{
406
	int	or = 0;
407
	if (arg == 0) {
408
		printf("0<>");
409
		return;
410
	}
411
	printf("%#x<", arg);
412
	if(!((arg>0)^((SHM_RDONLY)>0)))
413
		if_print_or(arg, SHM_RDONLY, or);
414
	if(!((arg>0)^((SHM_RND)>0)))
415
		if_print_or(arg, SHM_RND, or);
416
	printf(">");
417
	if (or == 0)
418
		(void)printf("<invalid>%d", arg);
419
}
420
421
/* AUTO */
422
void
423
whencename (int arg)
424
{
425

150482
	switch (arg) {
426
	case SEEK_SET:
427
		(void)printf("SEEK_SET");
428
		break;
429
	case SEEK_CUR:
430
196
		(void)printf("SEEK_CUR");
431
196
		break;
432
	case SEEK_END:
433
75045
		(void)printf("SEEK_END");
434
75045
		break;
435
	default: /* Should not reach */
436
		(void)printf("<invalid=%d>", arg);
437
	}
438
75241
}
439
440
/* AUTO */
441
void
442
pathconfname (int arg)
443
{
444
	switch (arg) {
445
	case _PC_LINK_MAX:
446
		(void)printf("_PC_LINK_MAX");
447
		break;
448
	case _PC_MAX_CANON:
449
		(void)printf("_PC_MAX_CANON");
450
		break;
451
	case _PC_MAX_INPUT:
452
		(void)printf("_PC_MAX_INPUT");
453
		break;
454
	case _PC_NAME_MAX:
455
		(void)printf("_PC_NAME_MAX");
456
		break;
457
	case _PC_PATH_MAX:
458
		(void)printf("_PC_PATH_MAX");
459
		break;
460
	case _PC_PIPE_BUF:
461
		(void)printf("_PC_PIPE_BUF");
462
		break;
463
	case _PC_CHOWN_RESTRICTED:
464
		(void)printf("_PC_CHOWN_RESTRICTED");
465
		break;
466
	case _PC_NO_TRUNC:
467
		(void)printf("_PC_NO_TRUNC");
468
		break;
469
	case _PC_VDISABLE:
470
		(void)printf("_PC_VDISABLE");
471
		break;
472
	case _PC_ALLOC_SIZE_MIN:
473
		(void)printf("_PC_ALLOC_SIZE_MIN");
474
		break;
475
	case _PC_ASYNC_IO:
476
		(void)printf("_PC_ASYNC_IO");
477
		break;
478
	case _PC_FILESIZEBITS:
479
		(void)printf("_PC_FILESIZEBITS");
480
		break;
481
	case _PC_PRIO_IO:
482
		(void)printf("_PC_PRIO_IO");
483
		break;
484
	case _PC_REC_INCR_XFER_SIZE:
485
		(void)printf("_PC_REC_INCR_XFER_SIZE");
486
		break;
487
	case _PC_REC_MAX_XFER_SIZE:
488
		(void)printf("_PC_REC_MAX_XFER_SIZE");
489
		break;
490
	case _PC_REC_MIN_XFER_SIZE:
491
		(void)printf("_PC_REC_MIN_XFER_SIZE");
492
		break;
493
	case _PC_REC_XFER_ALIGN:
494
		(void)printf("_PC_REC_XFER_ALIGN");
495
		break;
496
	case _PC_SYMLINK_MAX:
497
		(void)printf("_PC_SYMLINK_MAX");
498
		break;
499
	case _PC_SYNC_IO:
500
		(void)printf("_PC_SYNC_IO");
501
		break;
502
	case _PC_TIMESTAMP_RESOLUTION:
503
		(void)printf("_PC_TIMESTAMP_RESOLUTION");
504
		break;
505
	default: /* Should not reach */
506
		(void)printf("<invalid=%d>", arg);
507
	}
508
}
509
510
/* AUTO */
511
void
512
rlimitname (int arg)
513
{
514


96
	switch (arg) {
515
	case RLIMIT_CPU:
516
		(void)printf("RLIMIT_CPU");
517
		break;
518
	case RLIMIT_FSIZE:
519
		(void)printf("RLIMIT_FSIZE");
520
		break;
521
	case RLIMIT_DATA:
522
		(void)printf("RLIMIT_DATA");
523
		break;
524
	case RLIMIT_STACK:
525
		(void)printf("RLIMIT_STACK");
526
		break;
527
	case RLIMIT_CORE:
528
		(void)printf("RLIMIT_CORE");
529
		break;
530
	case RLIMIT_RSS:
531
		(void)printf("RLIMIT_RSS");
532
		break;
533
	case RLIMIT_MEMLOCK:
534
		(void)printf("RLIMIT_MEMLOCK");
535
		break;
536
	case RLIMIT_NPROC:
537
		(void)printf("RLIMIT_NPROC");
538
		break;
539
	case RLIMIT_NOFILE:
540
48
		(void)printf("RLIMIT_NOFILE");
541
48
		break;
542
	default: /* Should not reach */
543
		(void)printf("<invalid=%d>", arg);
544
	}
545
48
}
546
547
/* AUTO */
548
void
549
shutdownhowname (int arg)
550
{
551

848
	switch (arg) {
552
	case SHUT_RD:
553
424
		(void)printf("SHUT_RD");
554
424
		break;
555
	case SHUT_WR:
556
		(void)printf("SHUT_WR");
557
		break;
558
	case SHUT_RDWR:
559
		(void)printf("SHUT_RDWR");
560
		break;
561
	default: /* Should not reach */
562
		(void)printf("<invalid=%d>", arg);
563
	}
564
424
}
565
566
/* AUTO */
567
void
568
prioname (int arg)
569
{
570
	switch (arg) {
571
	case PRIO_MAX:
572
		(void)printf("PRIO_MAX");
573
		break;
574
	case PRIO_PROCESS:
575
		(void)printf("PRIO_PROCESS");
576
		break;
577
	case PRIO_PGRP:
578
		(void)printf("PRIO_PGRP");
579
		break;
580
	case PRIO_USER:
581
		(void)printf("PRIO_USER");
582
		break;
583
	default: /* Should not reach */
584
		(void)printf("<invalid=%d>", arg);
585
	}
586
}
587
588
/* AUTO */
589
void
590
madvisebehavname (int arg)
591
{
592
	switch (arg) {
593
	case MADV_SPACEAVAIL:
594
		(void)printf("MADV_SPACEAVAIL");
595
		break;
596
	case MADV_FREE:
597
		(void)printf("MADV_FREE");
598
		break;
599
	default: /* Should not reach */
600
		(void)printf("<invalid=%d>", arg);
601
	}
602
}
603
604
/* AUTO */
605
void
606
msyncflagsname (int arg)
607
{
608

150090
	switch (arg) {
609
	case MS_ASYNC:
610
		(void)printf("MS_ASYNC");
611
		break;
612
	case MS_SYNC:
613
75045
		(void)printf("MS_SYNC");
614
75045
		break;
615
	case MS_INVALIDATE:
616
		(void)printf("MS_INVALIDATE");
617
		break;
618
	default: /* Should not reach */
619
		(void)printf("<invalid=%d>", arg);
620
	}
621
75045
}
622
623
/* AUTO */
624
void
625
clocktypename (int arg)
626
{
627

10020
	switch (arg) {
628
	case CLOCK_REALTIME:
629
		(void)printf("CLOCK_REALTIME");
630
		break;
631
	case CLOCK_PROCESS_CPUTIME_ID:
632
		(void)printf("CLOCK_PROCESS_CPUTIME_ID");
633
		break;
634
	case CLOCK_MONOTONIC:
635
5010
		(void)printf("CLOCK_MONOTONIC");
636
5010
		break;
637
	case CLOCK_THREAD_CPUTIME_ID:
638
		(void)printf("CLOCK_THREAD_CPUTIME_ID");
639
		break;
640
	case CLOCK_UPTIME:
641
		(void)printf("CLOCK_UPTIME");
642
		break;
643
	default: /* Should not reach */
644
		(void)printf("<invalid=%d>", arg);
645
	}
646
5010
}
647
648
/* AUTO */
649
void
650
rusagewho (int arg)
651
{
652

920
	switch (arg) {
653
	case RUSAGE_SELF:
654
		(void)printf("RUSAGE_SELF");
655
		break;
656
	case RUSAGE_CHILDREN:
657
460
		(void)printf("RUSAGE_CHILDREN");
658
460
		break;
659
	case RUSAGE_THREAD:
660
		(void)printf("RUSAGE_THREAD");
661
		break;
662
	default: /* Should not reach */
663
		(void)printf("<invalid=%d>", arg);
664
	}
665
460
}
666
667
/* AUTO */
668
void
669
sigactionflagname (int arg)
670
{
671
	int	or = 0;
672
35280
	if (arg == 0) {
673
5084
		printf("0<>");
674
5084
		return;
675
	}
676
12556
	printf("%#x<", arg);
677
12556
	if(!((arg>0)^((SA_ONSTACK)>0)))
678

12556
		if_print_or(arg, SA_ONSTACK, or);
679
12556
	if(!((arg>0)^((SA_RESTART)>0)))
680

37668
		if_print_or(arg, SA_RESTART, or);
681
12556
	if(!((arg>0)^((SA_RESETHAND)>0)))
682

12556
		if_print_or(arg, SA_RESETHAND, or);
683
12556
	if(!((arg>0)^((SA_NODEFER)>0)))
684

12556
		if_print_or(arg, SA_NODEFER, or);
685
12556
	if(!((arg>0)^((SA_NOCLDWAIT)>0)))
686

12556
		if_print_or(arg, SA_NOCLDWAIT, or);
687
12556
	if(!((arg>0)^((SA_NOCLDSTOP)>0)))
688

14556
		if_print_or(arg, SA_NOCLDSTOP, or);
689
12556
	if(!((arg>0)^((SA_SIGINFO)>0)))
690

12556
		if_print_or(arg, SA_SIGINFO, or);
691
12556
	printf(">");
692
12556
	if (or == 0)
693
		(void)printf("<invalid>%d", arg);
694
30196
}
695
696
/* AUTO */
697
void
698
sigprocmaskhowname (int arg)
699
{
700

4980
	switch (arg) {
701
	case SIG_BLOCK:
702
462
		(void)printf("SIG_BLOCK");
703
462
		break;
704
	case SIG_UNBLOCK:
705
		(void)printf("SIG_UNBLOCK");
706
		break;
707
	case SIG_SETMASK:
708
2028
		(void)printf("SIG_SETMASK");
709
2028
		break;
710
	default: /* Should not reach */
711
		(void)printf("<invalid=%d>", arg);
712
	}
713
2490
}
714
715
/* AUTO */
716
void
717
sigill_name (int arg)
718
{
719
	switch (arg) {
720
	case ILL_ILLOPC:
721
		(void)printf("ILL_ILLOPC");
722
		break;
723
	case ILL_ILLOPN:
724
		(void)printf("ILL_ILLOPN");
725
		break;
726
	case ILL_ILLADR:
727
		(void)printf("ILL_ILLADR");
728
		break;
729
	case ILL_ILLTRP:
730
		(void)printf("ILL_ILLTRP");
731
		break;
732
	case ILL_PRVOPC:
733
		(void)printf("ILL_PRVOPC");
734
		break;
735
	case ILL_PRVREG:
736
		(void)printf("ILL_PRVREG");
737
		break;
738
	case ILL_COPROC:
739
		(void)printf("ILL_COPROC");
740
		break;
741
	case ILL_BADSTK:
742
		(void)printf("ILL_BADSTK");
743
		break;
744
	default: /* Should not reach */
745
		(void)printf("<invalid=%d>", arg);
746
	}
747
}
748
749
/* AUTO */
750
void
751
sigtrap_name (int arg)
752
{
753
	switch (arg) {
754
	case TRAP_BRKPT:
755
		(void)printf("TRAP_BRKPT");
756
		break;
757
	case TRAP_TRACE:
758
		(void)printf("TRAP_TRACE");
759
		break;
760
	default: /* Should not reach */
761
		(void)printf("<invalid=%d>", arg);
762
	}
763
}
764
765
/* AUTO */
766
void
767
sigemt_name (int arg)
768
{
769
	switch (arg) {
770
	case EMT_TAGOVF:
771
		(void)printf("EMT_TAGOVF");
772
		break;
773
	default: /* Should not reach */
774
		(void)printf("<invalid=%d>", arg);
775
	}
776
}
777
778
/* AUTO */
779
void
780
sigfpe_name (int arg)
781
{
782
	switch (arg) {
783
	case FPE_INTDIV:
784
		(void)printf("FPE_INTDIV");
785
		break;
786
	case FPE_INTOVF:
787
		(void)printf("FPE_INTOVF");
788
		break;
789
	case FPE_FLTDIV:
790
		(void)printf("FPE_FLTDIV");
791
		break;
792
	case FPE_FLTOVF:
793
		(void)printf("FPE_FLTOVF");
794
		break;
795
	case FPE_FLTUND:
796
		(void)printf("FPE_FLTUND");
797
		break;
798
	case FPE_FLTRES:
799
		(void)printf("FPE_FLTRES");
800
		break;
801
	case FPE_FLTINV:
802
		(void)printf("FPE_FLTINV");
803
		break;
804
	case FPE_FLTSUB:
805
		(void)printf("FPE_FLTSUB");
806
		break;
807
	default: /* Should not reach */
808
		(void)printf("<invalid=%d>", arg);
809
	}
810
}
811
812
/* AUTO */
813
void
814
sigbus_name (int arg)
815
{
816
	switch (arg) {
817
	case BUS_ADRALN:
818
		(void)printf("BUS_ADRALN");
819
		break;
820
	case BUS_ADRERR:
821
		(void)printf("BUS_ADRERR");
822
		break;
823
	case BUS_OBJERR:
824
		(void)printf("BUS_OBJERR");
825
		break;
826
	default: /* Should not reach */
827
		(void)printf("<invalid=%d>", arg);
828
	}
829
}
830
831
/* AUTO */
832
void
833
sigsegv_name (int arg)
834
{
835
	switch (arg) {
836
	case SEGV_MAPERR:
837
		(void)printf("SEGV_MAPERR");
838
		break;
839
	case SEGV_ACCERR:
840
		(void)printf("SEGV_ACCERR");
841
		break;
842
	default: /* Should not reach */
843
		(void)printf("<invalid=%d>", arg);
844
	}
845
}
846
847
/* AUTO */
848
void
849
sigchld_name (int arg)
850
{
851
	switch (arg) {
852
	case CLD_EXITED:
853
		(void)printf("CLD_EXITED");
854
		break;
855
	case CLD_KILLED:
856
		(void)printf("CLD_KILLED");
857
		break;
858
	case CLD_DUMPED:
859
		(void)printf("CLD_DUMPED");
860
		break;
861
	case CLD_TRAPPED:
862
		(void)printf("CLD_TRAPPED");
863
		break;
864
	case CLD_STOPPED:
865
		(void)printf("CLD_STOPPED");
866
		break;
867
	case CLD_CONTINUED:
868
		(void)printf("CLD_CONTINUED");
869
		break;
870
	default: /* Should not reach */
871
		(void)printf("<invalid=%d>", arg);
872
	}
873
}
874
875
/* AUTO */
876
void
877
minheritname (int arg)
878
{
879

1974
	switch (arg) {
880
	case MAP_INHERIT_SHARE:
881
		(void)printf("MAP_INHERIT_SHARE");
882
		break;
883
	case MAP_INHERIT_COPY:
884
		(void)printf("MAP_INHERIT_COPY");
885
		break;
886
	case MAP_INHERIT_NONE:
887
		(void)printf("MAP_INHERIT_NONE");
888
		break;
889
	case MAP_INHERIT_ZERO:
890
987
		(void)printf("MAP_INHERIT_ZERO");
891
987
		break;
892
	default: /* Should not reach */
893
		(void)printf("<invalid=%d>", arg);
894
	}
895
987
}
896
897
/* AUTO */
898
void
899
quotactlname (int arg)
900
{
901
	switch (arg) {
902
	case Q_QUOTAON:
903
		(void)printf("Q_QUOTAON");
904
		break;
905
	case Q_QUOTAOFF:
906
		(void)printf("Q_QUOTAOFF");
907
		break;
908
	case Q_GETQUOTA:
909
		(void)printf("Q_GETQUOTA");
910
		break;
911
	case Q_SETQUOTA:
912
		(void)printf("Q_SETQUOTA");
913
		break;
914
	case Q_SETUSE:
915
		(void)printf("Q_SETUSE");
916
		break;
917
	case Q_SYNC:
918
		(void)printf("Q_SYNC");
919
		break;
920
	default: /* Should not reach */
921
		(void)printf("<invalid=%d>", arg);
922
	}
923
}
924
925
/* AUTO */
926
void
927
sockfamilyname (int arg)
928
{
929
8692
	if (arg == AF_UNSPEC)
930
		printf("AF_UNSPEC");
931
4346
	else if (arg == AF_LOCAL)
932
1884
		printf("AF_LOCAL");
933
2462
	else if (arg == AF_UNIX)
934
		printf("AF_UNIX");
935
2462
	else if (arg == AF_INET)
936
1854
		printf("AF_INET");
937
608
	else if (arg == AF_IMPLINK)
938
		printf("AF_IMPLINK");
939
608
	else if (arg == AF_PUP)
940
		printf("AF_PUP");
941
608
	else if (arg == AF_CHAOS)
942
		printf("AF_CHAOS");
943
608
	else if (arg == AF_NS)
944
		printf("AF_NS");
945
608
	else if (arg == AF_ISO)
946
		printf("AF_ISO");
947
608
	else if (arg == AF_OSI)
948
		printf("AF_OSI");
949
608
	else if (arg == AF_ECMA)
950
		printf("AF_ECMA");
951
608
	else if (arg == AF_DATAKIT)
952
		printf("AF_DATAKIT");
953
608
	else if (arg == AF_CCITT)
954
		printf("AF_CCITT");
955
608
	else if (arg == AF_SNA)
956
		printf("AF_SNA");
957
608
	else if (arg == AF_DECnet)
958
		printf("AF_DECnet");
959
608
	else if (arg == AF_DLI)
960
		printf("AF_DLI");
961
608
	else if (arg == AF_LAT)
962
		printf("AF_LAT");
963
608
	else if (arg == AF_HYLINK)
964
		printf("AF_HYLINK");
965
608
	else if (arg == AF_APPLETALK)
966
		printf("AF_APPLETALK");
967
608
	else if (arg == AF_ROUTE)
968
		printf("AF_ROUTE");
969
608
	else if (arg == AF_LINK)
970
		printf("AF_LINK");
971
608
	else if (arg == AF_COIP)
972
		printf("AF_COIP");
973
608
	else if (arg == AF_CNT)
974
		printf("AF_CNT");
975
608
	else if (arg == AF_IPX)
976
		printf("AF_IPX");
977
608
	else if (arg == AF_INET6)
978
608
		printf("AF_INET6");
979
	else if (arg == AF_ISDN)
980
		printf("AF_ISDN");
981
	else if (arg == AF_E164)
982
		printf("AF_E164");
983
	else if (arg == AF_NATM)
984
		printf("AF_NATM");
985
	else if (arg == AF_ENCAP)
986
		printf("AF_ENCAP");
987
	else if (arg == AF_SIP)
988
		printf("AF_SIP");
989
	else if (arg == AF_KEY)
990
		printf("AF_KEY");
991
	else if (arg == AF_BLUETOOTH)
992
		printf("AF_BLUETOOTH");
993
	else if (arg == AF_MPLS)
994
		printf("AF_MPLS");
995
	else if (arg == AF_MAX)
996
		printf("AF_MAX");
997
	else /* Should not reach */
998
		(void)printf("<invalid=%d>", arg);
999
4346
}
1000
1001
/* AUTO */
1002
void
1003
sockipprotoname (int arg)
1004
{
1005
	if (arg == IPPROTO_IP)
1006
		printf("IPPROTO_IP");
1007
	else if (arg == IPPROTO_HOPOPTS)
1008
		printf("IPPROTO_HOPOPTS");
1009
	else if (arg == IPPROTO_ICMP)
1010
		printf("IPPROTO_ICMP");
1011
	else if (arg == IPPROTO_IGMP)
1012
		printf("IPPROTO_IGMP");
1013
	else if (arg == IPPROTO_GGP)
1014
		printf("IPPROTO_GGP");
1015
	else if (arg == IPPROTO_IPIP)
1016
		printf("IPPROTO_IPIP");
1017
	else if (arg == IPPROTO_IPV4)
1018
		printf("IPPROTO_IPV4");
1019
	else if (arg == IPPROTO_TCP)
1020
		printf("IPPROTO_TCP");
1021
	else if (arg == IPPROTO_EGP)
1022
		printf("IPPROTO_EGP");
1023
	else if (arg == IPPROTO_PUP)
1024
		printf("IPPROTO_PUP");
1025
	else if (arg == IPPROTO_UDP)
1026
		printf("IPPROTO_UDP");
1027
	else if (arg == IPPROTO_IDP)
1028
		printf("IPPROTO_IDP");
1029
	else if (arg == IPPROTO_TP)
1030
		printf("IPPROTO_TP");
1031
	else if (arg == IPPROTO_IPV6)
1032
		printf("IPPROTO_IPV6");
1033
	else if (arg == IPPROTO_ROUTING)
1034
		printf("IPPROTO_ROUTING");
1035
	else if (arg == IPPROTO_FRAGMENT)
1036
		printf("IPPROTO_FRAGMENT");
1037
	else if (arg == IPPROTO_RSVP)
1038
		printf("IPPROTO_RSVP");
1039
	else if (arg == IPPROTO_GRE)
1040
		printf("IPPROTO_GRE");
1041
	else if (arg == IPPROTO_ESP)
1042
		printf("IPPROTO_ESP");
1043
	else if (arg == IPPROTO_AH)
1044
		printf("IPPROTO_AH");
1045
	else if (arg == IPPROTO_MOBILE)
1046
		printf("IPPROTO_MOBILE");
1047
	else if (arg == IPPROTO_ICMPV6)
1048
		printf("IPPROTO_ICMPV6");
1049
	else if (arg == IPPROTO_NONE)
1050
		printf("IPPROTO_NONE");
1051
	else if (arg == IPPROTO_DSTOPTS)
1052
		printf("IPPROTO_DSTOPTS");
1053
	else if (arg == IPPROTO_EON)
1054
		printf("IPPROTO_EON");
1055
	else if (arg == IPPROTO_ETHERIP)
1056
		printf("IPPROTO_ETHERIP");
1057
	else if (arg == IPPROTO_ENCAP)
1058
		printf("IPPROTO_ENCAP");
1059
	else if (arg == IPPROTO_PIM)
1060
		printf("IPPROTO_PIM");
1061
	else if (arg == IPPROTO_IPCOMP)
1062
		printf("IPPROTO_IPCOMP");
1063
	else if (arg == IPPROTO_CARP)
1064
		printf("IPPROTO_CARP");
1065
	else if (arg == IPPROTO_MPLS)
1066
		printf("IPPROTO_MPLS");
1067
	else if (arg == IPPROTO_PFSYNC)
1068
		printf("IPPROTO_PFSYNC");
1069
	else if (arg == IPPROTO_RAW)
1070
		printf("IPPROTO_RAW");
1071
	else if (arg == IPPROTO_MAX)
1072
		printf("IPPROTO_MAX");
1073
	else if (arg == IPPROTO_DIVERT)
1074
		printf("IPPROTO_DIVERT");
1075
	else if (arg == IPPROTO_DONE)
1076
		printf("IPPROTO_DONE");
1077
	else if (arg == IPPROTO_MAXID)
1078
		printf("IPPROTO_MAXID");
1079
	else /* Should not reach */
1080
		(void)printf("<invalid=%d>", arg);
1081
}
1082
1083
/* AUTO */
1084
void
1085
sockoptname (int arg)
1086
{
1087






10504
	switch (arg) {
1088
	case SO_DEBUG:
1089
		(void)printf("SO_DEBUG");
1090
		break;
1091
	case SO_ACCEPTCONN:
1092
		(void)printf("SO_ACCEPTCONN");
1093
		break;
1094
	case SO_REUSEADDR:
1095
632
		(void)printf("SO_REUSEADDR");
1096
632
		break;
1097
	case SO_KEEPALIVE:
1098
		(void)printf("SO_KEEPALIVE");
1099
		break;
1100
	case SO_DONTROUTE:
1101
		(void)printf("SO_DONTROUTE");
1102
		break;
1103
	case SO_BROADCAST:
1104
		(void)printf("SO_BROADCAST");
1105
		break;
1106
	case SO_USELOOPBACK:
1107
		(void)printf("SO_USELOOPBACK");
1108
		break;
1109
	case SO_LINGER:
1110
		(void)printf("SO_LINGER");
1111
		break;
1112
	case SO_OOBINLINE:
1113
		(void)printf("SO_OOBINLINE");
1114
		break;
1115
	case SO_REUSEPORT:
1116
		(void)printf("SO_REUSEPORT");
1117
		break;
1118
	case SO_TIMESTAMP:
1119
		(void)printf("SO_TIMESTAMP");
1120
		break;
1121
	case SO_BINDANY:
1122
		(void)printf("SO_BINDANY");
1123
		break;
1124
	case SO_ZEROIZE:
1125
		(void)printf("SO_ZEROIZE");
1126
		break;
1127
	case SO_SNDBUF:
1128
1448
		(void)printf("SO_SNDBUF");
1129
1448
		break;
1130
	case SO_RCVBUF:
1131
3172
		(void)printf("SO_RCVBUF");
1132
3172
		break;
1133
	case SO_SNDLOWAT:
1134
		(void)printf("SO_SNDLOWAT");
1135
		break;
1136
	case SO_RCVLOWAT:
1137
		(void)printf("SO_RCVLOWAT");
1138
		break;
1139
	case SO_SNDTIMEO:
1140
		(void)printf("SO_SNDTIMEO");
1141
		break;
1142
	case SO_RCVTIMEO:
1143
		(void)printf("SO_RCVTIMEO");
1144
		break;
1145
	case SO_ERROR:
1146
		(void)printf("SO_ERROR");
1147
		break;
1148
	case SO_TYPE:
1149
		(void)printf("SO_TYPE");
1150
		break;
1151
	case SO_NETPROC:
1152
		(void)printf("SO_NETPROC");
1153
		break;
1154
	case SO_RTABLE:
1155
		(void)printf("SO_RTABLE");
1156
		break;
1157
	case SO_PEERCRED:
1158
		(void)printf("SO_PEERCRED");
1159
		break;
1160
	case SO_SPLICE:
1161
		(void)printf("SO_SPLICE");
1162
		break;
1163
	default: /* Should not reach */
1164
		(void)printf("<invalid=%d>", arg);
1165
	}
1166
5252
}
1167
1168
/* AUTO */
1169
void
1170
ktracefacname (int arg)
1171
{
1172
	int	or = 0;
1173
	if (arg == 0) {
1174
		printf("0<>");
1175
		return;
1176
	}
1177
	printf("%#x<", arg);
1178
	if(!((arg>0)^((KTRFAC_SYSCALL)>0)))
1179
		if_print_or(arg, KTRFAC_SYSCALL, or);
1180
	if(!((arg>0)^((KTRFAC_SYSRET)>0)))
1181
		if_print_or(arg, KTRFAC_SYSRET, or);
1182
	if(!((arg>0)^((KTRFAC_NAMEI)>0)))
1183
		if_print_or(arg, KTRFAC_NAMEI, or);
1184
	if(!((arg>0)^((KTRFAC_GENIO)>0)))
1185
		if_print_or(arg, KTRFAC_GENIO, or);
1186
	if(!((arg>0)^((KTRFAC_PSIG)>0)))
1187
		if_print_or(arg, KTRFAC_PSIG, or);
1188
	if(!((arg>0)^((KTRFAC_STRUCT)>0)))
1189
		if_print_or(arg, KTRFAC_STRUCT, or);
1190
	if(!((arg>0)^((KTRFAC_USER)>0)))
1191
		if_print_or(arg, KTRFAC_USER, or);
1192
	if(!((arg>0)^((KTRFAC_EXECARGS)>0)))
1193
		if_print_or(arg, KTRFAC_EXECARGS, or);
1194
	if(!((arg>0)^((KTRFAC_EXECENV)>0)))
1195
		if_print_or(arg, KTRFAC_EXECENV, or);
1196
	if(!((arg>0)^((KTRFAC_PLEDGE)>0)))
1197
		if_print_or(arg, KTRFAC_PLEDGE, or);
1198
	if(!((arg>0)^((KTRFAC_ROOT)>0)))
1199
		if_print_or(arg, KTRFAC_ROOT, or);
1200
	if(!((arg>0)^((KTRFAC_INHERIT)>0)))
1201
		if_print_or(arg, KTRFAC_INHERIT, or);
1202
	printf(">");
1203
	if (or == 0)
1204
		(void)printf("<invalid>%d", arg);
1205
}
1206
1207
/* AUTO */
1208
void
1209
itimername (int arg)
1210
{
1211
	switch (arg) {
1212
	case ITIMER_REAL:
1213
		(void)printf("ITIMER_REAL");
1214
		break;
1215
	case ITIMER_VIRTUAL:
1216
		(void)printf("ITIMER_VIRTUAL");
1217
		break;
1218
	case ITIMER_PROF:
1219
		(void)printf("ITIMER_PROF");
1220
		break;
1221
	default: /* Should not reach */
1222
		(void)printf("<invalid=%d>", arg);
1223
	}
1224
}
1225
1226
/* AUTO */
1227
void
1228
evfiltername (int arg)
1229
{
1230


6596
	switch (arg) {
1231
	case EVFILT_READ:
1232
1854
		(void)printf("EVFILT_READ");
1233
1854
		break;
1234
	case EVFILT_WRITE:
1235
208
		(void)printf("EVFILT_WRITE");
1236
208
		break;
1237
	case EVFILT_AIO:
1238
		(void)printf("EVFILT_AIO");
1239
		break;
1240
	case EVFILT_VNODE:
1241
		(void)printf("EVFILT_VNODE");
1242
		break;
1243
	case EVFILT_PROC:
1244
		(void)printf("EVFILT_PROC");
1245
		break;
1246
	case EVFILT_SIGNAL:
1247
1236
		(void)printf("EVFILT_SIGNAL");
1248
1236
		break;
1249
	case EVFILT_TIMER:
1250
		(void)printf("EVFILT_TIMER");
1251
		break;
1252
	default: /* Should not reach */
1253
		(void)printf("<invalid=%d>", arg);
1254
	}
1255
3298
}
1256
1257
/* AUTO */
1258
void
1259
pollfdeventname (int arg)
1260
{
1261
	int	or = 0;
1262
192
	if (arg == 0) {
1263
40
		printf("0<>");
1264
40
		return;
1265
	}
1266
56
	printf("%#x<", arg);
1267
56
	if(!((arg>0)^((POLLIN)>0)))
1268

168
		if_print_or(arg, POLLIN, or);
1269
56
	if(!((arg>0)^((POLLPRI)>0)))
1270

56
		if_print_or(arg, POLLPRI, or);
1271
56
	if(!((arg>0)^((POLLOUT)>0)))
1272

56
		if_print_or(arg, POLLOUT, or);
1273
56
	if(!((arg>0)^((POLLERR)>0)))
1274

56
		if_print_or(arg, POLLERR, or);
1275
56
	if(!((arg>0)^((POLLHUP)>0)))
1276

56
		if_print_or(arg, POLLHUP, or);
1277
56
	if(!((arg>0)^((POLLNVAL)>0)))
1278

56
		if_print_or(arg, POLLNVAL, or);
1279
56
	if(!((arg>0)^((POLLRDNORM)>0)))
1280

56
		if_print_or(arg, POLLRDNORM, or);
1281
56
	if(!((arg>0)^((POLLRDBAND)>0)))
1282

56
		if_print_or(arg, POLLRDBAND, or);
1283
56
	if(!((arg>0)^((POLLWRBAND)>0)))
1284

56
		if_print_or(arg, POLLWRBAND, or);
1285
56
	printf(">");
1286
56
	if (or == 0)
1287
		(void)printf("<invalid>%d", arg);
1288
152
}
1289
1290
/* AUTO */
1291
void
1292
evflagsname (int arg)
1293
{
1294
	int	or = 0;
1295
6596
	if (arg == 0) {
1296
		printf("0<>");
1297
		return;
1298
	}
1299
3298
	printf("%#x<", arg);
1300
3298
	if(!((arg>0)^((EV_ADD)>0)))
1301

9718
		if_print_or(arg, EV_ADD, or);
1302
3298
	if(!((arg>0)^((EV_DELETE)>0)))
1303

3474
		if_print_or(arg, EV_DELETE, or);
1304
3298
	if(!((arg>0)^((EV_ENABLE)>0)))
1305

3298
		if_print_or(arg, EV_ENABLE, or);
1306
3298
	if(!((arg>0)^((EV_DISABLE)>0)))
1307

3298
		if_print_or(arg, EV_DISABLE, or);
1308
3298
	if(!((arg>0)^((EV_ONESHOT)>0)))
1309

5978
		if_print_or(arg, EV_ONESHOT, or);
1310
3298
	if(!((arg>0)^((EV_CLEAR)>0)))
1311

4434
		if_print_or(arg, EV_CLEAR, or);
1312
3298
	if(!((arg>0)^((EV_RECEIPT)>0)))
1313

3298
		if_print_or(arg, EV_RECEIPT, or);
1314
3298
	if(!((arg>0)^((EV_DISPATCH)>0)))
1315

3298
		if_print_or(arg, EV_DISPATCH, or);
1316
3298
	if(!((arg>0)^((EV_EOF)>0)))
1317

3538
		if_print_or(arg, EV_EOF, or);
1318
3298
	if(!((arg>0)^((EV_ERROR)>0)))
1319

3298
		if_print_or(arg, EV_ERROR, or);
1320
3298
	printf(">");
1321
3298
	if (or == 0)
1322
		(void)printf("<invalid>%d", arg);
1323
6596
}
1324
1325
/* AUTO */
1326
void
1327
syslogflagname (int arg)
1328
{
1329
	int	or = 0;
1330
624
	if (arg == 0) {
1331
96
		printf("0<>");
1332
96
		return;
1333
	}
1334
216
	printf("%#x<", arg);
1335
216
	if(!((arg>0)^((LOG_PID)>0)))
1336

216
		if_print_or(arg, LOG_PID, or);
1337
216
	if(!((arg>0)^((LOG_CONS)>0)))
1338

648
		if_print_or(arg, LOG_CONS, or);
1339
216
	if(!((arg>0)^((LOG_ODELAY)>0)))
1340

216
		if_print_or(arg, LOG_ODELAY, or);
1341
216
	if(!((arg>0)^((LOG_NDELAY)>0)))
1342

216
		if_print_or(arg, LOG_NDELAY, or);
1343
216
	if(!((arg>0)^((LOG_NOWAIT)>0)))
1344

216
		if_print_or(arg, LOG_NOWAIT, or);
1345
216
	if(!((arg>0)^((LOG_PERROR)>0)))
1346

216
		if_print_or(arg, LOG_PERROR, or);
1347
216
	printf(">");
1348
216
	if (or == 0)
1349
		(void)printf("<invalid>%d", arg);
1350
528
}
1351
1352
/* AUTO */
1353
void
1354
futexflagname (int arg)
1355
{
1356
	int	or = 0;
1357
	if (arg == 0) {
1358
		printf("0<>");
1359
		return;
1360
	}
1361
	printf("%#x<", arg);
1362
	if(!((arg>0)^((FUTEX_WAIT)>0)))
1363
		if_print_or(arg, FUTEX_WAIT, or);
1364
	if(!((arg>0)^((FUTEX_WAKE)>0)))
1365
		if_print_or(arg, FUTEX_WAKE, or);
1366
	if(!((arg>0)^((FUTEX_REQUEUE)>0)))
1367
		if_print_or(arg, FUTEX_REQUEUE, or);
1368
	printf(">");
1369
	if (or == 0)
1370
		(void)printf("<invalid>%d", arg);
1371
}
1372
1373
/*
1374
 * AUTO - Special
1375
 * F_ is used to specify fcntl commands as well as arguments. Both sets are
1376
 * grouped in fcntl.h, and this awk script grabs the first group.
1377
 */
1378
void
1379
fcntlcmdname (int arg)
1380
{
1381



156992
	switch (arg1) {
1382
	case F_DUPFD:
1383
		(void)printf("F_DUPFD");
1384
		break;
1385
	case F_GETFD:
1386
		(void)printf("F_GETFD");
1387
		break;
1388
	case F_SETFD:
1389
124
		(void)printf("F_SETFD");
1390
124
		break;
1391
	case F_GETFL:
1392
76868
		(void)printf("F_GETFL");
1393
76868
		break;
1394
	case F_SETFL:
1395
532
		(void)printf("F_SETFL");
1396
532
		break;
1397
	case F_GETOWN:
1398
		(void)printf("F_GETOWN");
1399
		break;
1400
	case F_SETOWN:
1401
		(void)printf("F_SETOWN");
1402
		break;
1403
	case F_GETLK:
1404
		(void)printf("F_GETLK");
1405
		break;
1406
	case F_SETLK:
1407
		(void)printf("F_SETLK");
1408
		break;
1409
	case F_SETLKW:
1410
		(void)printf("F_SETLKW");
1411
		break;
1412
	case F_DUPFD_CLOEXEC:
1413
		(void)printf("F_DUPFD_CLOEXEC");
1414
		break;
1415
	case F_ISATTY:
1416
972
		(void)printf("F_ISATTY");
1417
972
		break;
1418
	default: /* Should not reach */
1419
		(void)printf("<invalid=%d>", arg1);
1420
	}
1421
78496
	if (arg1 == F_SETFD) {
1422
248
		(void)putchar(',');
1423
124
		if (arg == FD_CLOEXEC)
1424
124
			(void)printf("FD_CLOEXEC");
1425
		else if (arg == 0)
1426
			(void)printf("0");
1427
		else
1428
			(void)printf("<invalid>%#x", arg);
1429
1430
78372
	} else if (arg1 == F_SETFL) {
1431
1064
		(void)putchar(',');
1432
532
		doflagsname(arg, 0);
1433

156212
	} else if (!fancy || (arg1 != F_GETFD && arg1 != F_GETFL && arg1 != F_ISATTY))
1434
		(void)printf(",%#x", arg);
1435
78496
}
1436
1437
/*
1438
 * AUTO - Special
1439
 *
1440
 * The send and recv functions have a flags argument which can be
1441
 * set to 0. There is no corresponding #define. The auto_ functions
1442
 * detect this as "invalid", which is incorrect here.
1443
 */
1444
void
1445
sendrecvflagsname (int flags)
1446
{
1447
	int	or = 0;
1448
1449
28068
	if (flags == 0) {
1450
14034
		(void)printf("0");
1451
14034
		return;
1452
	}
1453
1454
	printf("%#x<", flags);
1455
	if(!((flags>0)^((MSG_OOB)>0)))
1456
		if_print_or(flags, MSG_OOB, or);
1457
	if(!((flags>0)^((MSG_PEEK)>0)))
1458
		if_print_or(flags, MSG_PEEK, or);
1459
	if(!((flags>0)^((MSG_DONTROUTE)>0)))
1460
		if_print_or(flags, MSG_DONTROUTE, or);
1461
	if(!((flags>0)^((MSG_EOR)>0)))
1462
		if_print_or(flags, MSG_EOR, or);
1463
	if(!((flags>0)^((MSG_TRUNC)>0)))
1464
		if_print_or(flags, MSG_TRUNC, or);
1465
	if(!((flags>0)^((MSG_CTRUNC)>0)))
1466
		if_print_or(flags, MSG_CTRUNC, or);
1467
	if(!((flags>0)^((MSG_WAITALL)>0)))
1468
		if_print_or(flags, MSG_WAITALL, or);
1469
	if(!((flags>0)^((MSG_DONTWAIT)>0)))
1470
		if_print_or(flags, MSG_DONTWAIT, or);
1471
	if(!((flags>0)^((MSG_BCAST)>0)))
1472
		if_print_or(flags, MSG_BCAST, or);
1473
	if(!((flags>0)^((MSG_MCAST)>0)))
1474
		if_print_or(flags, MSG_MCAST, or);
1475
	if(!((flags>0)^((MSG_NOSIGNAL)>0)))
1476
		if_print_or(flags, MSG_NOSIGNAL, or);
1477
	if(!((flags>0)^((MSG_CMSG_CLOEXEC)>0)))
1478
		if_print_or(flags, MSG_CMSG_CLOEXEC, or);
1479
	printf(">");
1480
14034
}
1481
1482
/*
1483
 * AUTO - Special
1484
 *
1485
 * SOCK_NONBLOCK and SOCK_CLOEXEC are or'ed into the type
1486
 */
1487
static void
1488
dosocktypename (int arg, int show_type)
1489
{
1490
3472
	int	type = arg & 0xff;		/* XXX */
1491
	int	or = 0;
1492
1493
1736
	printf("%#x<", arg);
1494
1736
	if (show_type || type) {
1495
		or = 1;
1496

1688
		switch (type) {
1497
		case SOCK_STREAM:
1498
648
			(void)printf("SOCK_STREAM");
1499
648
			break;
1500
		case SOCK_DGRAM:
1501
1040
			(void)printf("SOCK_DGRAM");
1502
1040
			break;
1503
		case SOCK_RAW:
1504
			(void)printf("SOCK_RAW");
1505
			break;
1506
		case SOCK_RDM:
1507
			(void)printf("SOCK_RDM");
1508
			break;
1509
		case SOCK_SEQPACKET:
1510
			(void)printf("SOCK_SEQPACKET");
1511
			break;
1512
		default: /* Should not reach */
1513
			(void)printf("<invalid=%d>", arg);
1514
		}
1515
	}
1516
1517

1768
	if_print_or(arg, SOCK_CLOEXEC, or);
1518

4536
	if_print_or(arg, SOCK_NONBLOCK, or);
1519

1736
	if_print_or(arg, SOCK_DNS, or);
1520
1736
	printf(">");
1521
1736
}
1522
1523
void
1524
socktypename (int arg)
1525
{
1526
3376
	dosocktypename(arg, 1);
1527
1688
}
1528
1529
void
1530
sockflagsname (int arg)
1531
{
1532
96
	dosocktypename(arg, 0);
1533
48
}
1534
1535
void
1536
quotactlcmdname(int cmd)
1537
{
1538
	printf("%#x<QCMD(", cmd);
1539
	quotactlname(cmd >> SUBCMDSHIFT);
1540
	switch (cmd & SUBCMDMASK) {
1541
	case USRQUOTA:
1542
		printf(",%s)>", "USRQUOTA");
1543
		break;
1544
	case GRPQUOTA:
1545
		printf(",%s)>", "GRPQUOTA");
1546
		break;
1547
	default:
1548
		printf(",<invalid>%#x)>", cmd & SUBCMDMASK);
1549
		break;
1550
	}
1551
}
1552
1553
/*
1554
 * AUTO - Special
1555
 *
1556
 * kevent() NOTE_* interpretation depends on the filter type
1557
 */
1558
void
1559
evfflagsname (int filter, int fflags)
1560
{
1561
	int	or = 0;
1562
1563
6596
	if (fflags == 0) {
1564
2123
		printf("0<>");
1565
2123
		return;
1566
	}
1567
2350
	printf("%#x<", fflags);
1568

2350
	switch (filter) {
1569
	case EVFILT_READ:
1570
	case EVFILT_WRITE:
1571

1175
		if_print_or(fflags, NOTE_LOWAT, or);
1572

3525
		if_print_or(fflags, NOTE_EOF, or);
1573
		break;
1574
	case EVFILT_VNODE:
1575
		if_print_or(fflags, NOTE_DELETE, or);
1576
		if_print_or(fflags, NOTE_WRITE, or);
1577
		if_print_or(fflags, NOTE_EXTEND, or);
1578
		if_print_or(fflags, NOTE_ATTRIB, or);
1579
		if_print_or(fflags, NOTE_LINK, or);
1580
		if_print_or(fflags, NOTE_RENAME, or);
1581
		if_print_or(fflags, NOTE_REVOKE, or);
1582
		if_print_or(fflags, NOTE_TRUNCATE, or);
1583
		break;
1584
	case EVFILT_PROC:
1585
		if_print_or(fflags, NOTE_EXIT, or);
1586
		if_print_or(fflags, NOTE_FORK, or);
1587
		if_print_or(fflags, NOTE_EXEC, or);
1588
		if_print_or(fflags, NOTE_TRACK, or);
1589
		if_print_or(fflags, NOTE_TRACKERR, or);
1590
		if_print_or(fflags, NOTE_CHILD, or);
1591
		break;
1592
	}
1593
1175
	printf(">");
1594
4473
}
1595