diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2023-06-07 23:02:23 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-06-07 23:06:32 +0200 |
commit | c38fccbc867019d6c063be1c1d8137edfe52f8de (patch) | |
tree | b3c1b398b4eb40e862263ee084b1dbb7463c1ada /cooker/calls | |
parent | 1c1a9da7a4f9c4c1990192e14763ebf423d812a9 (diff) | |
download | seitan-c38fccbc867019d6c063be1c1d8137edfe52f8de.tar seitan-c38fccbc867019d6c063be1c1d8137edfe52f8de.tar.gz seitan-c38fccbc867019d6c063be1c1d8137edfe52f8de.tar.bz2 seitan-c38fccbc867019d6c063be1c1d8137edfe52f8de.tar.lz seitan-c38fccbc867019d6c063be1c1d8137edfe52f8de.tar.xz seitan-c38fccbc867019d6c063be1c1d8137edfe52f8de.tar.zst seitan-c38fccbc867019d6c063be1c1d8137edfe52f8de.zip |
mknod/mknodat values, initial support for MASK flag, OP_BITWISE
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'cooker/calls')
-rw-r--r-- | cooker/calls/fs.c | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/cooker/calls/fs.c b/cooker/calls/fs.c index cfc0091..469dd88 100644 --- a/cooker/calls/fs.c +++ b/cooker/calls/fs.c @@ -58,13 +58,44 @@ swapoff #include <asm-generic/unistd.h> #include <sys/syscall.h> -#include <fcntl.h> +#define _GNU_SOURCE #include <sys/stat.h> +#include <fcntl.h> #include <linux/limits.h> #include "../cooker.h" #include "../calls.h" +static struct num modes[] = { + { "S_ISUID", S_ISUID }, + { "S_ISGID", S_ISGID }, + { "S_IRWXU", S_IRWXU }, + { "S_IRUSR", S_IRUSR }, + { "S_IWUSR", S_IWUSR }, + { "S_IXUSR", S_IXUSR }, + { "S_IRWXG", S_IRWXG }, + { "S_IRGRP", S_IRGRP }, + { "S_IWGRP", S_IWGRP }, + { "S_IXGRP", S_IXGRP }, + { "S_IRWXO", S_IRWXO }, + { "S_IROTH", S_IROTH }, + { "S_IWOTH", S_IWOTH }, + { "S_IXOTH", S_IXOTH }, + { "S_ISVTX", S_ISVTX }, + { 0 }, +}; + +static struct num types[] = { + { "S_IFSOCK", S_IFSOCK }, + { "S_IFLNK", S_IFLNK }, + { "S_IFREG", S_IFREG }, + { "S_IFBLK", S_IFBLK }, + { "S_IFDIR", S_IFDIR }, + { "S_IFCHR", S_IFCHR }, + { "S_IFIFO", S_IFIFO }, + { 0 }, +}; + static struct arg mknod_args[] = { { 0, { @@ -75,9 +106,16 @@ static struct arg mknod_args[] = { }, { 1, { - "mode", U32 /* TODO */, 0, + "mode", INT, FLAGS | MASK, 0, 0, - { 0 /* TODO */ }, + { .d_num = modes }, + } + }, + { 1, + { + "type", INT, FLAGS | MASK, + 0, 0, + { .d_num = types }, } }, { 2, @@ -98,13 +136,7 @@ static struct arg mknod_args[] = { }; static struct arg mknodat_args[] = { - { 0, - { - "dirfd", UNDEF, 0, - 0, 1 /* TODO: PATH_MAX */, - { 0 } - } - }, + /* No dirfd: we only support absolute paths at the moment */ { 1, { "path", STRING, 0, @@ -114,9 +146,16 @@ static struct arg mknodat_args[] = { }, { 2, { - "mode", UNDEF /* TODO */, FLAGS, + "mode", INT, FLAGS | MASK, + 0, 0, + { .d_num = modes }, + } + }, + { 2, + { + "type", INT, FLAGS | MASK, 0, 0, - { 0 /* TODO */ }, + { .d_num = types }, } }, { 3, |