summaryrefslogtreecommitdiff
path: root/src/mq/mq_unlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mq/mq_unlink.c')
-rw-r--r--src/mq/mq_unlink.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mq/mq_unlink.c b/src/mq/mq_unlink.c
new file mode 100644
index 00000000..1bb92af1
--- /dev/null
+++ b/src/mq/mq_unlink.c
@@ -0,0 +1,19 @@
+#include <mqueue.h>
+#include <errno.h>
+#include "syscall.h"
+
+int mq_unlink(const char *name)
+{
+ int ret;
+ if (*name++ != '/') {
+ errno = EINVAL;
+ return -1;
+ }
+ ret = __syscall(SYS_mq_unlink, name);
+ if (ret < 0) {
+ if (ret == -EPERM) ret = -EACCES;
+ errno = -ret;
+ return -1;
+ }
+ return ret;
+}