-#define NCALLS 113 /* number of system calls allowed */
+#define NCALLS 114 /* number of system calls allowed */
#define EXIT 1
#define FORK 2
#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.
*/
#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 *
*===========================================================================*/
.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 \
--- /dev/null
+#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));
+}
*===========================================================================*/
PUBLIC int do_get()
{
-/* Handle GETUID, GETGID, GETPID, GETPGRP.
+/* Handle GETUID, GETGID, GETPID, GETPGRP, GETSID.
*/
register struct mproc *rmp = mp;
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;
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];
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];