1292236Sjhb/*-
2292236Sjhb * Copyright (c) 2015 John H. Baldwin <jhb@FreeBSD.org>
3292236Sjhb *
4292236Sjhb * Redistribution and use in source and binary forms, with or without
5292236Sjhb * modification, are permitted provided that the following conditions
6292236Sjhb * are met:
7292236Sjhb * 1. Redistributions of source code must retain the above copyright
8292236Sjhb *    notice, this list of conditions and the following disclaimer.
9292236Sjhb * 2. Redistributions in binary form must reproduce the above copyright
10292236Sjhb *    notice, this list of conditions and the following disclaimer in the
11292236Sjhb *    documentation and/or other materials provided with the distribution.
12292236Sjhb *
13292236Sjhb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14292236Sjhb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15292236Sjhb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16292236Sjhb * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17292236Sjhb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18292236Sjhb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19292236Sjhb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20292236Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21292236Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22292236Sjhb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23292236Sjhb * SUCH DAMAGE.
24292236Sjhb *
25292236Sjhb * $FreeBSD: stable/11/lib/libsysdecode/sysdecode.h 367457 2020-11-07 18:10:59Z dim $
26292236Sjhb */
27292236Sjhb
28292236Sjhb#ifndef __SYSDECODE_H__
29292236Sjhb#define	__SYSDECODE_H__
30292236Sjhb
31294849Sjhbenum sysdecode_abi {
32295056Sjhb	SYSDECODE_ABI_UNKNOWN = 0,
33295056Sjhb	SYSDECODE_ABI_FREEBSD,
34295056Sjhb	SYSDECODE_ABI_FREEBSD32,
35295056Sjhb	SYSDECODE_ABI_LINUX,
36295056Sjhb	SYSDECODE_ABI_LINUX32,
37295056Sjhb	SYSDECODE_ABI_CLOUDABI64
38294849Sjhb};
39294849Sjhb
40295931Sjhbint	sysdecode_abi_to_freebsd_errno(enum sysdecode_abi _abi, int _error);
41311999Sjhbbool	sysdecode_access_mode(FILE *_fp, int _mode, int *_rem);
42311999Sjhbconst char *sysdecode_acltype(int _type);
43311999Sjhbconst char *sysdecode_atfd(int _fd);
44326044Sjhbbool	sysdecode_atflags(FILE *_fp, int _flags, int *_rem);
45311999Sjhbbool	sysdecode_cap_fcntlrights(FILE *_fp, uint32_t _rights, uint32_t *_rem);
46311999Sjhbvoid	sysdecode_cap_rights(FILE *_fp, cap_rights_t *_rightsp);
47332247Stuexenconst char *sysdecode_cmsg_type(int _cmsg_level, int _cmsg_type);
48311999Sjhbconst char *sysdecode_extattrnamespace(int _namespace);
49311999Sjhbconst char *sysdecode_fadvice(int _advice);
50311999Sjhbvoid	sysdecode_fcntl_arg(FILE *_fp, int _cmd, uintptr_t _arg, int _base);
51311999Sjhbbool	sysdecode_fcntl_arg_p(int _cmd);
52311999Sjhbconst char *sysdecode_fcntl_cmd(int _cmd);
53311999Sjhbbool	sysdecode_fcntl_fileflags(FILE *_fp, int _flags, int *_rem);
54311999Sjhbbool	sysdecode_fileflags(FILE *_fp, fflags_t _flags, fflags_t *_rem);
55311999Sjhbbool	sysdecode_filemode(FILE *_fp, int _mode, int *_rem);
56311999Sjhbbool	sysdecode_flock_operation(FILE *_fp, int _operation, int *_rem);
57295931Sjhbint	sysdecode_freebsd_to_abi_errno(enum sysdecode_abi _abi, int _error);
58311999Sjhbconst char *sysdecode_getfsstat_mode(int _mode);
59326044Sjhbconst char *sysdecode_getrusage_who(int _who);
60311999Sjhbconst char *sysdecode_idtype(int _idtype);
61292622Sjhbconst char *sysdecode_ioctlname(unsigned long _val);
62311999Sjhbconst char *sysdecode_ipproto(int _protocol);
63328454Sjhbvoid	sysdecode_kevent_fflags(FILE *_fp, short _filter, int _fflags,
64328454Sjhb	    int _base);
65328454Sjhbconst char *sysdecode_kevent_filter(int _filter);
66328454Sjhbbool	sysdecode_kevent_flags(FILE *_fp, int _flags, int *_rem);
67311999Sjhbconst char *sysdecode_kldsym_cmd(int _cmd);
68311999Sjhbconst char *sysdecode_kldunload_flags(int _flags);
69311999Sjhbconst char *sysdecode_lio_listio_mode(int _mode);
70311999Sjhbconst char *sysdecode_madvice(int _advice);
71311999Sjhbconst char *sysdecode_minherit_inherit(int _inherit);
72311999Sjhbconst char *sysdecode_msgctl_cmd(int _cmd);
73311999Sjhbbool	sysdecode_mlockall_flags(FILE *_fp, int _flags, int *_rem);
74311999Sjhbbool	sysdecode_mmap_flags(FILE *_fp, int _flags, int *_rem);
75311999Sjhbbool	sysdecode_mmap_prot(FILE *_fp, int _prot, int *_rem);
76311999Sjhbbool	sysdecode_mount_flags(FILE *_fp, int _flags, int *_rem);
77311999Sjhbbool	sysdecode_msg_flags(FILE *_fp, int _flags, int *_rem);
78311999Sjhbbool	sysdecode_msync_flags(FILE *_fp, int _flags, int *_rem);
79311999Sjhbconst char *sysdecode_nfssvc_flags(int _flags);
80311999Sjhbbool	sysdecode_open_flags(FILE *_fp, int _flags, int *_rem);
81326044Sjhbconst char *sysdecode_pathconf_name(int _name);
82311999Sjhbbool	sysdecode_pipe2_flags(FILE *_fp, int _flags, int *_rem);
83311999Sjhbconst char *sysdecode_prio_which(int _which);
84311999Sjhbconst char *sysdecode_procctl_cmd(int _cmd);
85311999Sjhbconst char *sysdecode_ptrace_request(int _request);
86311999Sjhbbool	sysdecode_quotactl_cmd(FILE *_fp, int _cmd);
87311999Sjhbbool	sysdecode_reboot_howto(FILE *_fp, int _howto, int *_rem);
88311999Sjhbbool	sysdecode_rfork_flags(FILE *_fp, int _flags, int *_rem);
89311999Sjhbconst char *sysdecode_rlimit(int _resource);
90311999Sjhbconst char *sysdecode_rtprio_function(int _function);
91311999Sjhbconst char *sysdecode_scheduler_policy(int _policy);
92332248Stuexenbool	sysdecode_sctp_nxt_flags(FILE *_fp, int _flags, int *_rem);
93332243Stuexenconst char *sysdecode_sctp_pr_policy(int _policy);
94332248Stuexenbool	sysdecode_sctp_rcv_flags(FILE *_fp, int _flags, int *_rem);
95332244Stuexenvoid	sysdecode_sctp_sinfo_flags(FILE *_fp, int _sinfo_flags);
96332248Stuexenbool	sysdecode_sctp_snd_flags(FILE *_fp, int _flags, int *_rem);
97311999Sjhbconst char *sysdecode_semctl_cmd(int _cmd);
98311999Sjhbbool	sysdecode_semget_flags(FILE *_fp, int _flag, int *_rem);
99311999Sjhbbool	sysdecode_sendfile_flags(FILE *_fp, int _flags, int *_rem);
100311999Sjhbbool	sysdecode_shmat_flags(FILE *_fp, int _flags, int *_rem);
101311999Sjhbconst char *sysdecode_shmctl_cmd(int _cmd);
102311999Sjhbconst char *sysdecode_shutdown_how(int _how);
103311999Sjhbconst char *sysdecode_sigbus_code(int _si_code);
104311999Sjhbconst char *sysdecode_sigchld_code(int _si_code);
105311999Sjhbconst char *sysdecode_sigcode(int _sig, int _si_code);
106311999Sjhbconst char *sysdecode_sigfpe_code(int _si_code);
107311999Sjhbconst char *sysdecode_sigill_code(int _si_code);
108311999Sjhbconst char *sysdecode_signal(int _sig);
109311999Sjhbconst char *sysdecode_sigprocmask_how(int _how);
110311999Sjhbconst char *sysdecode_sigsegv_code(int _si_code);
111311999Sjhbconst char *sysdecode_sigtrap_code(int _si_code);
112311999Sjhbconst char *sysdecode_sockaddr_family(int _sa_family);
113311999Sjhbconst char *sysdecode_socketdomain(int _domain);
114319417Stuexenconst char *sysdecode_socket_protocol(int _domain, int _protocol);
115311999Sjhbbool	sysdecode_socket_type(FILE *_fp, int _type, int *_rem);
116311999Sjhbconst char *sysdecode_sockopt_level(int _level);
117311999Sjhbconst char *sysdecode_sockopt_name(int _level, int _optname);
118294849Sjhbconst char *sysdecode_syscallname(enum sysdecode_abi _abi, unsigned int _code);
119326044Sjhbconst char *sysdecode_sysarch_number(int _number);
120311999Sjhbbool	sysdecode_thr_create_flags(FILE *_fp, int _flags, int *_rem);
121311999Sjhbbool	sysdecode_umtx_cvwait_flags(FILE *_fp, u_long _flags, u_long *_rem);
122311999Sjhbconst char *sysdecode_umtx_op(int _op);
123311999Sjhbbool	sysdecode_umtx_rwlock_flags(FILE *_fp, u_long _flags, u_long *_rem);
124292236Sjhbint	sysdecode_utrace(FILE *_fp, void *_buf, size_t _len);
125311999Sjhbbool	sysdecode_vmprot(FILE *_fp, int _type, int *_rem);
126311999Sjhbconst char *sysdecode_vmresult(int _result);
127311999Sjhbbool	sysdecode_wait4_options(FILE *_fp, int _options, int *_rem);
128311999Sjhbbool	sysdecode_wait6_options(FILE *_fp, int _options, int *_rem);
129311999Sjhbconst char *sysdecode_whence(int _whence);
130292236Sjhb
131292236Sjhb#endif /* !__SYSDECODE_H__ */
132