11 #include <sys/types.h>
18 __weak_alias(shmat
, _shmat
)
19 __weak_alias(shmdt
, _shmdt
)
23 static int get_ipc_endpt(endpoint_t
*pt
)
25 return minix_rs_lookup("ipc", pt
);
28 /* Attach shared memory segment. */
29 void *shmat(int shmid
, const void *shmaddr
, int shmflg
)
35 if (get_ipc_endpt(&ipc_pt
) != OK
) {
41 m
.SHMAT_ADDR
= (long) shmaddr
;
42 m
.SHMAT_FLAG
= shmflg
;
44 r
= _syscall(ipc_pt
, IPC_SHMAT
, &m
);
47 return (void *) m
.SHMAT_RETADDR
;
50 /* Deattach shared memory segment. */
51 int shmdt(const void *shmaddr
)
56 if (get_ipc_endpt(&ipc_pt
) != OK
) {
61 m
.SHMDT_ADDR
= (long) shmaddr
;
63 return _syscall(ipc_pt
, IPC_SHMDT
, &m
);