]> andersk Git - openssh.git/blame - next-posix.c
oops
[openssh.git] / next-posix.c
CommitLineData
c80876b4 1#include "includes.h"
729bfe59 2
3#ifdef HAVE_NEXT
729bfe59 4#include <errno.h>
84a770d1 5#include <sys/wait.h>
729bfe59 6#include "next-posix.h"
7
84a770d1 8pid_t
9posix_wait(int *status)
10{
11 #undef wait /* Use NeXT's wait() function */
12 union wait statusp;
13 pid_t wait_pid;
14
15 wait_pid = wait(&statusp);
16 status = (int *) statusp.w_status;
17
18 return wait_pid;
19}
20
21
22int
23posix_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
729bfe59 35int
36waitpid(int pid, int *stat_loc, int options)
37{
38 if (pid <= 0) {
39 if (pid != -1) {
40 errno = EINVAL;
41 return -1;
42 }
43 pid = 0; /* wait4() expects pid=0 for indiscriminate wait. */
44 }
45 return wait4(pid, (union wait *)stat_loc, options, NULL);
46}
47
48pid_t setsid(void)
49{
50 return setpgrp(0, getpid());
51}
52
53int
54tcgetattr(int fd, struct termios *t)
55{
56 return (ioctl(fd, TIOCGETA, t));
57}
58
59int
60tcsetattr(int fd, int opt, const struct termios *t)
61{
62 struct termios localterm;
63
64 if (opt & TCSASOFT) {
65 localterm = *t;
66 localterm.c_cflag |= CIGNORE;
67 t = &localterm;
68 }
69 switch (opt & ~TCSASOFT) {
70 case TCSANOW:
71 return (ioctl(fd, TIOCSETA, t));
72 case TCSADRAIN:
73 return (ioctl(fd, TIOCSETAW, t));
74 case TCSAFLUSH:
75 return (ioctl(fd, TIOCSETAF, t));
76 default:
77 errno = EINVAL;
78 return (-1);
79 }
80}
81
82int tcsetpgrp(int fd, pid_t pgrp)
83{
84 int s;
85
86 s = pgrp;
87 return (ioctl(fd, TIOCSPGRP, &s));
88}
89
90speed_t cfgetospeed(const struct termios *t)
91{
92 return (t->c_ospeed);
93}
94
95speed_t cfgetispeed(const struct termios *t)
96{
97 return (t->c_ispeed);
98}
99
100int
101cfsetospeed(struct termios *t,int speed)
102{
103 t->c_ospeed = speed;
104 return (0);
105}
106
107int
5bf9cfe9 108cfsetispeed(struct termios *t, int speed)
729bfe59 109{
110 t->c_ispeed = speed;
111 return (0);
112}
729bfe59 113#endif /* HAVE_NEXT */
This page took 0.135802 seconds and 5 git commands to generate.