diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-22 23:27:56 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-22 23:30:32 +0100 |
| commit | 0f30d227497418c6d3bef7d52244407e30454504 (patch) | |
| tree | 0e1ac19623d3268380cf74328cdf643648a2f43c /lib/libc/sys/mqueue/mq_open.c | |
| parent | 90dad97fc07f049383903a166631e2c257f9b8c1 (diff) | |
Added c11 threads, fixed some locks and add *_unlocked functions
Diffstat (limited to 'lib/libc/sys/mqueue/mq_open.c')
| -rw-r--r-- | lib/libc/sys/mqueue/mq_open.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/libc/sys/mqueue/mq_open.c b/lib/libc/sys/mqueue/mq_open.c new file mode 100644 index 00000000..15ae9e18 --- /dev/null +++ b/lib/libc/sys/mqueue/mq_open.c @@ -0,0 +1,26 @@ +#include <fcntl.h> +#include <mqueue.h> +#include <stdarg.h> +#include <syscall.h> + +mqd_t mq_open(const char *name, int oflag, ...) +{ + mode_t mode; + struct mq_attr *attr; + + if (*name == '/') + name++; + + if (oflag & O_CREAT) { + va_list ap; + va_start(ap, oflag); + mode = va_arg(ap, mode_t); + attr = va_arg(ap, struct mq_attr *); + va_end(ap); + } else { + mode = 0; + attr = 0; + } + + return syscall(mq_open, name, oflag, mode, attr); +} |
