summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib
diff options
context:
space:
mode:
authorspew <devnull@localhost>2018-07-03 12:28:05 -0400
committerspew <devnull@localhost>2018-07-03 12:28:05 -0400
commitede15f38e5f4d47bd6348a119e408a61913d0229 (patch)
tree8d5ae3cf49894c634a167bab20be709834b580e8 /sys/src/ape/lib
parentac891003ea8e1220d4bc79d8bb8ea56564703179 (diff)
ape: remove getitimer setitimer implemenations
Diffstat (limited to 'sys/src/ape/lib')
-rw-r--r--sys/src/ape/lib/bsd/getitimer.c86
-rw-r--r--sys/src/ape/lib/bsd/mkfile1
2 files changed, 0 insertions, 87 deletions
diff --git a/sys/src/ape/lib/bsd/getitimer.c b/sys/src/ape/lib/bsd/getitimer.c
deleted file mode 100644
index fe3ff424a..000000000
--- a/sys/src/ape/lib/bsd/getitimer.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <signal.h>
-#include <errno.h>
-#include <time.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-
-typedef struct Timer Timer;
-struct Timer {
- int pid, signal;
- struct itimerval itimer;
-};
-
-Timer timers[3] = {
- {0, SIGALRM},
- {0, SIGVTALRM},
- {0, SIGPROF},
-};
-
-void
-timerloop(int signal, const struct timeval tval)
-{
- pid_t ppid;
- struct timespec t, s;
-
- ppid = getppid();
- t.tv_sec = tval.tv_sec;
- t.tv_nsec = tval.tv_usec*1000;
- for(;;){
- nanosleep(&t, &s);
- kill(ppid, signal);
- }
-}
-
-int
-setitimer(int which, const struct itimerval *new, struct itimerval *curr)
-{
- pid_t pid;
- int status;
- Timer *timer;
-
- if(which < 0 || which >= 3){
- errno = EINVAL;
- return -1;
- }
-
- timer = timers+which;
- if(timer->pid != 0){
- kill(timer->pid, SIGKILL);
- waitpid(timer->pid, &status, 0);
- }
-
- switch(pid = fork()){
- default:
- timer->pid = pid;
- if(curr != NULL)
- *curr = timer->itimer;
- timer->itimer = *new;
- break;
- case -1:
- errno = EFAULT;
- return -1;
- case 0:
- timerloop(timer->signal, new->it_interval);
- exit(0);
- }
- return 0;
-}
-
-int
-getitimer(int which, struct itimerval *curr)
-{
- Timer *timer;
-
- if(which < 0 || which >= 3){
- errno = EINVAL;
- return -1;
- }
-
- timer = timers+which;
- *curr = timer->itimer;
- return 0;
-}
diff --git a/sys/src/ape/lib/bsd/mkfile b/sys/src/ape/lib/bsd/mkfile
index c121f8a0e..90fefd36b 100644
--- a/sys/src/ape/lib/bsd/mkfile
+++ b/sys/src/ape/lib/bsd/mkfile
@@ -15,7 +15,6 @@ OFILES=\
gethostbyaddr.$O\
gethostbyname.$O\
gethostname.$O\
- getitimer.$O\
getnameinfo.$O\
getopt.$O\
getpeername.$O\