Message type for PM_WAITPID
Change-Id: Ic2637a30418b9c780504f21a93ee80cef09ee1f2
This commit is contained in:
parent
de7aa3340b
commit
ee2f1ee4cd
@ -64,11 +64,6 @@
|
|||||||
/* Field names for the exit(2) call. */
|
/* Field names for the exit(2) call. */
|
||||||
#define PM_EXIT_STATUS m1_i1 /* int */
|
#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.
|
/* Field names for the gettimeofday(2), clock_*(2), adjtime(2), stime(2) calls.
|
||||||
*/
|
*/
|
||||||
#define PM_TIME_CLK_ID m2_i1 /* clockid_t */
|
#define PM_TIME_CLK_ID m2_i1 /* clockid_t */
|
||||||
|
@ -145,6 +145,21 @@ typedef struct {
|
|||||||
} mess_sigcalls;
|
} mess_sigcalls;
|
||||||
_ASSERT_MSG_SIZE(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 {
|
typedef struct {
|
||||||
vir_bytes name;
|
vir_bytes name;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -887,6 +902,8 @@ typedef struct {
|
|||||||
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
|
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
|
||||||
mess_fs_vfs_readwrite m_fs_vfs_readwrite;
|
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_chown m_lc_vfs_chown;
|
||||||
mess_lc_vfs_close m_lc_vfs_close;
|
mess_lc_vfs_close m_lc_vfs_close;
|
||||||
mess_lc_vfs_creat m_lc_vfs_creat;
|
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_copyfd m_lsys_vfs_copyfd;
|
||||||
mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver;
|
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_getepinfo m_pm_lsys_getepinfo;
|
||||||
mess_pm_lsys_getprocnr m_pm_lsys_getprocnr;
|
mess_pm_lsys_getprocnr m_pm_lsys_getprocnr;
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ pid_t wait(int * status)
|
|||||||
message m;
|
message m;
|
||||||
|
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.PM_WAITPID_PID = -1;
|
m.m_lc_pm_waitpid.pid = -1;
|
||||||
m.PM_WAITPID_OPTIONS = 0;
|
m.m_lc_pm_waitpid.options = 0;
|
||||||
if (_syscall(PM_PROC_NR, PM_WAITPID, &m) < 0) return(-1);
|
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);
|
return(m.m_type);
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@ pid_t waitpid(pid_t pid, int *status, int options)
|
|||||||
message m;
|
message m;
|
||||||
|
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.PM_WAITPID_PID = pid;
|
m.m_lc_pm_waitpid.pid = pid;
|
||||||
m.PM_WAITPID_OPTIONS = options;
|
m.m_lc_pm_waitpid.options = options;
|
||||||
if (_syscall(PM_PROC_NR, PM_WAITPID, &m) < 0) return(-1);
|
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;
|
return m.m_type;
|
||||||
}
|
}
|
||||||
|
@ -463,8 +463,8 @@ int do_waitpid()
|
|||||||
int i, pidarg, options, children;
|
int i, pidarg, options, children;
|
||||||
|
|
||||||
/* Set internal variables. */
|
/* Set internal variables. */
|
||||||
pidarg = m_in.PM_WAITPID_PID; /* 1st param */
|
pidarg = m_in.m_lc_pm_waitpid.pid; /* 1st param */
|
||||||
options = m_in.PM_WAITPID_OPTIONS; /* 3rd param */
|
options = m_in.m_lc_pm_waitpid.options; /* 3rd param */
|
||||||
if (pidarg == 0) pidarg = -mp->mp_procgrp; /* pidarg < 0 ==> proc grp */
|
if (pidarg == 0) pidarg = -mp->mp_procgrp; /* pidarg < 0 ==> proc grp */
|
||||||
|
|
||||||
/* Is there a child waiting to be collected? At this point, pidarg != 0:
|
/* 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)) {
|
if (sigismember(&rp->mp_sigtrace, i)) {
|
||||||
sigdelset(&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);
|
return(rp->mp_pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -647,7 +647,7 @@ register struct mproc *child; /* tells which process is exiting */
|
|||||||
parent = &mproc[mp_parent];
|
parent = &mproc[mp_parent];
|
||||||
|
|
||||||
/* Wake up the parent by sending the reply message. */
|
/* 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);
|
W_EXITCODE(child->mp_exitstatus, child->mp_sigstatus);
|
||||||
reply(child->mp_parent, child->mp_pid);
|
reply(child->mp_parent, child->mp_pid);
|
||||||
parent->mp_flags &= ~WAITING; /* parent no longer waiting */
|
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");
|
panic("tell_tracer: child not a zombie");
|
||||||
tracer = &mproc[mp_tracer];
|
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));
|
W_EXITCODE(child->mp_exitstatus, (child->mp_sigstatus & 0377));
|
||||||
reply(child->mp_tracer, child->mp_pid);
|
reply(child->mp_tracer, child->mp_pid);
|
||||||
tracer->mp_flags &= ~WAITING; /* tracer no longer waiting */
|
tracer->mp_flags &= ~WAITING; /* tracer no longer waiting */
|
||||||
|
@ -268,7 +268,7 @@ int signo;
|
|||||||
sigdelset(&rmp->mp_sigtrace, signo);
|
sigdelset(&rmp->mp_sigtrace, signo);
|
||||||
|
|
||||||
rpmp->mp_flags &= ~WAITING; /* parent is no longer waiting */
|
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);
|
reply(rmp->mp_tracer, rmp->mp_pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user