libutil: add O_NOCTTY back to old pty open code
[minix.git] / lib / libminlib / getnucred.c
blobcbddc7bb9eeb4da560a2e1ef60f95d7aa935d87c
1 #include <lib.h>
2 #include <errno.h>
3 #include <sys/ucred.h>
4 #include <unistd.h>
6 int getnucred(endpoint_t proc_ep, struct ucred *ucred)
8 message m;
9 pid_t pid;
11 if (ucred == NULL) {
12 errno = EFAULT;
13 return -1;
16 m.m1_i1 = proc_ep; /* search for this process */
18 pid = _syscall(PM_PROC_NR, GETEPINFO, &m);
19 if (pid < 0) {
20 return -1;
23 ucred->pid = pid;
24 ucred->uid = m.PM_NUID;
25 ucred->gid = m.PM_NGID;
27 return 0;