From ee2f1ee4cd97c2f851611c8284bcb2ec19493b86 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Mon, 12 May 2014 20:53:02 +0200 Subject: [PATCH] Message type for PM_WAITPID Change-Id: Ic2637a30418b9c780504f21a93ee80cef09ee1f2 --- include/minix/callnr.h | 5 ----- include/minix/ipc.h | 19 +++++++++++++++++++ lib/libc/gen/minix/wait.c | 6 +++--- lib/libc/gen/minix/waitpid.c | 6 +++--- servers/pm/forkexit.c | 10 +++++----- servers/pm/trace.c | 2 +- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 0d8562ae6..4e5f0ed3a 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -64,11 +64,6 @@ /* Field names for the exit(2) call. */ #define PM_EXIT_STATUS m1_i1 /* int */ -/* Field names for the waitpid(2) call. */ -#define PM_WAITPID_PID m1_i1 /* pid_t */ -#define PM_WAITPID_OPTIONS m1_i2 /* int */ -#define PM_WAITPID_STATUS m2_i1 /* int */ - /* Field names for the gettimeofday(2), clock_*(2), adjtime(2), stime(2) calls. */ #define PM_TIME_CLK_ID m2_i1 /* clockid_t */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 4a34baf17..0239e2f99 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -145,6 +145,21 @@ typedef struct { } mess_sigcalls; _ASSERT_MSG_SIZE(mess_sigcalls); +typedef struct { + pid_t pid; + int options; + + uint8_t padding[48]; +} mess_lc_pm_waitpid; +_ASSERT_MSG_SIZE(mess_lc_pm_waitpid); + +typedef struct { + int status; + + uint8_t padding[52]; +} mess_pm_lc_waitpid; +_ASSERT_MSG_SIZE(mess_pm_lc_waitpid); + typedef struct { vir_bytes name; size_t len; @@ -887,6 +902,8 @@ typedef struct { mess_fs_vfs_readsuper m_fs_vfs_readsuper; mess_fs_vfs_readwrite m_fs_vfs_readwrite; + mess_lc_pm_waitpid m_lc_pm_waitpid; + mess_lc_vfs_chown m_lc_vfs_chown; mess_lc_vfs_close m_lc_vfs_close; mess_lc_vfs_creat m_lc_vfs_creat; @@ -919,6 +936,8 @@ typedef struct { mess_lsys_vfs_copyfd m_lsys_vfs_copyfd; mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver; + mess_pm_lc_waitpid m_pm_lc_waitpid; + mess_pm_lsys_getepinfo m_pm_lsys_getepinfo; mess_pm_lsys_getprocnr m_pm_lsys_getprocnr; diff --git a/lib/libc/gen/minix/wait.c b/lib/libc/gen/minix/wait.c index 3217c7d79..f0755f2f5 100644 --- a/lib/libc/gen/minix/wait.c +++ b/lib/libc/gen/minix/wait.c @@ -14,9 +14,9 @@ pid_t wait(int * status) message m; memset(&m, 0, sizeof(m)); - m.PM_WAITPID_PID = -1; - m.PM_WAITPID_OPTIONS = 0; + m.m_lc_pm_waitpid.pid = -1; + m.m_lc_pm_waitpid.options = 0; if (_syscall(PM_PROC_NR, PM_WAITPID, &m) < 0) return(-1); - if (status != 0) *status = m.PM_WAITPID_STATUS; + if (status != 0) *status = m.m_pm_lc_waitpid.status; return(m.m_type); } diff --git a/lib/libc/gen/minix/waitpid.c b/lib/libc/gen/minix/waitpid.c index 20500477f..89151fcf2 100644 --- a/lib/libc/gen/minix/waitpid.c +++ b/lib/libc/gen/minix/waitpid.c @@ -14,9 +14,9 @@ pid_t waitpid(pid_t pid, int *status, int options) message m; memset(&m, 0, sizeof(m)); - m.PM_WAITPID_PID = pid; - m.PM_WAITPID_OPTIONS = options; + m.m_lc_pm_waitpid.pid = pid; + m.m_lc_pm_waitpid.options = options; if (_syscall(PM_PROC_NR, PM_WAITPID, &m) < 0) return(-1); - if (status != 0) *status = m.PM_WAITPID_STATUS; + if (status != 0) *status = m.m_pm_lc_waitpid.status; return m.m_type; } diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 9f5f0e743..93f6dd032 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -463,8 +463,8 @@ int do_waitpid() int i, pidarg, options, children; /* Set internal variables. */ - pidarg = m_in.PM_WAITPID_PID; /* 1st param */ - options = m_in.PM_WAITPID_OPTIONS; /* 3rd param */ + pidarg = m_in.m_lc_pm_waitpid.pid; /* 1st param */ + options = m_in.m_lc_pm_waitpid.options; /* 3rd param */ if (pidarg == 0) pidarg = -mp->mp_procgrp; /* pidarg < 0 ==> proc grp */ /* Is there a child waiting to be collected? At this point, pidarg != 0: @@ -499,7 +499,7 @@ int do_waitpid() if (sigismember(&rp->mp_sigtrace, i)) { sigdelset(&rp->mp_sigtrace, i); - mp->mp_reply.PM_WAITPID_STATUS = W_STOPCODE(i); + mp->mp_reply.m_pm_lc_waitpid.status = W_STOPCODE(i); return(rp->mp_pid); } } @@ -647,7 +647,7 @@ register struct mproc *child; /* tells which process is exiting */ parent = &mproc[mp_parent]; /* Wake up the parent by sending the reply message. */ - parent->mp_reply.PM_WAITPID_STATUS = + parent->mp_reply.m_pm_lc_waitpid.status = W_EXITCODE(child->mp_exitstatus, child->mp_sigstatus); reply(child->mp_parent, child->mp_pid); parent->mp_flags &= ~WAITING; /* parent no longer waiting */ @@ -671,7 +671,7 @@ struct mproc *child; /* tells which process is exiting */ panic("tell_tracer: child not a zombie"); tracer = &mproc[mp_tracer]; - tracer->mp_reply.PM_WAITPID_STATUS = + tracer->mp_reply.m_pm_lc_waitpid.status = W_EXITCODE(child->mp_exitstatus, (child->mp_sigstatus & 0377)); reply(child->mp_tracer, child->mp_pid); tracer->mp_flags &= ~WAITING; /* tracer no longer waiting */ diff --git a/servers/pm/trace.c b/servers/pm/trace.c index 33c578440..850b16acb 100644 --- a/servers/pm/trace.c +++ b/servers/pm/trace.c @@ -268,7 +268,7 @@ int signo; sigdelset(&rmp->mp_sigtrace, signo); rpmp->mp_flags &= ~WAITING; /* parent is no longer waiting */ - rpmp->mp_reply.PM_WAITPID_STATUS = W_STOPCODE(signo); + rpmp->mp_reply.m_pm_lc_waitpid.status = W_STOPCODE(signo); reply(rmp->mp_tracer, rmp->mp_pid); } } -- 2.44.0