global cleanup to use the new syscall interface
[musl] / src / ipc / shmat.c
1 #include <sys/shm.h>
2 #include "syscall.h"
3 #include "ipc.h"
4
5 #ifdef __NR_shmat
6 void *shmat(int id, const void *addr, int flag)
7 {
8         return (void *)syscall(SYS_shmat, id, addr, flag);
9 }
10 #else
11 void *shmat(int id, const void *addr, int flag)
12 {
13         unsigned long ret;
14         ret = syscall(SYS_ipc, IPCOP_shmat, id, flag, &addr, addr);
15         return (ret > -(unsigned long)SHMLBA) ? (void *)ret : (void *)addr;
16 }
17 #endif