2 #define _MINIX_SYSTEM 1
11 #include <sys/types.h>
18 static int get_ipc_endpt(endpoint_t
*pt
)
20 return minix_rs_lookup("ipc", pt
);
23 /* Attach shared memory segment. */
24 void *shmat(int shmid
, const void *shmaddr
, int shmflg
)
30 if (get_ipc_endpt(&ipc_pt
) != OK
) {
35 memset(&m
, 0, sizeof(m
));
36 m
.m_lc_ipc_shmat
.id
= shmid
;
37 m
.m_lc_ipc_shmat
.addr
= shmaddr
;
38 m
.m_lc_ipc_shmat
.flag
= shmflg
;
40 r
= _syscall(ipc_pt
, IPC_SHMAT
, &m
);
43 return m
.m_lc_ipc_shmat
.retaddr
;
46 /* Deattach shared memory segment. */
47 int shmdt(const void *shmaddr
)
52 if (get_ipc_endpt(&ipc_pt
) != OK
) {
57 memset(&m
, 0, sizeof(m
));
58 m
.m_lc_ipc_shmdt
.addr
= shmaddr
;
60 return _syscall(ipc_pt
, IPC_SHMDT
, &m
);