libsysdecode: add a decoder for pollfd events

We'll use this in another change to read pollfd arrays coming from a
successful poll(2) operation.

Reviewed by:	bapt, jhb
Differential Revision:	https://reviews.freebsd.org/D44159
This commit is contained in:
Kyle Evans 2024-03-04 22:14:06 -06:00
parent b5d2165b90
commit bd23e71f91
5 changed files with 22 additions and 1 deletions

View file

@ -93,6 +93,7 @@ MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \
sysdecode_mask.3 sysdecode_msync_flags.3 \
sysdecode_mask.3 sysdecode_open_flags.3 \
sysdecode_mask.3 sysdecode_pipe2_flags.3 \
sysdecode_mask.3 sysdecode_pollfd_events.3 \
sysdecode_mask.3 sysdecode_reboot_howto.3 \
sysdecode_mask.3 sysdecode_rfork_flags.3 \
sysdecode_mask.3 sysdecode_semget_flags.3 \

View file

@ -34,6 +34,7 @@
#include <sys/linker.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/poll.h>
#include <sys/procctl.h>
#include <sys/ptrace.h>
#include <sys/reboot.h>
@ -565,6 +566,13 @@ sysdecode_pipe2_flags(FILE *fp, int flags, int *rem)
return (print_mask_0(fp, pipe2flags, flags, rem));
}
bool
sysdecode_pollfd_events(FILE *fp, int flags, int *rem)
{
return (print_mask_int(fp, pollfdevents, flags, rem));
}
const char *
sysdecode_prio_which(int which)
{

View file

@ -114,6 +114,7 @@ gen_table "mountflags" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/
gen_table "msyncflags" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
gen_table "nfssvcflags" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h"
gen_table "pathconfname" "_PC_[A-Z4_]+[[:space:]]+[0-9]+" "sys/unistd.h"
gen_table "pollfdevents" "POLL[A-Z]+[[:space:]]+" "sys/poll.h"
gen_table "prio" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h"
gen_table "procctlcmd" "PROC_[A-Z_]+[[:space:]]+[0-9]" "sys/procctl.h" "PROC_TRACE_CTL_"
gen_table "ptraceop" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h"

View file

@ -83,6 +83,7 @@ const char *sysdecode_nfssvc_flags(int _flags);
bool sysdecode_open_flags(FILE *_fp, int _flags, int *_rem);
const char *sysdecode_pathconf_name(int _name);
bool sysdecode_pipe2_flags(FILE *_fp, int _flags, int *_rem);
bool sysdecode_pollfd_events(FILE *fp, int flags, int *rem);
const char *sysdecode_prio_which(int _which);
const char *sysdecode_procctl_cmd(int _cmd);
const char *sysdecode_ptrace_request(int _request);

View file

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd March 3, 2022
.Dd February 29, 2024
.Dt sysdecode_mask 3
.Os
.Sh NAME
@ -43,6 +43,7 @@
.Nm sysdecode_msync_flags ,
.Nm sysdecode_open_flags ,
.Nm sysdecode_pipe2_flags ,
.Nm sysdecode_pollfd_events ,
.Nm sysdecode_reboot_howto ,
.Nm sysdecode_rfork_flags ,
.Nm sysdecode_semget_flags ,
@ -96,6 +97,8 @@
.Ft bool
.Fn sysdecode_pipe2_flags "FILE *fp" "int flags" "int *rem"
.Ft bool
.Fn sysdecode_pollfd_events "FILE *fp" "int flags" "int *rem"
.Ft bool
.Fn sysdecode_reboot_howto "FILE *fp" "int howto" "int *rem"
.Ft bool
.Fn sysdecode_rfork_flags "FILE *fp" "int flags" "int *rem"
@ -191,6 +194,13 @@ and
.Dv F_SETFL
.Xr fcntl 2
commands.
.It Fn sysdecode_pollfd_events
The
.Fa events
and
.Fa revents
members of a
.Vt struct pollfd .
.It Fn sysdecode_sctp_nxt_flags
The
.Fa nxt_flags