getsid() implementation
This commit is contained in:
parent
c0bb1ba1b1
commit
c4ea2a195c
7 changed files with 34 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
#define NCALLS 113 /* number of system calls allowed */
|
||||
#define NCALLS 114 /* number of system calls allowed */
|
||||
|
||||
#define EXIT 1
|
||||
#define FORK 2
|
||||
|
@ -120,6 +120,8 @@
|
|||
#define FSTAT 66
|
||||
#define LSTAT 67
|
||||
|
||||
#define PM_GETSID 113 /* PM getsid() */
|
||||
|
||||
#define TASK_REPLY 121 /* to VFS: reply code from drivers, not
|
||||
* really a standalone call.
|
||||
*/
|
||||
|
|
|
@ -260,6 +260,9 @@
|
|||
#define STATVFS_LEN m1_i1
|
||||
#define STATVFS_NAME m1_p1
|
||||
#define STATVFS_BUF m1_p2
|
||||
|
||||
#define PM_GETSID_PID m1_i1
|
||||
|
||||
/*===========================================================================*
|
||||
* Messages for networking layer *
|
||||
*===========================================================================*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.PATH: ${.CURDIR}/sys-minix
|
||||
|
||||
SRCS+= accept.c access.c bind.c brk.c sbrk.c m_closefrom.c compat.S \
|
||||
SRCS+= accept.c access.c bind.c brk.c sbrk.c m_closefrom.c getsid.c compat.S \
|
||||
chdir.c chmod.c fchmod.c chown.c fchown.c chroot.c close.c \
|
||||
connect.c dup.c dup2.c execve.c fcntl.c flock.c fpathconf.c fork.c \
|
||||
fstatfs.c fstatvfs.c fsync.c ftruncate.c getdents.c getegid.c getgid.c \
|
||||
|
|
14
lib/nbsd_libc/sys-minix/getsid.c
Normal file
14
lib/nbsd_libc/sys-minix/getsid.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <sys/cdefs.h>
|
||||
#include <lib.h>
|
||||
#include "namespace.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
pid_t getsid(pid_t p)
|
||||
{
|
||||
message m;
|
||||
|
||||
memset(&m, 0, sizeof(m));
|
||||
m.PM_GETSID_PID = p;
|
||||
return(_syscall(PM_PROC_NR, PM_GETSID, &m));
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
*===========================================================================*/
|
||||
PUBLIC int do_get()
|
||||
{
|
||||
/* Handle GETUID, GETGID, GETPID, GETPGRP.
|
||||
/* Handle GETUID, GETGID, GETPID, GETPGRP, GETSID.
|
||||
*/
|
||||
|
||||
register struct mproc *rmp = mp;
|
||||
|
@ -68,6 +68,16 @@ PUBLIC int do_get()
|
|||
r = rmp->mp_procgrp;
|
||||
break;
|
||||
|
||||
case PM_GETSID:
|
||||
{
|
||||
struct mproc *target;
|
||||
pid_t p = m_in.PM_GETSID_PID;
|
||||
target = p ? find_proc(p) : &mproc[who_p];
|
||||
r = ESRCH;
|
||||
if(target)
|
||||
r = target->mp_procgrp;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
r = EINVAL;
|
||||
break;
|
||||
|
|
|
@ -125,6 +125,7 @@ _PROTOTYPE (int (*call_vec[]), (void) ) = {
|
|||
do_getdma, /* 110 = getdma */
|
||||
do_srv_kill, /* 111 = srv_kill */
|
||||
no_sys, /* 112 = gcov_flush */
|
||||
do_get, /* 113 = getsid */
|
||||
};
|
||||
/* This should not fail with "array size is negative": */
|
||||
extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1];
|
||||
|
|
|
@ -129,6 +129,7 @@ PUBLIC _PROTOTYPE (int (*call_vec[]), (void) ) = {
|
|||
no_sys, /* 110 = (getdma) */
|
||||
no_sys, /* 111 = (srv_kill) */
|
||||
do_gcov_flush, /* 112 = gcov_flush */
|
||||
no_sys, /* 113 = (getsid) */
|
||||
};
|
||||
/* This should not fail with "array size is negative": */
|
||||
extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1];
|
||||
|
|
Loading…
Reference in a new issue