Date: Sat, 15 Oct 2005 16:38:10 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 85345 for review Message-ID: <200510151638.j9FGcA7b065507@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=85345 Change 85345 by bz@bz_y2k_i386 on 2005/10/15 16:37:24 IFC setkey now lives in sbin and no longer in usr.sbin Affected files ... .. //depot/projects/fast_ipsec/src/sbin/setkey/Makefile#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/parse.y#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/sample.cf#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/scriptdump.pl#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/setkey.8#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/setkey.c#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/test-pfkey.c#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/test-policy.c#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/token.l#1 branch .. //depot/projects/fast_ipsec/src/sbin/setkey/vchar.h#1 branch .. //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_misc.c#3 integrate .. //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_proto.h#3 integrate .. //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_syscall.h#3 integrate .. //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_syscalls.c#3 integrate .. //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_sysent.c#3 integrate .. //depot/projects/fast_ipsec/src/sys/compat/freebsd32/syscalls.master#3 integrate .. //depot/projects/fast_ipsec/src/sys/kern/kern_time.c#2 integrate .. //depot/projects/fast_ipsec/src/sys/kern/uipc_syscalls.c#2 integrate .. //depot/projects/fast_ipsec/src/sys/netinet6/raw_ip6.c#2 integrate .. //depot/projects/fast_ipsec/src/sys/sparc64/sparc64/trap.c#3 integrate .. //depot/projects/fast_ipsec/src/sys/sys/syscallsubr.h#2 integrate Differences ... ==== //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_misc.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.40 2005/10/03 18:34:17 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.43 2005/10/15 05:57:06 ps Exp $"); #include "opt_compat.h" @@ -797,6 +797,171 @@ return (error); } +static int +freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt, struct iovec **iov, + int error) +{ + struct iovec32 iov32; + int i; + + u_int iovlen; + + *iov = NULL; + if (iovcnt > UIO_MAXIOV) + return (error); + iovlen = iovcnt * sizeof(struct iovec); + *iov = malloc(iovlen, M_IOV, M_WAITOK); + for (i = 0; i < iovcnt; i++) { + error = copyin(&iovp[i], &iov32, sizeof(struct iovec32)); + if (error) { + free(*iov, M_IOV); + *iov = NULL; + return (error); + } + iov[i]->iov_base = PTRIN(iov32.iov_base); + iov[i]->iov_len = iov32.iov_len; + } + return (0); +} + +struct msghdr32 { + u_int32_t msg_name; + socklen_t msg_namelen; + u_int32_t msg_iov; + int msg_iovlen; + u_int32_t msg_control; + socklen_t msg_controllen; + int msg_flags; +}; +CTASSERT(sizeof(struct msghdr32) == 28); + +static int +freebsd32_copyinmsghdr(struct msghdr32 *msg32, struct msghdr *msg) +{ + struct msghdr32 m32; + int error; + + error = copyin(msg32, &m32, sizeof(m32)); + if (error) + return (error); + msg->msg_name = PTRIN(m32.msg_name); + msg->msg_namelen = m32.msg_namelen; + msg->msg_iov = PTRIN(m32.msg_iov); + msg->msg_iovlen = m32.msg_iovlen; + msg->msg_control = PTRIN(m32.msg_control); + msg->msg_controllen = m32.msg_controllen; + msg->msg_flags = m32.msg_flags; + return (freebsd32_copyiniov((struct iovec32 *)(uintptr_t)m32.msg_iov, m32.msg_iovlen, &msg->msg_iov, + EMSGSIZE)); +} + +static int +freebsd32_copyoutmsghdr(struct msghdr *msg, struct msghdr32 *msg32) +{ + struct msghdr32 m32; + int error; + + m32.msg_name = PTROUT(msg->msg_name); + m32.msg_namelen = msg->msg_namelen; + m32.msg_iov = PTROUT(msg->msg_iov); + m32.msg_iovlen = msg->msg_iovlen; + m32.msg_control = PTROUT(msg->msg_control); + m32.msg_controllen = msg->msg_controllen; + m32.msg_flags = msg->msg_flags; + error = copyout(&m32, msg32, sizeof(m32)); + return (error); +} + +int +freebsd32_recvmsg(td, uap) + struct thread *td; + struct freebsd32_recvmsg_args /* { + int s; + struct msghdr32 *msg; + int flags; + } */ *uap; +{ + struct msghdr msg; + struct msghdr32 m32; + struct iovec *uiov, *iov; + int error; + + error = copyin(uap->msg, &m32, sizeof(m32)); + if (error) + return (error); + error = freebsd32_copyinmsghdr(uap->msg, &msg); + if (error) + return (error); + error = freebsd32_copyiniov((struct iovec32 *)(uintptr_t)m32.msg_iov, + m32.msg_iovlen, &iov, EMSGSIZE); + if (error) + return (error); + msg.msg_flags = uap->flags; + uiov = msg.msg_iov; + msg.msg_iov = iov; + error = kern_recvit(td, uap->s, &msg, NULL, UIO_SYSSPACE); + if (error == 0) { + msg.msg_iov = uiov; + error = freebsd32_copyoutmsghdr(&msg, uap->msg); + } + free(iov, M_IOV); + free(uiov, M_IOV); + return (error); +} + +int +freebsd32_sendmsg(struct thread *td, + struct freebsd32_sendmsg_args *uap) +{ + struct msghdr msg; + struct msghdr32 m32; + struct iovec *iov; + int error; + + error = copyin(uap->msg, &m32, sizeof(m32)); + if (error) + return (error); + error = freebsd32_copyinmsghdr(uap->msg, &msg); + if (error) + return (error); + error = freebsd32_copyiniov((struct iovec32 *)(uintptr_t)m32.msg_iov, + m32.msg_iovlen, &iov, EMSGSIZE); + if (error) + return (error); + msg.msg_iov = iov; + error = kern_sendit(td, uap->s, &msg, uap->flags, NULL, UIO_SYSSPACE); + free(iov, M_IOV); + return (error); +} + +int +freebsd32_recvfrom(struct thread *td, + struct freebsd32_recvfrom_args *uap) +{ + struct msghdr msg; + struct iovec aiov; + int error; + + if (uap->fromlenaddr) { + error = copyin((void *)(uintptr_t)uap->fromlenaddr, + &msg.msg_namelen, sizeof(msg.msg_namelen)); + if (error) + return (error); + } else { + msg.msg_namelen = 0; + } + + msg.msg_name = (void *)(uintptr_t)uap->from; + msg.msg_iov = &aiov; + msg.msg_iovlen = 1; + aiov.iov_base = (void *)(uintptr_t)uap->buf; + aiov.iov_len = uap->len; + msg.msg_control = 0; + msg.msg_flags = uap->flags; + error = kern_recvit(td, uap->s, &msg, (void *)(uintptr_t)uap->fromlenaddr, UIO_USERSPACE); + return (error); +} + int freebsd32_settimeofday(struct thread *td, struct freebsd32_settimeofday_args *uap) @@ -1236,7 +1401,7 @@ struct timespec rmt, rqt; int error; - error = copyin(uap->rqtp, &rqt32, sizeof(rqt)); + error = copyin(uap->rqtp, &rqt32, sizeof(rqt32)); if (error) return (error); @@ -1253,13 +1418,66 @@ CP(rmt, rmt32, tv_sec); CP(rmt, rmt32, tv_nsec); - error2 = copyout(&rmt32, uap->rmtp, sizeof(rmt)); + error2 = copyout(&rmt32, uap->rmtp, sizeof(rmt32)); if (error2) error = error2; } return (error); } +int +freebsd32_clock_gettime(struct thread *td, + struct freebsd32_clock_gettime_args *uap) +{ + struct timespec ats; + struct timespec32 ats32; + int error; + + error = kern_clock_gettime(td, uap->clock_id, &ats); + if (error == 0) { + CP(ats, ats32, tv_sec); + CP(ats, ats32, tv_nsec); + error = copyout(&ats32, uap->tp, sizeof(ats32)); + } + return (error); +} + +int +freebsd32_clock_settime(struct thread *td, + struct freebsd32_clock_settime_args *uap) +{ + struct timespec ats; + struct timespec32 ats32; + int error; + + error = copyin(uap->tp, &ats32, sizeof(ats32)); + if (error) + return (error); + CP(ats32, ats, tv_sec); + CP(ats32, ats, tv_nsec); + + return (kern_clock_settime(td, uap->clock_id, &ats)); +} + +int +freebsd32_clock_getres(struct thread *td, + struct freebsd32_clock_getres_args *uap) +{ + struct timespec ts; + struct timespec32 ts32; + int error; + + if (uap->tp == NULL) + return (0); + error = kern_clock_getres(td, uap->clock_id, &ts); + if (error == 0) { + CP(ts, ts32, tv_sec); + CP(ts, ts32, tv_nsec); + error = copyout(&ts32, uap->tp, sizeof(ts32)); + } + return (error); +} + #if 0 int ==== //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_proto.h#3 (text+ko) ==== @@ -2,8 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.40 2005/09/27 18:04:52 peter Exp $ - * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.52 2005/09/27 18:04:20 peter Exp + * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.43 2005/10/15 05:57:34 ps Exp $ + * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.55 2005/10/15 05:57:06 ps Exp */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -38,6 +38,24 @@ char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)]; char rusage_l_[PADL_(struct rusage32 *)]; struct rusage32 * rusage; char rusage_r_[PADR_(struct rusage32 *)]; }; +struct freebsd32_recvmsg_args { + char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; + char msg_l_[PADL_(struct msghdr32 *)]; struct msghdr32 * msg; char msg_r_[PADR_(struct msghdr32 *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; +struct freebsd32_sendmsg_args { + char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; + char msg_l_[PADL_(struct msghdr32 *)]; struct msghdr32 * msg; char msg_r_[PADR_(struct msghdr32 *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; +struct freebsd32_recvfrom_args { + char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; + char buf_l_[PADL_(u_int32_t)]; u_int32_t buf; char buf_r_[PADR_(u_int32_t)]; + char len_l_[PADL_(u_int32_t)]; u_int32_t len; char len_r_[PADR_(u_int32_t)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char from_l_[PADL_(u_int32_t)]; u_int32_t from; char from_r_[PADR_(u_int32_t)]; + char fromlenaddr_l_[PADL_(u_int32_t)]; u_int32_t fromlenaddr; char fromlenaddr_r_[PADR_(u_int32_t)]; +}; struct freebsd32_sigaltstack_args { char ss_l_[PADL_(struct sigaltstack32 *)]; struct sigaltstack32 * ss; char ss_r_[PADR_(struct sigaltstack32 *)]; char oss_l_[PADL_(struct sigaltstack32 *)]; struct sigaltstack32 * oss; char oss_r_[PADR_(struct sigaltstack32 *)]; @@ -179,9 +197,21 @@ char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)]; char newlen_l_[PADL_(u_int32_t)]; u_int32_t newlen; char newlen_r_[PADR_(u_int32_t)]; }; +struct freebsd32_clock_gettime_args { + char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(struct timespec32 *)]; struct timespec32 * tp; char tp_r_[PADR_(struct timespec32 *)]; +}; +struct freebsd32_clock_settime_args { + char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * tp; char tp_r_[PADR_(const struct timespec32 *)]; +}; +struct freebsd32_clock_getres_args { + char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(struct timespec32 *)]; struct timespec32 * tp; char tp_r_[PADR_(struct timespec32 *)]; +}; struct freebsd32_nanosleep_args { - char rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)]; - char rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)]; + char rqtp_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * rqtp; char rqtp_r_[PADR_(const struct timespec32 *)]; + char rmtp_l_[PADL_(struct timespec32 *)]; struct timespec32 * rmtp; char rmtp_r_[PADR_(struct timespec32 *)]; }; struct freebsd32_preadv_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; @@ -236,6 +266,9 @@ char ucp_l_[PADL_(const struct freebsd32_ucontext *)]; const struct freebsd32_ucontext * ucp; char ucp_r_[PADR_(const struct freebsd32_ucontext *)]; }; int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); +int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *); +int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *); +int freebsd32_recvfrom(struct thread *, struct freebsd32_recvfrom_args *); int freebsd32_sigaltstack(struct thread *, struct freebsd32_sigaltstack_args *); int freebsd32_execve(struct thread *, struct freebsd32_execve_args *); int freebsd32_setitimer(struct thread *, struct freebsd32_setitimer_args *); @@ -261,6 +294,9 @@ int freebsd32_truncate(struct thread *, struct freebsd32_truncate_args *); int freebsd32_ftruncate(struct thread *, struct freebsd32_ftruncate_args *); int freebsd32_sysctl(struct thread *, struct freebsd32_sysctl_args *); +int freebsd32_clock_gettime(struct thread *, struct freebsd32_clock_gettime_args *); +int freebsd32_clock_settime(struct thread *, struct freebsd32_clock_settime_args *); +int freebsd32_clock_getres(struct thread *, struct freebsd32_clock_getres_args *); int freebsd32_nanosleep(struct thread *, struct freebsd32_nanosleep_args *); int freebsd32_preadv(struct thread *, struct freebsd32_preadv_args *); int freebsd32_pwritev(struct thread *, struct freebsd32_pwritev_args *); ==== //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_syscall.h#3 (text+ko) ==== @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.40 2005/09/27 18:04:52 peter Exp $ - * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.52 2005/09/27 18:04:20 peter Exp + * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.43 2005/10/15 05:57:34 ps Exp $ + * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.55 2005/10/15 05:57:06 ps Exp */ #define FREEBSD32_SYS_syscall 0 @@ -33,8 +33,9 @@ #define FREEBSD32_SYS_getuid 24 #define FREEBSD32_SYS_geteuid 25 #define FREEBSD32_SYS_ptrace 26 -#define FREEBSD32_SYS_sendmsg 28 -#define FREEBSD32_SYS_recvfrom 29 +#define FREEBSD32_SYS_freebsd32_recvmsg 27 +#define FREEBSD32_SYS_freebsd32_sendmsg 28 +#define FREEBSD32_SYS_freebsd32_recvfrom 29 #define FREEBSD32_SYS_accept 30 #define FREEBSD32_SYS_getpeername 31 #define FREEBSD32_SYS_getsockname 32 @@ -198,9 +199,9 @@ #define FREEBSD32_SYS_shmctl 229 #define FREEBSD32_SYS_shmdt 230 #define FREEBSD32_SYS_shmget 231 -#define FREEBSD32_SYS_clock_gettime 232 -#define FREEBSD32_SYS_clock_settime 233 -#define FREEBSD32_SYS_clock_getres 234 +#define FREEBSD32_SYS_freebsd32_clock_gettime 232 +#define FREEBSD32_SYS_freebsd32_clock_settime 233 +#define FREEBSD32_SYS_freebsd32_clock_getres 234 #define FREEBSD32_SYS_freebsd32_nanosleep 240 #define FREEBSD32_SYS_minherit 250 #define FREEBSD32_SYS_rfork 251 ==== //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_syscalls.c#3 (text+ko) ==== @@ -2,8 +2,8 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.31 2005/09/27 18:04:52 peter Exp $ - * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.52 2005/09/27 18:04:20 peter Exp + * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.34 2005/10/15 05:57:34 ps Exp $ + * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.55 2005/10/15 05:57:06 ps Exp */ const char *freebsd32_syscallnames[] = { @@ -34,9 +34,9 @@ "getuid", /* 24 = getuid */ "geteuid", /* 25 = geteuid */ "ptrace", /* 26 = ptrace */ - "#27", /* 27 = recvmsg */ - "sendmsg", /* 28 = sendmsg */ - "recvfrom", /* 29 = recvfrom */ + "freebsd32_recvmsg", /* 27 = freebsd32_recvmsg */ + "freebsd32_sendmsg", /* 28 = freebsd32_sendmsg */ + "freebsd32_recvfrom", /* 29 = freebsd32_recvfrom */ "accept", /* 30 = accept */ "getpeername", /* 31 = getpeername */ "getsockname", /* 32 = getsockname */ @@ -239,9 +239,9 @@ "shmctl", /* 229 = shmctl */ "shmdt", /* 230 = shmdt */ "shmget", /* 231 = shmget */ - "clock_gettime", /* 232 = clock_gettime */ - "clock_settime", /* 233 = clock_settime */ - "clock_getres", /* 234 = clock_getres */ + "freebsd32_clock_gettime", /* 232 = freebsd32_clock_gettime */ + "freebsd32_clock_settime", /* 233 = freebsd32_clock_settime */ + "freebsd32_clock_getres", /* 234 = freebsd32_clock_getres */ "#235", /* 235 = timer_create */ "#236", /* 236 = timer_delete */ "#237", /* 237 = timer_settime */ ==== //depot/projects/fast_ipsec/src/sys/compat/freebsd32/freebsd32_sysent.c#3 (text+ko) ==== @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.41 2005/09/27 18:04:52 peter Exp $ - * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.52 2005/09/27 18:04:20 peter Exp + * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.44 2005/10/15 05:57:34 ps Exp $ + * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.55 2005/10/15 05:57:06 ps Exp */ #include "opt_compat.h" @@ -53,9 +53,9 @@ { SYF_MPSAFE | 0, (sy_call_t *)getuid, AUE_NULL }, /* 24 = getuid */ { SYF_MPSAFE | 0, (sy_call_t *)geteuid, AUE_NULL }, /* 25 = geteuid */ { SYF_MPSAFE | AS(ptrace_args), (sy_call_t *)ptrace, AUE_NULL }, /* 26 = ptrace */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 27 = recvmsg */ - { SYF_MPSAFE | AS(sendmsg_args), (sy_call_t *)sendmsg, AUE_NULL }, /* 28 = sendmsg */ - { SYF_MPSAFE | AS(recvfrom_args), (sy_call_t *)recvfrom, AUE_NULL }, /* 29 = recvfrom */ + { SYF_MPSAFE | AS(freebsd32_recvmsg_args), (sy_call_t *)freebsd32_recvmsg, AUE_NULL }, /* 27 = freebsd32_recvmsg */ + { SYF_MPSAFE | AS(freebsd32_sendmsg_args), (sy_call_t *)freebsd32_sendmsg, AUE_NULL }, /* 28 = freebsd32_sendmsg */ + { SYF_MPSAFE | AS(freebsd32_recvfrom_args), (sy_call_t *)freebsd32_recvfrom, AUE_NULL }, /* 29 = freebsd32_recvfrom */ { SYF_MPSAFE | AS(accept_args), (sy_call_t *)accept, AUE_NULL }, /* 30 = accept */ { SYF_MPSAFE | AS(getpeername_args), (sy_call_t *)getpeername, AUE_NULL }, /* 31 = getpeername */ { SYF_MPSAFE | AS(getsockname_args), (sy_call_t *)getsockname, AUE_NULL }, /* 32 = getsockname */ @@ -258,9 +258,9 @@ { SYF_MPSAFE | AS(shmctl_args), (sy_call_t *)shmctl, AUE_NULL }, /* 229 = shmctl */ { SYF_MPSAFE | AS(shmdt_args), (sy_call_t *)shmdt, AUE_NULL }, /* 230 = shmdt */ { SYF_MPSAFE | AS(shmget_args), (sy_call_t *)shmget, AUE_NULL }, /* 231 = shmget */ - { SYF_MPSAFE | AS(clock_gettime_args), (sy_call_t *)clock_gettime, AUE_NULL }, /* 232 = clock_gettime */ - { SYF_MPSAFE | AS(clock_settime_args), (sy_call_t *)clock_settime, AUE_NULL }, /* 233 = clock_settime */ - { SYF_MPSAFE | AS(clock_getres_args), (sy_call_t *)clock_getres, AUE_NULL }, /* 234 = clock_getres */ + { SYF_MPSAFE | AS(freebsd32_clock_gettime_args), (sy_call_t *)freebsd32_clock_gettime, AUE_NULL }, /* 232 = freebsd32_clock_gettime */ + { SYF_MPSAFE | AS(freebsd32_clock_settime_args), (sy_call_t *)freebsd32_clock_settime, AUE_NULL }, /* 233 = freebsd32_clock_settime */ + { SYF_MPSAFE | AS(freebsd32_clock_getres_args), (sy_call_t *)freebsd32_clock_getres, AUE_NULL }, /* 234 = freebsd32_clock_getres */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 235 = timer_create */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 236 = timer_delete */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 237 = timer_settime */ ==== //depot/projects/fast_ipsec/src/sys/compat/freebsd32/syscalls.master#3 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.52 2005/09/27 18:04:20 peter Exp $ + $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.55 2005/10/15 05:57:06 ps Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; from: src/sys/kern/syscalls.master 1.107 ; @@ -88,12 +88,13 @@ 26 AUE_NULL MNOPROTO { int ptrace(int req, pid_t pid, \ caddr_t addr, int data); } ; XXX implement -27 AUE_NULL UNIMPL recvmsg -28 AUE_NULL MNOPROTO { int sendmsg(int s, caddr_t msg, \ +27 AUE_NULL MSTD { int freebsd32_recvmsg(int s, struct msghdr32 *msg, \ + int flags); } +28 AUE_NULL MSTD { int freebsd32_sendmsg(int s, struct msghdr32 *msg, \ int flags); } -29 AUE_NULL MNOPROTO { int recvfrom(int s, caddr_t buf, \ - size_t len, int flags, caddr_t from, \ - int *fromlenaddr); } +29 AUE_NULL MSTD { int freebsd32_recvfrom(int s, u_int32_t buf, \ + u_int32_t len, int flags, u_int32_t from, \ + u_int32_t fromlenaddr); } 30 AUE_NULL MNOPROTO { int accept(int s, caddr_t name, \ int *anamelen); } 31 AUE_NULL MNOPROTO { int getpeername(int fdes, caddr_t asa, \ @@ -412,20 +413,20 @@ 231 AUE_NULL MNOPROTO { int shmget(key_t key, int size, \ int shmflg); } ; -232 AUE_NULL MNOPROTO { int clock_gettime(clockid_t clock_id, \ - struct timespec *tp); } -233 AUE_NULL MNOPROTO { int clock_settime(clockid_t clock_id, \ - const struct timespec *tp); } -234 AUE_NULL MNOPROTO { int clock_getres(clockid_t clock_id, \ - struct timespec *tp); } +232 AUE_NULL MSTD { int freebsd32_clock_gettime(clockid_t clock_id, \ + struct timespec32 *tp); } +233 AUE_NULL MSTD { int freebsd32_clock_settime(clockid_t clock_id, \ + const struct timespec32 *tp); } +234 AUE_NULL MSTD { int freebsd32_clock_getres(clockid_t clock_id, \ + struct timespec32 *tp); } 235 AUE_NULL UNIMPL timer_create 236 AUE_NULL UNIMPL timer_delete 237 AUE_NULL UNIMPL timer_settime 238 AUE_NULL UNIMPL timer_gettime 239 AUE_NULL UNIMPL timer_getoverrun 240 AUE_NULL MSTD { int freebsd32_nanosleep( \ - const struct timespec *rqtp, \ - struct timespec *rmtp); } + const struct timespec32 *rqtp, \ + struct timespec32 *rmtp); } 241 AUE_NULL UNIMPL nosys 242 AUE_NULL UNIMPL nosys 243 AUE_NULL UNIMPL nosys ==== //depot/projects/fast_ipsec/src/sys/kern/kern_time.c#2 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_time.c,v 1.116 2005/03/31 22:51:18 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_time.c,v 1.117 2005/10/15 02:54:18 ps Exp $"); #include "opt_mac.h" @@ -155,34 +155,46 @@ clock_gettime(struct thread *td, struct clock_gettime_args *uap) { struct timespec ats; + int error; + + error = kern_clock_gettime(td, uap->clock_id, &ats); + if (error == 0) + error = copyout(&ats, uap->tp, sizeof(ats)); + + return (error); +} + +int +kern_clock_gettime(struct thread *td, clockid_t clock_id, struct timespec *ats) +{ struct timeval sys, user; struct proc *p; p = td->td_proc; - switch (uap->clock_id) { + switch (clock_id) { case CLOCK_REALTIME: - nanotime(&ats); + nanotime(ats); break; case CLOCK_VIRTUAL: PROC_LOCK(p); calcru(p, &user, &sys); PROC_UNLOCK(p); - TIMEVAL_TO_TIMESPEC(&user, &ats); + TIMEVAL_TO_TIMESPEC(&user, ats); break; case CLOCK_PROF: PROC_LOCK(p); calcru(p, &user, &sys); PROC_UNLOCK(p); timevaladd(&user, &sys); - TIMEVAL_TO_TIMESPEC(&user, &ats); + TIMEVAL_TO_TIMESPEC(&user, ats); break; case CLOCK_MONOTONIC: - nanouptime(&ats); + nanouptime(ats); break; default: return (EINVAL); } - return (copyout(&ats, uap->tp, sizeof(ats))); + return (0); } #ifndef _SYS_SYSPROTO_H_ @@ -199,8 +211,18 @@ int clock_settime(struct thread *td, struct clock_settime_args *uap) { + struct timespec ats; + int error; + + if ((error = copyin(uap->tp, &ats, sizeof(ats))) != 0) + return (error); + return (kern_clock_settime(td, uap->clock_id, &ats)); +} + +int +kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats) +{ struct timeval atv; - struct timespec ats; int error; #ifdef MAC @@ -210,14 +232,12 @@ #endif if ((error = suser(td)) != 0) return (error); - if (uap->clock_id != CLOCK_REALTIME) + if (clock_id != CLOCK_REALTIME) return (EINVAL); - if ((error = copyin(uap->tp, &ats, sizeof(ats))) != 0) - return (error); - if (ats.tv_nsec < 0 || ats.tv_nsec >= 1000000000) + if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000) return (EINVAL); /* XXX Don't convert nsec->usec and back */ - TIMESPEC_TO_TIMEVAL(&atv, &ats); + TIMESPEC_TO_TIMEVAL(&atv, ats); error = settime(td, &atv); return (error); } @@ -233,9 +253,23 @@ clock_getres(struct thread *td, struct clock_getres_args *uap) { struct timespec ts; + int error; + + if (uap->tp == NULL) + return (0); + + error = kern_clock_getres(td, uap->clock_id, &ts); + if (error == 0) + error = copyout(&ts, uap->tp, sizeof(ts)); + return (error); +} - ts.tv_sec = 0; - switch (uap->clock_id) { +int +kern_clock_getres(struct thread *td, clockid_t clock_id, struct timespec *ts) +{ + + ts->tv_sec = 0; + switch (clock_id) { case CLOCK_REALTIME: case CLOCK_MONOTONIC: /* @@ -243,19 +277,17 @@ * Rounding up is especially important if rounding down * would give 0. Perfect rounding is unimportant. */ - ts.tv_nsec = 1000000000 / tc_getfrequency() + 1; + ts->tv_nsec = 1000000000 / tc_getfrequency() + 1; break; case CLOCK_VIRTUAL: case CLOCK_PROF: /* Accurately round up here because we can do so cheaply. */ - ts.tv_nsec = (1000000000 + hz - 1) / hz; + ts->tv_nsec = (1000000000 + hz - 1) / hz; break; default: return (EINVAL); } - if (uap->tp == NULL) - return (0); - return (copyout(&ts, uap->tp, sizeof(ts))); + return (0); } static int nanowait; ==== //depot/projects/fast_ipsec/src/sys/kern/uipc_syscalls.c#2 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.221 2005/07/05 22:49:09 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.222 2005/10/15 05:57:06 ps Exp $"); #include "opt_compat.h" #include "opt_ktrace.h" @@ -922,12 +922,13 @@ return (error); } -static int -recvit(td, s, mp, namelenp) +int +kern_recvit(td, s, mp, namelenp, segflg) struct thread *td; int s; struct msghdr *mp; void *namelenp; + enum uio_seg segflg; { struct uio auio; struct iovec *iov; @@ -964,7 +965,7 @@ auio.uio_iov = mp->msg_iov; auio.uio_iovcnt = mp->msg_iovlen; - auio.uio_segflg = UIO_USERSPACE; + auio.uio_segflg = segflg; auio.uio_rw = UIO_READ; auio.uio_td = td; auio.uio_offset = 0; /* XXX */ @@ -1082,6 +1083,17 @@ return (error); } +static int +recvit(td, s, mp, namelenp) + struct thread *td; + int s; + struct msghdr *mp; + void *namelenp; +{ + + return (kern_recvit(td, s, mp, namelenp, UIO_USERSPACE)); +} + /* * MPSAFE */ ==== //depot/projects/fast_ipsec/src/sys/netinet6/raw_ip6.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/netinet6/raw_ip6.c,v 1.55 2005/08/18 11:11:27 suz Exp $ + * $FreeBSD: src/sys/netinet6/raw_ip6.c,v 1.56 2005/10/15 08:49:49 suz Exp $ */ /*- @@ -566,8 +566,10 @@ } MALLOC(filter, struct icmp6_filter *, sizeof(struct icmp6_filter), M_PCB, M_NOWAIT); - if (filter == NULL) + if (filter == NULL) { + INP_INFO_WUNLOCK(&ripcbinfo); return ENOMEM; + } s = splnet(); error = in_pcballoc(so, &ripcbinfo, "raw6inp"); splx(s); ==== //depot/projects/fast_ipsec/src/sys/sparc64/sparc64/trap.c#3 (text+ko) ==== @@ -37,7 +37,7 @@ * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * from: FreeBSD: src/sys/i386/i386/trap.c,v 1.197 2001/07/19 - * $FreeBSD: src/sys/sparc64/sparc64/trap.c,v 1.75 2005/10/14 12:43:47 davidxu Exp $ + * $FreeBSD: src/sys/sparc64/sparc64/trap.c,v 1.76 2005/10/15 02:09:43 davidxu Exp $ */ #include "opt_ddb.h" @@ -289,7 +289,7 @@ ksi.ksi_signo = sig; ksi.ksi_code = (int)tf->tf_type; /* XXX not POSIX */ /* ksi.ksi_addr = ? */ - ksi.ksi_trap = (int)tf->tf_type; + ksi.ksi_trapno = (int)tf->tf_type; trapsignal(td, &ksi); } ==== //depot/projects/fast_ipsec/src/sys/sys/syscallsubr.h#2 (text+ko) ==== @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/syscallsubr.h,v 1.31 2005/07/07 18:17:55 jhb Exp $ + * $FreeBSD: src/sys/sys/syscallsubr.h,v 1.33 2005/10/15 05:57:05 ps Exp $ */ #ifndef _SYS_SYSCALLSUBR_H_ @@ -60,6 +60,12 @@ int mode); int kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid, int gid); +int kern_clock_getres(struct thread *td, clockid_t clock_id, + struct timespec *ts); +int kern_clock_gettime(struct thread *td, clockid_t clock_id, + struct timespec *ats); +int kern_clock_settime(struct thread *td, clockid_t clock_id, + struct timespec *ats); int kern_connect(struct thread *td, int fd, struct sockaddr *sa); int kern_execve(struct thread *td, struct image_args *args, struct mac *mac_p); @@ -105,6 +111,8 @@ int kern_readlink(struct thread *td, char *path, enum uio_seg pathseg, char *buf, enum uio_seg bufseg, int count); int kern_readv(struct thread *td, int fd, struct uio *auio); +int kern_recvit(struct thread *td, int s, struct msghdr *mp, void *namelenp, + enum uio_seg segflg); int kern_rename(struct thread *td, char *from, char *to, enum uio_seg pathseg); int kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510151638.j9FGcA7b065507>