diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-09-14 01:35:03 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-09-14 01:35:03 +0000 |
commit | 7b1fdca317ff8e8767ac152f6fd1bedea14e8d85 (patch) | |
tree | a898f8311a74dbf96088b41007361416fe6b39cb /sys/kern | |
parent | a48e8a33d48318a13cfd64a01cca5f45045c8b82 (diff) |
Snapshots for all archs have been built, so remove the T32 code
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_descrip.c | 28 | ||||
-rw-r--r-- | sys/kern/kern_event.c | 255 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 27 | ||||
-rw-r--r-- | sys/kern/kern_resource.c | 24 | ||||
-rw-r--r-- | sys/kern/kern_synch.c | 31 | ||||
-rw-r--r-- | sys/kern/kern_time.c | 335 | ||||
-rw-r--r-- | sys/kern/sys_generic.c | 141 | ||||
-rw-r--r-- | sys/kern/syscalls.conf | 4 | ||||
-rw-r--r-- | sys/kern/syscalls.master | 69 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 248 |
10 files changed, 33 insertions, 1129 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 10c0ffcae89..3be945653b6 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.103 2013/08/13 05:52:23 guenther Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.104 2013/09/14 01:35:00 guenther Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -650,32 +650,6 @@ sys_fstat(struct proc *p, void *v, register_t *retval) return (error); } -#ifdef T32 -int copyout_stat32(struct stat *, void *, struct proc *); -int -t32_sys_fstat(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_fstat_args /* { - syscallarg(int) fd; - syscallarg(struct stat32 *) sb; - } */ *uap = v; - int fd = SCARG(uap, fd); - struct filedesc *fdp = p->p_fd; - struct file *fp; - struct stat ub; - int error; - - if ((fp = fd_getfile(fdp, fd)) == NULL) - return (EBADF); - FREF(fp); - error = (*fp->f_ops->fo_stat)(fp, &ub, p); - FRELE(fp, p); - if (error == 0) - error = copyout_stat32(&ub, SCARG(uap, sb), p); - return (error); -} -#endif - /* * Return pathconf information about a file descriptor. */ diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index f200ad1fd77..e5f429d1e49 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.51 2013/08/13 05:52:23 guenther Exp $ */ +/* $OpenBSD: kern_event.c,v 1.52 2013/09/14 01:35:00 guenther Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -548,259 +548,6 @@ sys_kevent(struct proc *p, void *v, register_t *retval) return (error); } -#ifdef T32 - -struct kevent32 { - u_int ident; - short filter; - u_short flags; - u_int fflags; - int data; - void *udata; -}; - -static int -kqueue32_scan(struct kqueue *kq, int maxevents, struct kevent32 *ulistp, - const struct timespec *tsp, struct proc *p, int *retval, - struct kevent32 *k32) -{ - struct kevent32 *kevp; - struct timeval atv, rtv, ttv; - struct knote *kn, marker; - int s, count, timeout, nkev = 0, error = 0; - - count = maxevents; - if (count == 0) - goto done; - - if (tsp != NULL) { - TIMESPEC_TO_TIMEVAL(&atv, tsp); - if (tsp->tv_sec == 0 && tsp->tv_nsec == 0) { - /* No timeout, just poll */ - timeout = -1; - goto start; - } - if (itimerfix(&atv)) { - error = EINVAL; - goto done; - } - - timeout = atv.tv_sec > 24 * 60 * 60 ? - 24 * 60 * 60 * hz : tvtohz(&atv); - - getmicrouptime(&rtv); - timeradd(&atv, &rtv, &atv); - } else { - atv.tv_sec = 0; - atv.tv_usec = 0; - timeout = 0; - } - goto start; - -retry: - if (atv.tv_sec || atv.tv_usec) { - getmicrouptime(&rtv); - if (timercmp(&rtv, &atv, >=)) - goto done; - ttv = atv; - timersub(&ttv, &rtv, &ttv); - timeout = ttv.tv_sec > 24 * 60 * 60 ? - 24 * 60 * 60 * hz : tvtohz(&ttv); - } - -start: - if (kq->kq_state & KQ_DYING) { - error = EBADF; - goto done; - } - - kevp = k32; - s = splhigh(); - if (kq->kq_count == 0) { - if (timeout < 0) { - error = EWOULDBLOCK; - } else { - kq->kq_state |= KQ_SLEEP; - error = tsleep(kq, PSOCK | PCATCH, "kqread", timeout); - } - splx(s); - if (error == 0) - goto retry; - /* don't restart after signals... */ - if (error == ERESTART) - error = EINTR; - else if (error == EWOULDBLOCK) - error = 0; - goto done; - } - - TAILQ_INSERT_TAIL(&kq->kq_head, &marker, kn_tqe); - while (count) { - kn = TAILQ_FIRST(&kq->kq_head); - TAILQ_REMOVE(&kq->kq_head, kn, kn_tqe); - if (kn == &marker) { - splx(s); - if (count == maxevents) - goto retry; - goto done; - } - if (kn->kn_status & KN_DISABLED) { - kn->kn_status &= ~KN_QUEUED; - kq->kq_count--; - continue; - } - if ((kn->kn_flags & EV_ONESHOT) == 0 && - kn->kn_fop->f_event(kn, 0) == 0) { - kn->kn_status &= ~(KN_QUEUED | KN_ACTIVE); - kq->kq_count--; - continue; - } - kevp->ident = kn->kn_kevent.ident; - kevp->filter = kn->kn_kevent.filter; - kevp->flags = kn->kn_kevent.flags; - kevp->fflags = kn->kn_kevent.fflags; - kevp->data = kn->kn_kevent.data; - kevp->udata = kn->kn_kevent.udata; - kevp++; - nkev++; - if (kn->kn_flags & EV_ONESHOT) { - kn->kn_status &= ~KN_QUEUED; - kq->kq_count--; - splx(s); - kn->kn_fop->f_detach(kn); - knote_drop(kn, p, p->p_fd); - s = splhigh(); - } else if (kn->kn_flags & EV_CLEAR) { - kn->kn_data = 0; - kn->kn_fflags = 0; - kn->kn_status &= ~(KN_QUEUED | KN_ACTIVE); - kq->kq_count--; - } else { - TAILQ_INSERT_TAIL(&kq->kq_head, kn, kn_tqe); - } - count--; - if (nkev == KQ_NEVENTS) { - splx(s); - error = copyout(k32, ulistp, sizeof(*k32) * nkev); - ulistp += nkev; - nkev = 0; - kevp = k32; - s = splhigh(); - if (error) - break; - } - } - TAILQ_REMOVE(&kq->kq_head, &marker, kn_tqe); - splx(s); -done: - if (nkev != 0) - error = copyout(k32, ulistp, sizeof(*k32) * nkev); - *retval = maxevents - count; - return (error); -} - - -int -t32_sys_kevent(struct proc *p, void *v, register_t *retval) -{ - struct filedesc* fdp = p->p_fd; - struct t32_sys_kevent_args /* { - syscallarg(int) fd; - syscallarg(const struct kevent32 *) changelist; - syscallarg(int) nchanges; - syscallarg(struct kevent32 *) eventlist; - syscallarg(int) nevents; - syscallarg(const struct timespec32 *) timeout; - } */ *uap = v; - struct kevent32 k32[KQ_NEVENTS]; - struct kevent *kevp; - struct kqueue *kq; - struct file *fp; - struct timespec32 ts32; - struct timespec ts, *tsp; - int i, n, nerrors, error; - - if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL || - (fp->f_type != DTYPE_KQUEUE)) - return (EBADF); - - FREF(fp); - - if (SCARG(uap, timeout) != NULL) { - error = copyin(SCARG(uap, timeout), &ts32, sizeof(ts32)); - if (error) - goto done; - TIMESPEC_FROM_32(&ts, &ts32); -#ifdef KTRACE - if (KTRPOINT(p, KTR_STRUCT)) - ktrreltimespec(p, &ts); -#endif - tsp = &ts; - } else - tsp = NULL; - - kq = (struct kqueue *)fp->f_data; - nerrors = 0; - - while (SCARG(uap, nchanges) > 0) { - n = SCARG(uap, nchanges) > KQ_NEVENTS - ? KQ_NEVENTS : SCARG(uap, nchanges); - error = copyin(SCARG(uap, changelist), k32, n * sizeof(*k32)); - if (error) - goto done; - for (i = 0; i < n; i++) { - kq->kq_kev[i].ident = k32[i].ident; - kq->kq_kev[i].filter = k32[i].filter; - kq->kq_kev[i].flags = k32[i].flags; - kq->kq_kev[i].fflags = k32[i].fflags; - kq->kq_kev[i].data = k32[i].data; - kq->kq_kev[i].udata = k32[i].udata; - } - for (i = 0; i < n; i++) { - kevp = &kq->kq_kev[i]; - kevp->flags &= ~EV_SYSFLAGS; - error = kqueue_register(kq, kevp, p); - if (error) { - if (SCARG(uap, nevents) != 0) { - k32->ident = kevp->ident; - k32->filter = kevp->filter; - k32->flags = EV_ERROR; - k32->fflags = kevp->fflags; - k32->data = error; - k32->udata = kevp->udata; - copyout(k32, SCARG(uap, eventlist), - sizeof(*k32)); - SCARG(uap, eventlist)++; - SCARG(uap, nevents)--; - nerrors++; - } else { - goto done; - } - } - } - SCARG(uap, nchanges) -= n; - SCARG(uap, changelist) += n; - } - if (nerrors) { - *retval = nerrors; - error = 0; - goto done; - } - - KQREF(kq); - FRELE(fp, p); - error = kqueue32_scan(kq, SCARG(uap, nevents), SCARG(uap, eventlist), - tsp, p, &n, k32); - KQRELE(kq); - *retval = n; - return (error); - - done: - FRELE(fp, p); - return (error); -} -#endif - int kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p) { diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 71a18635c4b..2468406d67b 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.126 2013/08/13 05:52:23 guenther Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.127 2013/09/14 01:35:00 guenther Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -464,31 +464,6 @@ sys_wait4(struct proc *q, void *v, register_t *retval) return (error); } -#ifdef T32 -int -t32_sys_wait4(struct proc *q, void *v, register_t *retval) -{ - struct t32_sys_wait4_args /* { - syscallarg(pid_t) pid; - syscallarg(int *) status; - syscallarg(int) options; - syscallarg(struct rusage32 *) rusage; - } */ *uap = v; - struct rusage ru; - int error; - - error = dowait4(q, SCARG(uap, pid), SCARG(uap, status), - SCARG(uap, options), SCARG(uap, rusage) ? &ru : NULL, retval); - if (error == 0 && SCARG(uap, rusage)) { - struct rusage32 ru32; - - RUSAGE_TO_32(&ru32, &ru); - error = copyout(&ru32, SCARG(uap, rusage), sizeof(ru32)); - } - return (error); -} -#endif - int dowait4(struct proc *q, pid_t pid, int *statusp, int options, struct rusage *rusage, register_t *retval) diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index e00bc77a8dc..2110d854f01 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.43 2013/08/13 05:52:23 guenther Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.44 2013/09/14 01:35:00 guenther Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -440,28 +440,6 @@ sys_getrusage(struct proc *p, void *v, register_t *retval) return (error); } -#ifdef T32 -int -t32_sys_getrusage(struct proc *p, void *v, register_t *retval) -{ - struct sys_getrusage_args /* { - syscallarg(int) who; - syscallarg(struct rusage32 *) rusage; - } */ *uap = v; - struct rusage ru; - int error; - - error = dogetrusage(p, SCARG(uap, who), &ru, retval); - if (error == 0) { - struct rusage32 ru32; - - RUSAGE_TO_32(&ru32, &ru); - error = copyout(&ru32, SCARG(uap, rusage), sizeof(ru32)); - } - return (error); -} -#endif - int dogetrusage(struct proc *p, int who, struct rusage *rup, register_t *retval) { diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 6703cd7f363..c36367772a9 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.107 2013/08/13 05:52:23 guenther Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.108 2013/09/14 01:35:01 guenther Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -521,35 +521,6 @@ sys___thrsleep(struct proc *p, void *v, register_t *retval) return (0); } -#ifdef T32 -int -t32_sys___thrsleep(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys___thrsleep_args /* { - syscallarg(const volatile void *) ident; - syscallarg(clockid_t) clock_id; - syscallarg(struct timespec32 *) tp; - syscallarg(void *) lock; - syscallarg(const int *) abort; - } */ *uap = v; - struct timespec32 ts32; - struct timespec ts; - int error; - - if (SCARG(uap, tp) != NULL) { - if ((error = copyin(SCARG(uap, tp), &ts32, sizeof(ts32)))) { - *retval = error; - return (0); - } - TIMESPEC_FROM_32(&ts, &ts32); - SCARG(uap, tp) = (void *)&ts; - } - - *retval = thrsleep(p, (struct sys___thrsleep_args *)uap); - return (0); -} -#endif - int sys___thrwakeup(struct proc *p, void *v, register_t *retval) { diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 72c032f18d7..cb700263911 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_time.c,v 1.81 2013/08/13 05:52:23 guenther Exp $ */ +/* $OpenBSD: kern_time.c,v 1.82 2013/09/14 01:35:01 guenther Exp $ */ /* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */ /* @@ -774,336 +774,3 @@ ppsratecheck(struct timeval *lasttime, int *curpps, int maxpps) return (rv); } -#ifdef T32 -int -t32_sys_clock_gettime(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_clock_gettime_args /* { - syscallarg(clockid_t) clock_id; - syscallarg(struct timespec32 *) tp; - } */ *uap = v; - struct timespec ats; - struct timespec32 ats32; - int error; - - if ((error = clock_gettime(p, SCARG(uap, clock_id), &ats)) != 0) - return (error); - TIMESPEC_TO_32(&ats32, &ats); - return (copyout(&ats32, SCARG(uap, tp), sizeof(ats32))); -} - -int -t32_sys_clock_settime(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_clock_settime_args /* { - syscallarg(clockid_t) clock_id; - syscallarg(const struct timespec32 *) tp; - } */ *uap = v; - struct timespec ats; - struct timespec32 ats32; - clockid_t clock_id; - int error; - - if ((error = suser(p, 0)) != 0) - return (error); - - if ((error = copyin(SCARG(uap, tp), &ats32, sizeof(ats32))) != 0) - return (error); - TIMESPEC_FROM_32(&ats, &ats32); - - clock_id = SCARG(uap, clock_id); - switch (clock_id) { - case CLOCK_REALTIME: - if ((error = settime(&ats)) != 0) - return (error); - break; - default: /* Other clocks are read-only */ - return (EINVAL); - } - - return (0); -} - -int -t32_sys_clock_getres(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_clock_getres_args /* { - syscallarg(clockid_t) clock_id; - syscallarg(struct timespec32 *) tp; - } */ *uap = v; - clockid_t clock_id; - struct timespec32 ts; - int error = 0; - - clock_id = SCARG(uap, clock_id); - switch (clock_id) { - case CLOCK_REALTIME: - case CLOCK_MONOTONIC: - ts.tv_sec = 0; - ts.tv_nsec = 1000000000 / hz; - break; - default: - return (EINVAL); - } - - if (SCARG(uap, tp)) { - error = copyout(&ts, SCARG(uap, tp), sizeof (ts)); -#ifdef KTRACE - if (error == 0 && KTRPOINT(p, KTR_STRUCT)) { - KERNEL_LOCK(); - ktrreltimespec(p, &ts); - KERNEL_UNLOCK(); - } -#endif - } - - return error; -} -#endif /* T32 */ - -#if defined(T32) || defined(COMPAT_LINUX) -int -t32_sys_nanosleep(struct proc *p, void *v, register_t *retval) -{ - static int nanowait; - struct t32_sys_nanosleep_args/* { - syscallarg(const struct timespec32 *) rqtp; - syscallarg(struct timespec32 *) rmtp; - } */ *uap = v; - struct timespec32 ts32; - struct timespec rqt, rmt; - struct timespec sts, ets; - struct timespec32 *rmtp; - struct timeval tv; - int error, error1; - - rmtp = SCARG(uap, rmtp); - error = copyin(SCARG(uap, rqtp), &ts32, sizeof(ts32)); - if (error) - return (error); - TIMESPEC_FROM_32(&rqt, &ts32); -#ifdef KTRACE - if (KTRPOINT(p, KTR_STRUCT)) { - KERNEL_LOCK(); - ktrreltimespec(p, &rqt); - KERNEL_UNLOCK(); - } -#endif - - TIMESPEC_TO_TIMEVAL(&tv, &rqt); - if (itimerfix(&tv)) - return (EINVAL); - - if (rmtp) - getnanouptime(&sts); - - error = tsleep(&nanowait, PWAIT | PCATCH, "nanosleep", - MAX(1, tvtohz(&tv))); - if (error == ERESTART) - error = EINTR; - if (error == EWOULDBLOCK) - error = 0; - - if (rmtp) { - getnanouptime(&ets); - - timespecsub(&ets, &sts, &sts); - timespecsub(&rqt, &sts, &rmt); - - if (rmt.tv_sec < 0) - timespecclear(&rmt); - - TIMESPEC_TO_32(&ts32, &rmt); - error1 = copyout(&ts32, rmtp, sizeof(ts32)); - if (error1 != 0) - error = error1; -#ifdef KTRACE - if (error1 == 0 && KTRPOINT(p, KTR_STRUCT)) { - KERNEL_LOCK(); - ktrreltimespec(p, &rmt); - KERNEL_UNLOCK(); - } -#endif - } - - return error; -} - -/* ARGSUSED */ -int -t32_sys_gettimeofday(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_gettimeofday_args /* { - syscallarg(struct timeval32 *) tp; - syscallarg(struct timezone *) tzp; - } */ *uap = v; - struct timeval atv; - struct timeval32 atv32; - struct timeval32 *tp; - struct timezone *tzp; - int error = 0; - - tp = SCARG(uap, tp); - tzp = SCARG(uap, tzp); - - if (tp) { - microtime(&atv); - TIMEVAL_TO_32(&atv32, &atv); - if ((error = copyout(&atv32, tp, sizeof (atv32)))) - return (error); -#ifdef KTRACE - if (KTRPOINT(p, KTR_STRUCT)) { - KERNEL_LOCK(); - ktrabstimeval(p, &atv); - KERNEL_UNLOCK(); - } -#endif - } - if (tzp) - error = copyout(&tz, tzp, sizeof (tz)); - return (error); -} - -/* ARGSUSED */ -int -t32_sys_settimeofday(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_settimeofday_args /* { - syscallarg(const struct timeval32 *) tv; - syscallarg(const struct timezone *) tzp; - } */ *uap = v; - struct timezone atz; - struct timeval32 atv; - const struct timeval32 *tv; - const struct timezone *tzp; - int error; - - tv = SCARG(uap, tv); - tzp = SCARG(uap, tzp); - - if ((error = suser(p, 0))) - return (error); - /* Verify all parameters before changing time. */ - if (tv && (error = copyin(tv, &atv, sizeof(atv)))) - return (error); - if (tzp && (error = copyin(tzp, &atz, sizeof(atz)))) - return (error); - if (tv) { - struct timespec ts; - - TIMESPEC_FROM_TIMEVAL32(&ts, &atv); - if ((error = settime(&ts)) != 0) - return (error); - } - if (tzp) - tz = atz; - return (0); -} - -int -t32_sys_getitimer(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_getitimer_args /* { - syscallarg(int) which; - syscallarg(struct itimerval32 *) itv; - } */ *uap = v; - struct itimerval aitv; - struct itimerval32 aitv32; - int s; - int which; - - which = SCARG(uap, which); - - if (which < ITIMER_REAL || which > ITIMER_PROF) - return (EINVAL); - s = splclock(); - aitv = p->p_p->ps_timer[which]; - - if (which == ITIMER_REAL) { - struct timeval now; - - getmicrouptime(&now); - /* - * Convert from absolute to relative time in .it_value - * part of real time timer. If time for real time timer - * has passed return 0, else return difference between - * current time and time for the timer to go off. - */ - if (timerisset(&aitv.it_value)) { - if (timercmp(&aitv.it_value, &now, <)) - timerclear(&aitv.it_value); - else - timersub(&aitv.it_value, &now, - &aitv.it_value); - } - } - splx(s); - ITIMERVAL_TO_32(&aitv32, &aitv); - return (copyout(&aitv32, SCARG(uap, itv), sizeof(aitv32))); -} - -/* ARGSUSED */ -int -t32_sys_setitimer(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_setitimer_args /* { - syscallarg(int) which; - syscallarg(const struct itimerval32 *) itv; - syscallarg(struct itimerval32 *) oitv; - } */ *uap = v; - struct t32_sys_getitimer_args getargs; - struct itimerval aitv; - struct itimerval32 aitv32; - const struct itimerval32 *itvp; - struct itimerval32 *oitv; - struct process *pr = p->p_p; - int error; - int timo; - int which; - - which = SCARG(uap, which); - itvp = SCARG(uap, itv); - oitv = SCARG(uap, oitv); - - if (which < ITIMER_REAL || which > ITIMER_PROF) - return (EINVAL); - if (itvp && (error = copyin(itvp, &aitv32, sizeof(aitv32)))) - return (error); - if (oitv != NULL) { - SCARG(&getargs, which) = which; - SCARG(&getargs, itv) = oitv; - if ((error = t32_sys_getitimer(p, &getargs, retval))) - return (error); - } - if (itvp == 0) - return (0); - ITIMERVAL_FROM_32(&aitv, &aitv32); - if (itimerfix(&aitv.it_value) || itimerfix(&aitv.it_interval)) - return (EINVAL); - if (which == ITIMER_REAL) { - struct timeval ctv; - - timeout_del(&pr->ps_realit_to); - getmicrouptime(&ctv); - if (timerisset(&aitv.it_value)) { - timo = tvtohz(&aitv.it_value); - timeout_add(&pr->ps_realit_to, timo); - timeradd(&aitv.it_value, &ctv, &aitv.it_value); - } - pr->ps_timer[ITIMER_REAL] = aitv; - } else { - int s; - - itimerround(&aitv.it_interval); - s = splclock(); - pr->ps_timer[which] = aitv; - if (which == ITIMER_VIRTUAL) - timeout_del(&pr->ps_virt_to); - if (which == ITIMER_PROF) - timeout_del(&pr->ps_prof_to); - splx(s); - } - - return (0); -} -#endif /* defined(T32) || defined(COMPAT_LINUX) */ diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index f0a128729de..92a615f2d56 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.82 2013/08/13 05:52:24 guenther Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.83 2013/09/14 01:35:01 guenther Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -719,145 +719,6 @@ done: return (error); } -#ifdef T32 -int -t32_sys_select(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_select_args /* { - syscallarg(int) nd; - syscallarg(fd_set *) in; - syscallarg(fd_set *) ou; - syscallarg(fd_set *) ex; - syscallarg(struct timeval32 *) tv; - } */ *uap = v; - fd_mask bits[6]; - fd_set *pibits[3], *pobits[3]; - struct timeval32 atv32; - struct timeval atv, rtv, ttv; - int s, ncoll, error = 0, timo; - u_int nd, ni; - - nd = SCARG(uap, nd); - if (nd > p->p_fd->fd_nfiles) { - /* forgiving; slightly wrong */ - nd = p->p_fd->fd_nfiles; - } - ni = howmany(nd, NFDBITS) * sizeof(fd_mask); - if (ni > sizeof(bits[0])) { - caddr_t mbits; - - mbits = malloc(ni * 6, M_TEMP, M_WAITOK|M_ZERO); - pibits[0] = (fd_set *)&mbits[ni * 0]; - pibits[1] = (fd_set *)&mbits[ni * 1]; - pibits[2] = (fd_set *)&mbits[ni * 2]; - pobits[0] = (fd_set *)&mbits[ni * 3]; - pobits[1] = (fd_set *)&mbits[ni * 4]; - pobits[2] = (fd_set *)&mbits[ni * 5]; - } else { - bzero(bits, sizeof(bits)); - pibits[0] = (fd_set *)&bits[0]; - pibits[1] = (fd_set *)&bits[1]; - pibits[2] = (fd_set *)&bits[2]; - pobits[0] = (fd_set *)&bits[3]; - pobits[1] = (fd_set *)&bits[4]; - pobits[2] = (fd_set *)&bits[5]; - } - -#define getbits(name, x) \ - if (SCARG(uap, name) && (error = copyin(SCARG(uap, name), \ - pibits[x], ni))) \ - goto done; - getbits(in, 0); - getbits(ou, 1); - getbits(ex, 2); -#undef getbits -#ifdef KTRACE - if (ni > 0 && KTRPOINT(p, KTR_STRUCT)) { - if (SCARG(uap, in)) ktrfdset(p, pibits[0], ni); - if (SCARG(uap, ou)) ktrfdset(p, pibits[1], ni); - if (SCARG(uap, ex)) ktrfdset(p, pibits[2], ni); - } -#endif - - if (SCARG(uap, tv)) { - error = copyin(SCARG(uap, tv), &atv32, sizeof(atv32)); - if (error) - goto done; - TIMEVAL_FROM_32(&atv, &atv32); -#ifdef KTRACE - if (KTRPOINT(p, KTR_STRUCT)) - ktrreltimeval(p, &atv); -#endif - if (itimerfix(&atv)) { - error = EINVAL; - goto done; - } - getmicrouptime(&rtv); - timeradd(&atv, &rtv, &atv); - } else { - atv.tv_sec = 0; - atv.tv_usec = 0; - } - timo = 0; - -retry: - ncoll = nselcoll; - atomic_setbits_int(&p->p_flag, P_SELECT); - error = selscan(p, pibits[0], pobits[0], nd, ni, retval); - if (error || *retval) - goto done; - if (SCARG(uap, tv)) { - getmicrouptime(&rtv); - if (timercmp(&rtv, &atv, >=)) - goto done; - ttv = atv; - timersub(&ttv, &rtv, &ttv); - timo = ttv.tv_sec > 24 * 60 * 60 ? - 24 * 60 * 60 * hz : tvtohz(&ttv); - } - s = splhigh(); - if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) { - splx(s); - goto retry; - } - atomic_clearbits_int(&p->p_flag, P_SELECT); - error = tsleep(&selwait, PSOCK | PCATCH, "select", timo); - splx(s); - if (error == 0) - goto retry; -done: - atomic_clearbits_int(&p->p_flag, P_SELECT); - /* select is not restarted after signals... */ - if (error == ERESTART) - error = EINTR; - if (error == EWOULDBLOCK) - error = 0; -#define putbits(name, x) \ - if (SCARG(uap, name) && (error2 = copyout(pobits[x], \ - SCARG(uap, name), ni))) \ - error = error2; - if (error == 0) { - int error2; - - putbits(in, 0); - putbits(ou, 1); - putbits(ex, 2); -#undef putbits -#ifdef KTRACE - if (ni > 0 && KTRPOINT(p, KTR_STRUCT)) { - if (SCARG(uap, in)) ktrfdset(p, pobits[0], ni); - if (SCARG(uap, ou)) ktrfdset(p, pobits[1], ni); - if (SCARG(uap, ex)) ktrfdset(p, pobits[2], ni); - } -#endif - } - - if (pibits[0] != (fd_set *)&bits[0]) - free(pibits[0], M_TEMP); - return (error); -} -#endif - int selscan(struct proc *p, fd_set *ibits, fd_set *obits, int nfd, int ni, register_t *retval) diff --git a/sys/kern/syscalls.conf b/sys/kern/syscalls.conf index 1d1f7a45cf7..ed8e1713906 100644 --- a/sys/kern/syscalls.conf +++ b/sys/kern/syscalls.conf @@ -1,4 +1,4 @@ -# $OpenBSD: syscalls.conf,v 1.19 2013/08/14 05:26:14 guenther Exp $ +# $OpenBSD: syscalls.conf,v 1.20 2013/09/14 01:35:01 guenther Exp $ # $NetBSD: syscalls.conf,v 1.2 1994/10/26 06:45:57 cgd Exp $ sysnames="syscalls.c" @@ -9,7 +9,7 @@ sysarghdr="../sys/syscallargs.h" # Any additions to the next line for options that are required for the # (new) kernel to boot an existing userland must be coordinated with # the snapshot builders -compatopts="t32" +compatopts="" libcompatopts="" switchname="sysent" diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index ef4e01b5d5f..73b8af0dca2 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ -; $OpenBSD: syscalls.master,v 1.136 2013/08/16 08:33:20 guenther Exp $ +; $OpenBSD: syscalls.master,v 1.137 2013/09/14 01:35:01 guenther Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -57,8 +57,7 @@ 5 STD { int sys_open(const char *path, \ int flags, ... mode_t mode); } 6 STD { int sys_close(int fd); } -7 T32 { pid_t sys_wait4(pid_t pid, int *status, \ - int options, struct rusage32 *rusage); } +7 OBSOL t32_wait4 8 STD { int sys___tfork(const struct __tfork *param, \ size_t psize); } 9 STD { int sys_link(const char *path, const char *link); } @@ -188,15 +187,12 @@ const gid_t *gidset); } 81 STD { int sys_getpgrp(void); } 82 STD { int sys_setpgid(pid_t pid, int pgid); } -83 T32 { int sys_setitimer(int which, \ - const struct itimerval32 *itv, \ - struct itimerval32 *oitv); } +83 OBSOL t32_setitimer 84 STD { int sys_utimensat(int fd, const char *path, \ const struct timespec *times, int flag); } 85 STD { int sys_futimens(int fd, \ const struct timespec *times); } -86 T32 { int sys_getitimer(int which, \ - struct itimerval32 *itv); } +86 OBSOL t32_getitimer 87 STD NOLOCK { int sys_clock_gettime(clockid_t clock_id, \ struct timespec *tp); } 88 STD { int sys_clock_settime(clockid_t clock_id, \ @@ -207,8 +203,7 @@ 91 STD NOLOCK { int sys_nanosleep(const struct timespec *rqtp, \ struct timespec *rmtp); } 92 STD { int sys_fcntl(int fd, int cmd, ... void *arg); } -93 T32 { int sys_select(int nd, fd_set *in, fd_set *ou, \ - fd_set *ex, struct timeval32 *tv); } +93 OBSOL t32_select 94 STD { int sys___thrsleep(const volatile void *ident, \ clockid_t clock_id, const struct timespec *tp, \ void *lock, const int *abort); } @@ -240,10 +235,8 @@ 113 OBSOL orecvmsg 114 OBSOL osendmsg 115 OBSOL vtrace -116 T32 NOLOCK { int sys_gettimeofday(struct timeval32 *tp, \ - struct timezone *tzp); } -117 T32 { int sys_getrusage(int who, \ - struct rusage32 *rusage); } +116 OBSOL t32_gettimeofday +117 OBSOL t32_getrusage 118 STD { int sys_getsockopt(int s, int level, int name, \ void *val, socklen_t *avalsize); } 119 OBSOL resuba @@ -251,8 +244,7 @@ const struct iovec *iovp, int iovcnt); } 121 STD { ssize_t sys_writev(int fd, \ const struct iovec *iovp, int iovcnt); } -122 T32 { int sys_settimeofday(const struct timeval32 *tv, \ - const struct timezone *tzp); } +122 OBSOL t32_settimeofday 123 STD { int sys_fchown(int fd, uid_t uid, gid_t gid); } 124 STD { int sys_fchmod(int fd, mode_t mode); } 125 OBSOL orecvfrom @@ -271,8 +263,7 @@ int protocol, int *rsv); } 136 STD { int sys_mkdir(const char *path, mode_t mode); } 137 STD { int sys_rmdir(const char *path); } -138 T32 { int sys_utimes(const char *path, \ - const struct timeval32 *tptr); } +138 OBSOL t32_utimes 139 OBSOL 4.2 sigreturn 140 STD { int sys_adjtime(const struct timeval *delta, \ struct timeval *olddelta); } @@ -362,8 +353,7 @@ 203 STD { int sys_mlock(const void *addr, size_t len); } 204 STD { int sys_munlock(const void *addr, size_t len); } 205 UNIMPL sys_undelete -206 T32 { int sys_futimes(int fd, \ - const struct timeval32 *tptr); } +206 OBSOL t32_futimes 207 STD { pid_t sys_getpgid(pid_t pid); } 208 OBSOL nnpfspioctl 209 STD { int sys_utrace(const char *label, const void *addr, \ @@ -428,12 +418,9 @@ 230 UNIMPL shmdt #endif 231 OBSOL shmget35 -232 T32 NOLOCK { int sys_clock_gettime(clockid_t clock_id, \ - struct timespec32 *tp); } -233 T32 { int sys_clock_settime(clockid_t clock_id, \ - const struct timespec32 *tp); } -234 T32 NOLOCK { int sys_clock_getres(clockid_t clock_id, \ - struct timespec32 *tp); } +232 OBSOL t32_clock_gettime +233 OBSOL t32_clock_settime +234 OBSOL t32_clock_getres 235 UNIMPL timer_create 236 UNIMPL timer_delete 237 UNIMPL timer_settime @@ -442,8 +429,7 @@ ; ; System calls 240-249 are reserved for other IEEE Std1003.1b syscalls ; -240 T32 NOLOCK { int sys_nanosleep(const struct timespec32 *rqtp, \ - struct timespec32 *rmtp); } +240 OBSOL t32_nanosleep 241 UNIMPL 242 UNIMPL 243 UNIMPL @@ -479,10 +465,7 @@ const struct iovec *iovp, int iovcnt, \ int pad, off_t offset); } 269 STD { int sys_kqueue(void); } -270 T32 { int sys_kevent(int fd, \ - const struct kevent32 *changelist, int nchanges, \ - struct kevent32 *eventlist, int nevents, \ - const struct timespec32 *timeout); } +270 OBSOL t32_kevent 271 STD { int sys_mlockall(int flags); } 272 STD { int sys_munlockall(void); } 273 UNIMPL sys_getpeereid @@ -518,9 +501,9 @@ #else 290 UNIMPL semop #endif -291 T32 { int sys_stat(const char *path, struct stat32 *ub); } -292 T32 { int sys_fstat(int fd, struct stat32 *sb); } -293 T32 { int sys_lstat(const char *path, struct stat32 *ub); } +291 OBSOL t32_stat +292 OBSOL t32_fstat +293 OBSOL t32_lstat 294 STD { int sys_fhstat(const fhandle_t *fhp, \ struct stat *sb); } #ifdef SYSVSEM @@ -543,9 +526,7 @@ #endif 298 STD NOLOCK { int sys_sched_yield(void); } 299 STD NOLOCK { pid_t sys_getthrid(void); } -300 T32 { int sys___thrsleep(const volatile void *ident, \ - clockid_t clock_id, const struct timespec32 *tp, \ - void *lock, const int *abort); } +300 OBSOL t32___thrsleep 301 STD { int sys___thrwakeup(const volatile void *ident, \ int n); } 302 STD { void sys___threxit(pid_t *notdead); } @@ -560,16 +541,14 @@ 309 OBSOL fhstatfs53 310 STD { int sys_setrtable(int rtableid); } 311 STD { int sys_getrtable(void); } -312 T32 { int sys_getdirentries(int fd, char *buf, \ - int count, off_t *basep); } +312 OBSOL t32_getdirentries 313 STD { int sys_faccessat(int fd, const char *path, \ int amode, int flag); } 314 STD { int sys_fchmodat(int fd, const char *path, \ mode_t mode, int flag); } 315 STD { int sys_fchownat(int fd, const char *path, \ uid_t uid, gid_t gid, int flag); } -316 T32 { int sys_fstatat(int fd, const char *path, \ - struct stat32 *buf, int flag); } +316 OBSOL t32_fstatat 317 STD { int sys_linkat(int fd1, const char *path1, int fd2, \ const char *path2, int flag); } 318 STD { int sys_mkdirat(int fd, const char *path, \ @@ -588,10 +567,8 @@ const char *link); } 325 STD { int sys_unlinkat(int fd, const char *path, \ int flag); } -326 T32 { int sys_utimensat(int fd, const char *path, \ - const struct timespec32 *times, int flag); } -327 T32 { int sys_futimens(int fd, \ - const struct timespec32 *times); } +326 OBSOL t32_utimensat +327 OBSOL t32_futimens 328 OBSOL __tfork51 329 STD NOLOCK { void sys___set_tcb(void *tcb); } 330 STD NOLOCK { void *sys___get_tcb(void); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index b142907a2e4..4de9dcd17a6 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.197 2013/08/16 08:33:20 guenther Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.198 2013/09/14 01:35:01 guenther Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -2985,249 +2985,3 @@ sys_pwritev(struct proc *p, void *v, register_t *retval) 1, &offset, retval)); } -#ifdef T32 -int copyout_stat32(struct stat *, void *, struct proc *); -int dofstatat32(struct proc *, int, const char *, struct stat32 *, int); - -int -dofstatat32(struct proc *p, int fd, const char *path, struct stat32 *buf, - int flag) -{ - struct stat sb; - int error, follow; - struct nameidata nd; - - if (flag & ~AT_SYMLINK_NOFOLLOW) - return (EINVAL); - - follow = (flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; - NDINITAT(&nd, LOOKUP, follow | LOCKLEAF, UIO_USERSPACE, fd, path, p); - if ((error = namei(&nd)) != 0) - return (error); - error = vn_stat(nd.ni_vp, &sb, p); - vput(nd.ni_vp); - if (error) - return (error); - return (copyout_stat32(&sb, buf, p)); -} - -int -t32_sys_stat(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_stat_args /* { - syscallarg(const char *) path; - syscallarg(struct stat32 *) ub; - } */ *uap = v; - - return (dofstatat32(p, AT_FDCWD, SCARG(uap, path), SCARG(uap, ub), 0)); -} - -int -copyout_stat32(struct stat *sp, void *uaddr, struct proc *p) -{ - struct stat32 sb32; - int error; - - STAT_TO_32(&sb32, sp); - - /* Don't let non-root see generation numbers (for NFS security) */ - if (suser(p, 0)) - sb32.st_gen = 0; - error = copyout(&sb32, uaddr, sizeof(sb32)); -#ifdef KTRACE - if (error == 0 && KTRPOINT(p, KTR_STRUCT)) - ktrstat(p, sp); -#endif - return (error); -} - -int -t32_sys_fstatat(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_fstatat_args /* { - syscallarg(int) fd; - syscallarg(const char *) path; - syscallarg(struct stat32 *) buf; - syscallarg(int) flag; - } */ *uap = v; - - return (dofstatat32(p, SCARG(uap, fd), SCARG(uap, path), - SCARG(uap, buf), SCARG(uap, flag))); -} - -int -t32_sys_lstat(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_lstat_args /* { - syscallarg(const char *) path; - syscallarg(struct stat32 *) ub; - } */ *uap = v; - - return (dofstatat32(p, AT_FDCWD, SCARG(uap, path), SCARG(uap, ub), - AT_SYMLINK_NOFOLLOW)); -} - -/* ARGSUSED */ -int -t32_sys_utimes(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_utimes_args /* { - syscallarg(const char *) path; - syscallarg(const struct timeval32 *) tptr; - } */ *uap = v; - - struct timespec ts[2]; - struct timeval32 tv[2]; - const struct timeval32 *tvp; - int error; - - tvp = SCARG(uap, tptr); - if (tvp != NULL) { - error = copyin(tvp, tv, sizeof(tv)); - if (error) - return (error); - TIMESPEC_FROM_TIMEVAL32(&ts[0], &tv[0]); - TIMESPEC_FROM_TIMEVAL32(&ts[1], &tv[1]); - } else - ts[0].tv_nsec = ts[1].tv_nsec = UTIME_NOW; - - return (doutimensat(p, AT_FDCWD, SCARG(uap, path), ts, 0)); -} - -int -t32_sys_utimensat(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_utimensat_args /* { - syscallarg(int) fd; - syscallarg(const char *) path; - syscallarg(const struct timespec32 *) times; - syscallarg(int) flag; - } */ *uap = v; - - struct timespec ts[2]; - struct timespec32 ts32[2]; - const struct timespec32 *tsp; - int error; - - tsp = SCARG(uap, times); - if (tsp != NULL) { - error = copyin(tsp, ts32, sizeof(ts32)); - if (error) - return (error); - TIMESPEC_FROM_32(&ts[0], &ts32[0]); - TIMESPEC_FROM_32(&ts[1], &ts32[1]); - } else - ts[0].tv_nsec = ts[1].tv_nsec = UTIME_NOW; - - return (doutimensat(p, SCARG(uap, fd), SCARG(uap, path), ts, - SCARG(uap, flag))); -} - -/* ARGSUSED */ -int -t32_sys_futimes(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_futimes_args /* { - syscallarg(int) fd; - syscallarg(const struct timeval32 *) tptr; - } */ *uap = v; - struct timeval32 tv[2]; - struct timespec ts[2]; - const struct timeval32 *tvp; - int error; - - tvp = SCARG(uap, tptr); - if (tvp != NULL) { - error = copyin(tvp, tv, sizeof(tv)); - if (error) - return (error); - TIMESPEC_FROM_TIMEVAL32(&ts[0], &tv[0]); - TIMESPEC_FROM_TIMEVAL32(&ts[1], &tv[1]); - } else - ts[0].tv_nsec = ts[1].tv_nsec = UTIME_NOW; - - return (dofutimens(p, SCARG(uap, fd), ts)); -} - -int -t32_sys_futimens(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_futimens_args /* { - syscallarg(int) fd; - syscallarg(const struct timespec32 *) times; - } */ *uap = v; - struct timespec ts[2]; - struct timespec32 ts32[2]; - const struct timespec32 *tsp; - int error; - - tsp = SCARG(uap, times); - if (tsp != NULL) { - error = copyin(tsp, ts32, sizeof(ts32)); - if (error) - return (error); - TIMESPEC_FROM_32(&ts[0], &ts32[0]); - TIMESPEC_FROM_32(&ts[1], &ts32[1]); - } else - ts[0].tv_nsec = ts[1].tv_nsec = UTIME_NOW; - - return (dofutimens(p, SCARG(uap, fd), ts)); -} - -int -t32_sys_getdirentries(struct proc *p, void *v, register_t *retval) -{ - struct t32_sys_getdirentries_args /* { - syscallarg(int) fd; - syscallarg(char *) buf; - syscallarg(int) count; - syscallarg(off_t *) basep; - } */ *uap = v; - struct vnode *vp; - struct file *fp; - struct uio auio; - struct iovec aiov; - off_t off; - int error, count, eofflag; - - count = SCARG(uap, count); - if (count < 0) - return EINVAL; - if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) - return (error); - if ((fp->f_flag & FREAD) == 0) { - error = EBADF; - goto bad; - } - if (fp->f_offset < 0) { - error = EINVAL; - goto bad; - } - vp = fp->f_data; - if (vp->v_type != VDIR) { - error = EINVAL; - goto bad; - } - aiov.iov_base = SCARG(uap, buf); - aiov.iov_len = count; - auio.uio_iov = &aiov; - auio.uio_iovcnt = 1; - auio.uio_rw = UIO_READ; - auio.uio_segflg = UIO_USERSPACE | 0x10; /* XXX */ - auio.uio_procp = p; - auio.uio_resid = count; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - off = auio.uio_offset = fp->f_offset; - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag); - fp->f_offset = auio.uio_offset; - VOP_UNLOCK(vp, 0, p); - if (error) - goto bad; - *retval = count - auio.uio_resid; -bad: - FRELE(fp, p); - if (!error) - error = copyout(&off, SCARG(uap, basep), sizeof(off_t)); - return (error); -} -#endif |