summaryrefslogtreecommitdiff
path: root/src/ipc/shmat.c
blob: ff65b6a49c4a47129669e3f91bfeb67a0fd52de1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <sys/shm.h>
#include "syscall.h"
#include "ipc.h"

#ifdef __NR_shmat
void *shmat(int id, const void *addr, int flag)
{
	return syscall3(__NR_shmat, id, (long)addr, flag);
}
#else
void *shmat(int id, const void *addr, int flag)
{
	unsigned long ret;
	ret = syscall5(__NR_ipc, IPCOP_shmat, id, flag, (long)&addr, (long)addr);
	return (ret > -(unsigned long)SHMLBA) ? (void *)ret : (void *)addr;
}
#endif