diff options
Diffstat (limited to 'next-posix.c')
-rw-r--r-- | next-posix.c | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/next-posix.c b/next-posix.c index de7723e97..d5cc733d0 100644 --- a/next-posix.c +++ b/next-posix.c | |||
@@ -1,3 +1,25 @@ | |||
1 | /* | ||
2 | * Redistribution and use in source and binary forms, with or without | ||
3 | * modification, are permitted provided that the following conditions | ||
4 | * are met: | ||
5 | * 1. Redistributions of source code must retain the above copyright | ||
6 | * notice, this list of conditions and the following disclaimer. | ||
7 | * 2. Redistributions in binary form must reproduce the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer in the | ||
9 | * documentation and/or other materials provided with the distribution. | ||
10 | * | ||
11 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
12 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
13 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
14 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
15 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
16 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
17 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
18 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
19 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
20 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
21 | */ | ||
22 | |||
1 | #include "includes.h" | 23 | #include "includes.h" |
2 | 24 | ||
3 | #ifdef HAVE_NEXT | 25 | #ifdef HAVE_NEXT |
@@ -8,46 +30,32 @@ | |||
8 | pid_t | 30 | pid_t |
9 | posix_wait(int *status) | 31 | posix_wait(int *status) |
10 | { | 32 | { |
11 | #undef wait /* Use NeXT's wait() function */ | ||
12 | union wait statusp; | 33 | union wait statusp; |
13 | pid_t wait_pid; | 34 | pid_t wait_pid; |
14 | 35 | ||
36 | #undef wait /* Use NeXT's wait() function */ | ||
15 | wait_pid = wait(&statusp); | 37 | wait_pid = wait(&statusp); |
16 | status = (int *) statusp.w_status; | 38 | status = (int *) statusp.w_status; |
17 | 39 | ||
18 | return wait_pid; | 40 | return wait_pid; |
19 | } | 41 | } |
20 | 42 | ||
21 | 43 | pid_t | |
22 | int | 44 | waitpid(int pid, int *stat_loc, int options) |
23 | posix_utime(char *filename,struct utimbuf *buf) | ||
24 | { | ||
25 | time_t timep[2]; | ||
26 | |||
27 | timep[0] = buf->actime; | ||
28 | timep[1] = buf->modtime; | ||
29 | |||
30 | #undef utime /* Use NeXT's utime() function */ | ||
31 | return utime(filename,timep); | ||
32 | } | ||
33 | |||
34 | |||
35 | int | ||
36 | waitpid(int pid, int *stat_loc, int options) | ||
37 | { | 45 | { |
46 | union wait statusp; | ||
47 | pid_t wait_pid; | ||
48 | |||
38 | if (pid <= 0) { | 49 | if (pid <= 0) { |
39 | if (pid != -1) { | 50 | if (pid != -1) { |
40 | errno = EINVAL; | 51 | errno = EINVAL; |
41 | return -1; | 52 | return -1; |
42 | } | 53 | } |
43 | pid = 0; /* wait4() expects pid=0 for indiscriminate wait. */ | 54 | pid = 0; /* wait4() wants pid=0 for indiscriminate wait. */ |
44 | } | 55 | } |
45 | return wait4(pid, (union wait *)stat_loc, options, NULL); | 56 | wait_pid = wait4(pid, &statusp, options, NULL); |
46 | } | 57 | stat_loc = (int *)statusp.w_status; |
47 | 58 | return wait_pid; | |
48 | pid_t setsid(void) | ||
49 | { | ||
50 | return setpgrp(0, getpid()); | ||
51 | } | 59 | } |
52 | 60 | ||
53 | int | 61 | int |
@@ -81,10 +89,7 @@ tcsetattr(int fd, int opt, const struct termios *t) | |||
81 | 89 | ||
82 | int tcsetpgrp(int fd, pid_t pgrp) | 90 | int tcsetpgrp(int fd, pid_t pgrp) |
83 | { | 91 | { |
84 | int s; | 92 | return (ioctl(fd, TIOCSPGRP, &pgrp)); |
85 | |||
86 | s = pgrp; | ||
87 | return (ioctl(fd, TIOCSPGRP, &s)); | ||
88 | } | 93 | } |
89 | 94 | ||
90 | speed_t cfgetospeed(const struct termios *t) | 95 | speed_t cfgetospeed(const struct termios *t) |