From: David van Moolenbroek Date: Sat, 26 Oct 2013 23:24:15 +0000 (+0200) Subject: PM: remove obsolete ALARM, PAUSE, TIMES calls X-Git-Tag: v3.3.0~526 X-Git-Url: http://zhaoyanbai.com/repos/%7B%24global.css%7D?a=commitdiff_plain;h=4d4e70daaaa544ae05c0ae3834f5988def58fdb4;p=minix.git PM: remove obsolete ALARM, PAUSE, TIMES calls NetBSD libc implements these as wrappers around setitimer(2), sigsuspend(2), and getrusage(2), respectively. Change-Id: I0c5e725b3e1316bddd3a3ff7ef65d57d30afd10d --- diff --git a/commands/ps/ps.c b/commands/ps/ps.c index 0b69eb21a..f5dbde8a9 100644 --- a/commands/ps/ps.c +++ b/commands/ps/ps.c @@ -193,7 +193,6 @@ static char *prrecv(struct pstat *ps) blkstr = "?"; if (ps->ps_recv == PM_PROC_NR) { switch (ps->ps_pstate) { - case PSTATE_PAUSED: blkstr = "pause"; break; case PSTATE_WAITING: blkstr = "wait"; break; case PSTATE_SIGSUSP: blkstr = "sigsusp"; break; } diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index 1c84cded3..fd3c9a122 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -2323,7 +2323,7 @@ ./usr/man/man2/accept.2 minix-sys ./usr/man/man2/access.2 minix-sys ./usr/man/man2/adjtime.2 minix-sys -./usr/man/man2/alarm.2 minix-sys +./usr/man/man2/alarm.2 minix-sys obsolete ./usr/man/man2/bind.2 minix-sys ./usr/man/man2/brk.2 minix-sys ./usr/man/man2/chdir.2 minix-sys @@ -2369,7 +2369,7 @@ ./usr/man/man2/mknod.2 minix-sys ./usr/man/man2/mount.2 minix-sys ./usr/man/man2/open.2 minix-sys -./usr/man/man2/pause.2 minix-sys +./usr/man/man2/pause.2 minix-sys obsolete ./usr/man/man2/pipe.2 minix-sys ./usr/man/man2/pipe2.2 minix-sys ./usr/man/man2/ptrace.2 minix-sys @@ -2403,7 +2403,7 @@ ./usr/man/man2/symlink.2 minix-sys ./usr/man/man2/sync.2 minix-sys ./usr/man/man2/time.2 minix-sys -./usr/man/man2/times.2 minix-sys +./usr/man/man2/times.2 minix-sys obsolete ./usr/man/man2/truncate.2 minix-sys ./usr/man/man2/umask.2 minix-sys ./usr/man/man2/uname.2 minix-sys diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 5834324f7..f99aa3356 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -24,8 +24,6 @@ #define GETUID 24 #define STIME 25 #define PTRACE 26 -#define ALARM 27 -#define PAUSE 29 #define UTIME 30 #define GETEPINFO 31 #define SETGROUPS 32 @@ -37,7 +35,6 @@ #define MKDIR 39 #define RMDIR 40 #define PIPE 42 -#define TIMES 43 #define SYMLINK 45 #define SETGID 46 #define GETGID 47 diff --git a/include/minix/procfs.h b/include/minix/procfs.h index eb6733644..7194da7d6 100644 --- a/include/minix/procfs.h +++ b/include/minix/procfs.h @@ -25,7 +25,6 @@ /* PM sleep states. */ #define PSTATE_NONE '-' -#define PSTATE_PAUSED 'P' #define PSTATE_WAITING 'W' #define PSTATE_SIGSUSP 'S' diff --git a/lib/libc/gen/minix/times.c b/lib/libc/gen/minix/times.c deleted file mode 100644 index f424c9759..000000000 --- a/lib/libc/gen/minix/times.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include "namespace.h" - -#include -#include - -#ifdef __weak_alias -__weak_alias(times, _times) -#endif - -clock_t times(struct tms *buf) -{ - message m; - - m.m4_l5 = 0; /* return this if system is pre-1.6 */ - if (_syscall(PM_PROC_NR, TIMES, &m) < 0) return( (clock_t) -1); - buf->tms_utime = m.m4_l1; - buf->tms_stime = m.m4_l2; - buf->tms_cutime = m.m4_l3; - buf->tms_cstime = m.m4_l4; - return(m.m4_l5); -} diff --git a/lib/libc/gen/times.c b/lib/libc/gen/times.c index 55b05a18b..e1dfc3826 100644 --- a/lib/libc/gen/times.c +++ b/lib/libc/gen/times.c @@ -90,3 +90,7 @@ times(struct tms *tp) return ((clock_t)-1); return ((clock_t)(CONVTCK(t))); } + +#if defined(__minix) && defined(__weak_alias) +__weak_alias(times, _times) +#endif diff --git a/man/man2/Makefile b/man/man2/Makefile index 40c3ecf7f..ce8c400aa 100644 --- a/man/man2/Makefile +++ b/man/man2/Makefile @@ -1,14 +1,14 @@ -MAN= accept.2 access.2 alarm.2 bind.2 brk.2 chdir.2 chmod.2 chown.2 \ +MAN= accept.2 access.2 bind.2 brk.2 chdir.2 chmod.2 chown.2 \ chroot.2 close.2 connect.2 creat.2 dup.2 execve.2 exit.2 fcntl.2 \ fork.2 getgid.2 getitimer.2 getnucred.2 getpeereid.2 \ getpeername.2 getpid.2 getpriority.2 getsockname.2 getsockopt.2 \ gettimeofday.2 getuid.2 intro.2 ioctl.2 kill.2 link.2 listen.2 \ - lseek.2 mkdir.2 mknod.2 mount.2 open.2 pause.2 ptrace.2 \ + lseek.2 mkdir.2 mknod.2 mount.2 open.2 ptrace.2 \ read.2 readlink.2 reboot.2 recv.2 recvfrom.2 recvmsg.2 rename.2 \ rmdir.2 select.2 send.2 sendmsg.2 sendto.2 setsid.2 \ setsockopt.2 setuid.2 shutdown.2 sigaction.2 sigpending.2 \ sigprocmask.2 sigsuspend.2 socket.2 socketpair.2 \ - svrctl.2 symlink.2 sync.2 time.2 times.2 truncate.2 \ + svrctl.2 symlink.2 sync.2 time.2 truncate.2 \ umask.2 uname.2 unlink.2 utime.2 wait.2 write.2 MLINKS += select.2 FD_CLR.2 diff --git a/man/man2/alarm.2 b/man/man2/alarm.2 deleted file mode 100644 index 0ea81f855..000000000 --- a/man/man2/alarm.2 +++ /dev/null @@ -1,38 +0,0 @@ -.\" Copyright (c) 1980 Regents of the University of California. -.\" All rights reserved. The Berkeley software License Agreement -.\" specifies the terms and conditions for redistribution. -.\" -.\" @(#)alarm.3c 6.3 (Berkeley) 5/27/86 -.\" -.TH ALARM 2 "May 27, 1986" -.UC 4 -.SH NAME -alarm \- schedule signal after specified time -.SH SYNOPSIS -.nf -.ft B -#include - -unsigned int alarm(unsigned int \fIseconds\fP) -.ft R -.fi -.SH DESCRIPTION -.B Alarm -causes signal SIGALRM, see -.BR sigaction (2), -to be sent to the invoking process -in a number of seconds given by the argument. -Unless caught or ignored, the signal terminates the process. -.PP -Alarm requests are not stacked; successive calls reset the alarm clock. -If the argument is 0, any alarm request is canceled. -Because of scheduling delays, -resumption of execution of when the signal is -caught may be delayed an arbitrary amount. -.PP -The return value is the amount of time previously remaining in the alarm clock. -.SH "SEE ALSO" -.BR pause (2), -.BR sigsuspend (2), -.BR sigaction (2), -.BR sleep (3). diff --git a/man/man2/pause.2 b/man/man2/pause.2 deleted file mode 100644 index 2bdaa3b4f..000000000 --- a/man/man2/pause.2 +++ /dev/null @@ -1,43 +0,0 @@ -.\" Copyright (c) 1980 Regents of the University of California. -.\" All rights reserved. The Berkeley software License Agreement -.\" specifies the terms and conditions for redistribution. -.\" -.\" @(#)pause.3c 6.1 (Berkeley) 5/9/85 -.\" -.TH PAUSE 2 "May 9, 1985" -.UC 4 -.SH NAME -pause \- stop until signal -.SH SYNOPSIS -.nf -.ft B -#include - -int pause(void) -.ft R -.fi -.SH DESCRIPTION -.B Pause -never returns normally. -It is used to give up control while waiting for -a signal from -.BR kill (2) -or the alarm timer, see -.BR alarm (2). -Upon termination of a signal handler started during a -.B pause, -the -.B pause -call will return. -.SH "RETURN VALUE -Always returns \-1. -.SH ERRORS -.B Pause -always returns: -.TP 15 -[EINTR] -The call was interrupted. -.SH "SEE ALSO -.BR alarm (2), -.BR kill (2), -.BR sigsuspend (2). diff --git a/man/man2/times.2 b/man/man2/times.2 deleted file mode 100644 index 890c25d1e..000000000 --- a/man/man2/times.2 +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 1980 Regents of the University of California. -.\" All rights reserved. The Berkeley software License Agreement -.\" specifies the terms and conditions for redistribution. -.\" -.\" @(#)times.3c 6.1 (Berkeley) 5/9/85 -.\" -.TH TIMES 2 "May 9, 1985" -.UC 4 -.SH NAME -times \- get process times -.SH SYNOPSIS -.nf -.ft B -#include -#include -#include - -int times(struct tms *\fIbuffer\fP) -.fi -.SH DESCRIPTION -.B Times -returns time-accounting information -for the current process -and for the terminated child processes -of the current process. -All times are in system clock ticks. -.PP -This is the structure returned by -.BR times : -.PP -.RS -.nf -.ta +0.4i +0.8i +1.2i -struct tms { - clock_t tms_utime; /* user time for this process */ - clock_t tms_stime; /* system time for this process */ - clock_t tms_cutime; /* children's user time */ - clock_t tms_cstime; /* children's system time */ -}; -.fi -.RE -.PP -The user time is the number of clock ticks used by a process on -its own computations. The system time is the number of clock ticks -spent inside the kernel on behalf of a process. This does not -include time spent waiting for I/O to happen, only actual CPU -instruction times. -.PP -The children times are the sum -of the children's process times and -their children's times. -.SH RETURN -.B Times -returns the number of system clock ticks since boot time on success, -otherwise \-1 with the error code stored into the -global variable -.BR errno . -Since \-1 is also a valid return value upon success, one should clear -.B errno -before calling this function, and if \-1 is returned, -check its value again afterwards. -.SH ERRORS -The following error code may be set in -.BR errno : -.TP 15 -[EFAULT] -The address specified by the -.I buffer -parameter is not in a valid part of the process address space. -.SH "SEE ALSO" -.BR time (1), -.BR wait (2), -.BR time (2). diff --git a/servers/is/dmp_pm.c b/servers/is/dmp_pm.c index c1d724d23..bf55f1e00 100644 --- a/servers/is/dmp_pm.c +++ b/servers/is/dmp_pm.c @@ -20,21 +20,20 @@ struct mproc mproc[NR_PROCS]; *===========================================================================*/ static char *flags_str(int flags) { - static char str[14]; + static char str[13]; str[0] = (flags & WAITING) ? 'W' : '-'; str[1] = (flags & ZOMBIE) ? 'Z' : '-'; - str[2] = (flags & PAUSED) ? 'P' : '-'; - str[3] = (flags & ALARM_ON) ? 'A' : '-'; - str[4] = (flags & EXITING) ? 'E' : '-'; - str[5] = (flags & STOPPED) ? 'S' : '-'; - str[6] = (flags & SIGSUSPENDED) ? 'U' : '-'; - str[7] = (flags & REPLY) ? 'R' : '-'; - str[8] = (flags & VFS_CALL) ? 'F' : '-'; - str[9] = (flags & PM_SIG_PENDING) ? 's' : '-'; - str[10] = (flags & PRIV_PROC) ? 'p' : '-'; - str[11] = (flags & PARTIAL_EXEC) ? 'x' : '-'; - str[12] = (flags & DELAY_CALL) ? 'd' : '-'; - str[13] = '\0'; + str[2] = (flags & ALARM_ON) ? 'A' : '-'; + str[3] = (flags & EXITING) ? 'E' : '-'; + str[4] = (flags & STOPPED) ? 'S' : '-'; + str[5] = (flags & SIGSUSPENDED) ? 'U' : '-'; + str[6] = (flags & REPLY) ? 'R' : '-'; + str[7] = (flags & VFS_CALL) ? 'F' : '-'; + str[8] = (flags & PM_SIG_PENDING) ? 's' : '-'; + str[9] = (flags & PRIV_PROC) ? 'p' : '-'; + str[10] = (flags & PARTIAL_EXEC) ? 'x' : '-'; + str[11] = (flags & DELAY_CALL) ? 'd' : '-'; + str[12] = '\0'; return str; } @@ -51,7 +50,7 @@ void mproc_dmp() } printf("Process manager (PM) process table dump\n"); - printf("-process- -nr-pnr-tnr- --pid--ppid--pgrp- -uid-- -gid-- -nice- -flags-------\n"); + printf("-process- -nr-pnr-tnr- --pid--ppid--pgrp- -uid-- -gid-- -nice- -flags------\n"); for (i=prev_i; imp_pid == 0 && i != PM_PROC_NR) continue; diff --git a/servers/pm/alarm.c b/servers/pm/alarm.c index b7fb28935..c35ed62c2 100644 --- a/servers/pm/alarm.c +++ b/servers/pm/alarm.c @@ -4,7 +4,6 @@ * * The entry points into this file are: * do_itimer: perform the ITIMER system call - * do_alarm: perform the ALARM system call * set_alarm: tell the timer interface to start or stop a process timer * check_vtimer: check if one of the virtual timers needs to be restarted */ @@ -153,30 +152,6 @@ int do_itimer() return(r); } -/*===========================================================================* - * do_alarm * - *===========================================================================*/ -int do_alarm() -{ - struct itimerval value, ovalue; - int remaining; /* previous time left in seconds */ - - /* retrieve the old timer value, in seconds (rounded up) */ - get_realtimer(mp, &ovalue); - - remaining = ovalue.it_value.tv_sec; - if (ovalue.it_value.tv_usec > 0) remaining++; - - /* set the new timer value */ - memset(&value, 0, sizeof(value)); - value.it_value.tv_sec = m_in.seconds; - - set_realtimer(mp, &value); - - /* and return the old timer value */ - return(remaining); -} - /*===========================================================================* * getset_vtimer * *===========================================================================*/ diff --git a/servers/pm/mproc.h b/servers/pm/mproc.h index 62a7c66b2..b6d010fe9 100644 --- a/servers/pm/mproc.h +++ b/servers/pm/mproc.h @@ -76,7 +76,6 @@ EXTERN struct mproc { #define IN_USE 0x00001 /* set when 'mproc' slot in use */ #define WAITING 0x00002 /* set by WAIT system call */ #define ZOMBIE 0x00004 /* waiting for parent to issue WAIT call */ -#define PAUSED 0x00008 /* set by PAUSE system call */ #define ALARM_ON 0x00010 /* set when SIGALRM timer started */ #define EXITING 0x00020 /* set by EXIT, process is now exiting */ #define TOLD_PARENT 0x00040 /* parent wait() completed, ZOMBIE off */ diff --git a/servers/pm/param.h b/servers/pm/param.h index 3bdb266aa..234fd2cbc 100644 --- a/servers/pm/param.h +++ b/servers/pm/param.h @@ -51,9 +51,3 @@ #define reply_time m2_l1 #define reply_utime m2_l2 #define reply_ntime m2_l2 -#define reply_t1 m4_l1 -#define reply_t2 m4_l2 -#define reply_t3 m4_l3 -#define reply_t4 m4_l4 -#define reply_t5 m4_l5 - diff --git a/servers/pm/proto.h b/servers/pm/proto.h index b46cae0cf..bf38049f6 100644 --- a/servers/pm/proto.h +++ b/servers/pm/proto.h @@ -8,7 +8,6 @@ struct memory; #include /* alarm.c */ -int do_alarm(void); int do_itimer(void); void set_alarm(struct mproc *rmp, clock_t ticks); void check_vtimer(int proc_nr, int sig); @@ -68,7 +67,6 @@ int do_cprofile(void); int do_kill(void); int do_srv_kill(void); int process_ksig(endpoint_t proc_nr_e, int signo); -int do_pause(void); int check_sig(pid_t proc_id, int signo, int ksig); void sig_proc(struct mproc *rmp, int signo, int trace, int ksig); int do_sigaction(void); @@ -83,7 +81,6 @@ void vm_notify_sig_wrapper(endpoint_t ep); /* time.c */ int do_stime(void); int do_time(void); -int do_times(void); int do_getres(void); int do_gettime(void); int do_settime(void); diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 47661368e..7771573b6 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -11,7 +11,6 @@ * do_sigreturn: perform the SIGRETURN system call * do_sigsuspend: perform the SIGSUSPEND system call * do_kill: perform the KILL system call - * do_pause: perform the PAUSE system call * process_ksig: process a signal an behalf of the kernel * sig_proc: interrupt or terminate a signaled process * check_sig: check which processes to signal with sig_proc() @@ -290,17 +289,6 @@ int process_ksig(endpoint_t proc_nr_e, int signo) } } -/*===========================================================================* - * do_pause * - *===========================================================================*/ -int do_pause() -{ -/* Perform the pause() system call. */ - - mp->mp_flags |= PAUSED; - return(SUSPEND); -} - /*===========================================================================* * sig_proc * *===========================================================================*/ @@ -636,10 +624,9 @@ static void unpause(rmp) struct mproc *rmp; /* which process */ { /* A signal is to be sent to a process. If that process is hanging on a - * system call, the system call must be terminated with EINTR. Possible - * calls are PAUSE, WAIT, READ and WRITE, the latter two for pipes and ttys. - * First check if the process is hanging on an PM call. If not, tell VFS, - * so it can check for READs and WRITEs from pipes, ttys and the like. + * system call, the system call must be terminated with EINTR. First check if + * the process is hanging on an PM call. If not, tell VFS, so it can check for + * interruptible calls such as READs and WRITEs from pipes, ttys and the like. */ message m; int r; @@ -648,8 +635,8 @@ struct mproc *rmp; /* which process */ if (rmp->mp_flags & DELAY_CALL) return; - /* Check to see if process is hanging on a PAUSE, WAIT or SIGSUSPEND call. */ - if (rmp->mp_flags & (PAUSED | WAITING | SIGSUSPENDED)) { + /* Check to see if process is hanging on a WAIT or SIGSUSPEND call. */ + if (rmp->mp_flags & (WAITING | SIGSUSPENDED)) { /* Stop process from running. No delay calls: it called us. */ if ((r = sys_stop(rmp->mp_endpoint)) != OK) panic("sys_stop failed: %d", r); @@ -743,8 +730,8 @@ int signo; /* signal to send to process (1 to _NSIG-1) */ } /* Was the process suspended in PM? Then interrupt the blocking call. */ - if (rmp->mp_flags & (PAUSED | WAITING | SIGSUSPENDED)) { - rmp->mp_flags &= ~(PAUSED | WAITING | SIGSUSPENDED); + if (rmp->mp_flags & (WAITING | SIGSUSPENDED)) { + rmp->mp_flags &= ~(WAITING | SIGSUSPENDED); setreply(slot, EINTR); } diff --git a/servers/pm/table.c b/servers/pm/table.c index e7de0df50..2e39901e0 100644 --- a/servers/pm/table.c +++ b/servers/pm/table.c @@ -38,9 +38,9 @@ int (*call_vec[])(void) = { do_get, /* 24 = getuid */ do_stime, /* 25 = stime */ do_trace, /* 26 = ptrace */ - do_alarm, /* 27 = alarm */ + no_sys, /* 27 = unused */ no_sys, /* 28 = fstat */ - do_pause, /* 29 = pause */ + no_sys, /* 29 = unused */ no_sys, /* 30 = utime */ do_getepinfo, /* 31 = getepinfo */ do_set, /* 32 = setgroups */ @@ -54,7 +54,7 @@ int (*call_vec[])(void) = { no_sys, /* 40 = rmdir */ no_sys, /* 41 = dup */ no_sys, /* 42 = pipe */ - do_times, /* 43 = times */ + no_sys, /* 43 = unused */ no_sys, /* 44 = unused */ no_sys, /* 45 = unused */ do_set, /* 46 = setgid */ diff --git a/servers/pm/time.c b/servers/pm/time.c index 49e554cdd..2348206be 100644 --- a/servers/pm/time.c +++ b/servers/pm/time.c @@ -6,7 +6,6 @@ * do_settime: perform the CLOCK_SETTIME system call * do_time: perform the TIME system call * do_stime: perform the STIME system call - * do_times: perform the TIMES system call */ #include "pm.h" @@ -134,25 +133,3 @@ int do_stime() return(OK); } - -/*===========================================================================* - * do_times * - *===========================================================================*/ -int do_times() -{ -/* Perform the times(buffer) system call. */ - register struct mproc *rmp = mp; - clock_t user_time, sys_time, uptime; - int s; - - if (OK != (s=sys_times(who_e, &user_time, &sys_time, &uptime, NULL))) - panic("do_times couldn't get times: %d", s); - rmp->mp_reply.reply_t1 = user_time; /* user time */ - rmp->mp_reply.reply_t2 = sys_time; /* system time */ - rmp->mp_reply.reply_t3 = rmp->mp_child_utime; /* child user time */ - rmp->mp_reply.reply_t4 = rmp->mp_child_stime; /* child system time */ - rmp->mp_reply.reply_t5 = uptime; /* uptime since boot */ - - return(OK); -} - diff --git a/servers/procfs/pid.c b/servers/procfs/pid.c index b6e7becc9..abb5693fb 100644 --- a/servers/procfs/pid.c +++ b/servers/procfs/pid.c @@ -78,7 +78,7 @@ static void pid_psinfo(int i) else if (proc[i].p_rts_flags == 0) state = STATE_RUN; /* in run-queue */ else if (fp_is_blocked(&fproc[pi]) || - (mproc[pi].mp_flags & (WAITING | PAUSED | SIGSUSPENDED))) + (mproc[pi].mp_flags & (WAITING | SIGSUSPENDED))) state = STATE_SLEEP; /* sleeping */ else state = STATE_WAIT; /* waiting */ @@ -116,9 +116,7 @@ static void pid_psinfo(int i) /* If the process is not a kernel task, we add some extra info. */ if (!task) { - if (mproc[pi].mp_flags & PAUSED) - p_state = PSTATE_PAUSED; - else if (mproc[pi].mp_flags & WAITING) + if (mproc[pi].mp_flags & WAITING) p_state = PSTATE_WAITING; else if (mproc[pi].mp_flags & SIGSUSPENDED) p_state = PSTATE_SIGSUSP; diff --git a/servers/vfs/table.c b/servers/vfs/table.c index dac713876..9a8beb285 100644 --- a/servers/vfs/table.c +++ b/servers/vfs/table.c @@ -41,9 +41,9 @@ int (*call_vec[])(message *m_out) = { no_sys, /* 24 = getuid */ no_sys, /* 25 = (stime) */ no_sys, /* 26 = ptrace */ - no_sys, /* 27 = alarm */ + no_sys, /* 27 = unused */ no_sys, /* 28 = unused (was old fstat)*/ - no_sys, /* 29 = pause */ + no_sys, /* 29 = unused */ do_utime, /* 30 = utime */ no_sys, /* 31 = (stty) */ no_sys, /* 32 = (gtty) */ @@ -57,7 +57,7 @@ int (*call_vec[])(message *m_out) = { do_unlink, /* 40 = rmdir */ no_sys, /* 41 = unused */ do_pipe, /* 42 = pipe */ - no_sys, /* 43 = times */ + no_sys, /* 43 = unused */ no_sys, /* 44 = (prof) */ do_slink, /* 45 = symlink */ no_sys, /* 46 = (setgid)*/