repo.or.cz
/
minix.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
libutil: add O_NOCTTY back to old pty open code
[minix.git]
/
lib
/
libminlib
/
getnucred.c
blob
cbddc7bb9eeb4da560a2e1ef60f95d7aa935d87c
1
#include <lib.h>
2
#include <errno.h>
3
#include <sys/ucred.h>
4
#include <unistd.h>
5
6
int
getnucred
(
endpoint_t proc_ep
,
struct
ucred
*
ucred
)
7
{
8
message m
;
9
pid_t pid
;
10
11
if
(
ucred
==
NULL
) {
12
errno
=
EFAULT
;
13
return
-
1
;
14
}
15
16
m
.
m1_i1
=
proc_ep
;
/* search for this process */
17
18
pid
=
_syscall
(
PM_PROC_NR
,
GETEPINFO
, &
m
);
19
if
(
pid
<
0
) {
20
return
-
1
;
21
}
22
23
ucred
->
pid
=
pid
;
24
ucred
->
uid
=
m
.
PM_NUID
;
25
ucred
->
gid
=
m
.
PM_NGID
;
26
27
return
0
;
28
}