blob: b7dce2e83b54df58eeecd86b1386df2b1b1c5398 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
extern void* __ipc();
#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
#endif
void* shmat(int shmid,const void* shmaddr,int shmflg) {
void* raddr;
register void* result;
result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr);
if ((unsigned long)result <= -(unsigned long)PAGE_SIZE)
result=raddr;
return result;
}
|