From 8b4a2d50de67b746bcc472bd46c55d83eff668fc Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 18 Aug 2024 23:06:26 +0200 Subject: kernel: basic _sys_setxattr implementation --- src/cmd/setxattr.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/cmd/setxattr.c (limited to 'src/cmd/setxattr.c') diff --git a/src/cmd/setxattr.c b/src/cmd/setxattr.c new file mode 100644 index 0000000..c2e422e --- /dev/null +++ b/src/cmd/setxattr.c @@ -0,0 +1,23 @@ +#include +#include +#include +#include +#include +#include + +int +main(int argc, char **argv) +{ + if (argc != 4) { + fprintf(stderr, "usage: setxattr file key value\n"); + return 1; + } + hid_t h = camellia_open(argv[1], OPEN_WRITE); + if (h < 0) err(1, "open"); + + ssize_t ret = _sys_setxattr(h, argv[2], argv[3], strlen(argv[3]), 0); + if (ret < 0) { + errno = -ret; + err(1, "setxattr"); + } +} -- cgit v1.2.3