summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/ipc/shmat.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/ipc/shmat.c')
-rw-r--r--libc-top-half/musl/src/ipc/shmat.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/ipc/shmat.c b/libc-top-half/musl/src/ipc/shmat.c
new file mode 100644
index 0000000..8c7407d
--- /dev/null
+++ b/libc-top-half/musl/src/ipc/shmat.c
@@ -0,0 +1,17 @@
+#include <sys/shm.h>
+#include "syscall.h"
+#include "ipc.h"
+
+#ifndef SYS_ipc
+void *shmat(int id, const void *addr, int flag)
+{
+ return (void *)syscall(SYS_shmat, id, addr, flag);
+}
+#else
+void *shmat(int id, const void *addr, int flag)
+{
+ unsigned long ret;
+ ret = syscall(SYS_ipc, IPCOP_shmat, id, flag, &addr, addr);
+ return (ret > -(unsigned long)SHMLBA) ? (void *)ret : (void *)addr;
+}
+#endif