3 int check_perm(struct ipc_perm
*req
, endpoint_t who
, int mode
)
7 uid_t uid
= getnuid(who
);
8 gid_t gid
= getngid(who
);
16 if (uid
== req
->uid
|| uid
== req
->cuid
) {
18 req_mode
= (req
->mode
>> 6) & 0x7;
19 cur_mode
= (mode
>> 6) & 0x7;
20 } else if (gid
== req
->gid
|| gid
== req
->cgid
) {
22 req_mode
= (req
->mode
>> 3) & 0x7;
23 cur_mode
= (mode
>> 3) & 0x7;
26 req_mode
= req
->mode
& 0x7;
27 cur_mode
= mode
& 0x7;
30 if (cur_mode
&& ((cur_mode
& req_mode
) == cur_mode
))