Commit fde775bc authored by Dmitry Chagin's avatar Dmitry Chagin
Browse files

libsysdecode: Decode Linux open() flags

MFC after:		2 weeks
parent d2b3237e
......@@ -205,3 +205,38 @@ sysdecode_linux_atflags(FILE *fp, int flag, int *rem)
return (print_mask_int(fp, atflags, flag, rem));
}
bool
sysdecode_linux_open_flags(FILE *fp, int flags, int *rem)
{
bool printed;
int mode;
uintmax_t val;
mode = flags & LINUX_O_ACCMODE;
flags &= ~LINUX_O_ACCMODE;
switch (mode) {
case LINUX_O_RDONLY:
fputs("O_RDONLY", fp);
printed = true;
mode = 0;
break;
case LINUX_O_WRONLY:
fputs("O_WRONLY", fp);
printed = true;
mode = 0;
break;
case LINUX_O_RDWR:
fputs("O_RDWR", fp);
printed = true;
mode = 0;
break;
default:
printed = false;
}
val = (unsigned)flags;
print_mask_part(fp, openflags, &val, &printed);
if (rem != NULL)
*rem = val | mode;
return (printed);
}
......@@ -92,6 +92,7 @@ gen_table "atflags" "LINUX_AT_[A-Z_]+[[:space:]]+[0-9]+" "compat
gen_table "clockids" "LINUX_CLOCK_[A-Z_]+[[:space:]]+[0-9]+" "compat/linux/linux_timer.h"
gen_table "clockflags" "LINUX_TIMER_[A-Z_]+[[:space:]]+0x[0-9]+" "compat/linux/linux_timer.h"
gen_table "clockcpuids" "LINUX_CPUCLOCK_[A-Z_]+[[:space:]]+[0-9]+" "compat/linux/linux_timer.h" "_MASK|_MAX"
gen_table "openflags" "LINUX_O_[A-Z_]+[[:space:]]+[0-9]+" "compat/linux/linux_file.h" "O_RDONLY|O_RDWR|O_WRONLY|O_ACCMODE"
gen_table "sigprocmaskhow" "LINUX_SIG_[A-Z]+[[:space:]]+[0-9]+" "compat/linux/linux.h"
# Generate a .depend file for our output file
......
......@@ -142,6 +142,7 @@ bool sysdecode_shmflags(FILE *_fp, int _flags, int *_rem);
bool sysdecode_linux_atflags(FILE *_fp, int _flag, int *_rem);
void sysdecode_linux_clockid(FILE *_fp, clockid_t _which);
bool sysdecode_linux_clock_flags(FILE *_fp, int _flags, int *_rem);
bool sysdecode_linux_open_flags(FILE *_fp, int _flags, int *_rem);
const char *sysdecode_linux_signal(int _sig);
const char *sysdecode_linux_sigprocmask_how(int _how);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment