From a72c64b0b663b58c8e27d16102a61e2daea6dcdc Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Wed, 22 Jun 2016 21:18:19 +0000 Subject: [PATCH] Generate syscall tables and update pipe() implementation after r302094. Mark the pipe() system call as COMPAT10. As of r302092 libc uses pipe2() with a zero flags value instead of pipe(). Approved by: re (gjb) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D6816 --- sys/compat/freebsd32/freebsd32_misc.c | 9 ++++++ sys/compat/freebsd32/freebsd32_proto.h | 28 ++++++++++++++++++- sys/compat/freebsd32/freebsd32_syscall.h | 4 +-- sys/compat/freebsd32/freebsd32_syscalls.c | 4 +-- sys/compat/freebsd32/freebsd32_sysent.c | 10 +++++-- .../freebsd32/freebsd32_systrace_args.c | 10 ------- sys/kern/init_sysent.c | 10 +++++-- sys/kern/sys_pipe.c | 6 +++- sys/kern/syscalls.c | 4 +-- sys/kern/systrace_args.c | 10 ------- sys/sys/syscall.h | 4 +-- sys/sys/syscall.mk | 3 +- sys/sys/sysproto.h | 14 +++++++--- 13 files changed, 76 insertions(+), 40 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 598bdc5f7ea..893ad9859da 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -272,6 +272,15 @@ freebsd4_freebsd32_getfsstat(struct thread *td, struct freebsd4_freebsd32_getfss } #endif +#ifdef COMPAT_FREEBSD10 +int +freebsd10_freebsd32_pipe(struct thread *td, + struct freebsd10_freebsd32_pipe_args *uap) { + + return (freebsd10_pipe(td, (struct freebsd10_pipe_args*)uap)); +} +#endif + int freebsd32_sigaltstack(struct thread *td, struct freebsd32_sigaltstack_args *uap) diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h index 023dac83787..ac2ad75fa4e 100644 --- a/sys/compat/freebsd32/freebsd32_proto.h +++ b/sys/compat/freebsd32/freebsd32_proto.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 296572 2016-03-09 19:05:11Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -61,6 +61,9 @@ struct freebsd32_recvfrom_args { char from_l_[PADL_(uint32_t)]; uint32_t from; char from_r_[PADR_(uint32_t)]; char fromlenaddr_l_[PADL_(uint32_t)]; uint32_t fromlenaddr; char fromlenaddr_r_[PADR_(uint32_t)]; }; +struct freebsd10_freebsd32_pipe_args { + register_t dummy; +}; struct ofreebsd32_sigpending_args { register_t dummy; }; @@ -1099,6 +1102,28 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_ #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) +#define PAD64_REQUIRED +#endif +#ifdef PAD64_REQUIRED +#else +#endif +#ifdef PAD64_REQUIRED +#else +#endif +#ifdef PAD64_REQUIRED +#else +#endif +#ifdef PAD64_REQUIRED +#else +#endif +int freebsd10_freebsd32_pipe(struct thread *, struct freebsd10_freebsd32_pipe_args *); + +#endif /* COMPAT_FREEBSD10 */ + #define FREEBSD32_SYS_AUE_freebsd32_wait4 AUE_WAIT4 #define FREEBSD32_SYS_AUE_freebsd4_freebsd32_getfsstat AUE_GETFSSTAT #define FREEBSD32_SYS_AUE_ofreebsd32_lseek AUE_LSEEK @@ -1107,6 +1132,7 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_ #define FREEBSD32_SYS_AUE_freebsd32_recvfrom AUE_RECVFROM #define FREEBSD32_SYS_AUE_ofreebsd32_stat AUE_STAT #define FREEBSD32_SYS_AUE_ofreebsd32_lstat AUE_LSTAT +#define FREEBSD32_SYS_AUE_freebsd10_freebsd32_pipe AUE_PIPE #define FREEBSD32_SYS_AUE_ofreebsd32_sigaction AUE_SIGACTION #define FREEBSD32_SYS_AUE_ofreebsd32_sigprocmask AUE_SIGPROCMASK #define FREEBSD32_SYS_AUE_ofreebsd32_sigpending AUE_SIGPENDING diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index ce56b1591f1..563e9bcadc4 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 296572 2016-03-09 19:05:11Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #define FREEBSD32_SYS_syscall 0 @@ -48,7 +48,7 @@ #define FREEBSD32_SYS_getppid 39 /* 40 is old freebsd32_lstat */ #define FREEBSD32_SYS_dup 41 -#define FREEBSD32_SYS_pipe 42 + /* 42 is freebsd10 freebsd32_pipe */ #define FREEBSD32_SYS_getegid 43 #define FREEBSD32_SYS_profil 44 #define FREEBSD32_SYS_ktrace 45 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index 2d56d496d3d..61ce315125f 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 296572 2016-03-09 19:05:11Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ const char *freebsd32_syscallnames[] = { @@ -52,7 +52,7 @@ const char *freebsd32_syscallnames[] = { "getppid", /* 39 = getppid */ "compat.freebsd32_lstat", /* 40 = old freebsd32_lstat */ "dup", /* 41 = dup */ - "pipe", /* 42 = pipe */ + "compat10.freebsd32_pipe", /* 42 = freebsd10 freebsd32_pipe */ "getegid", /* 43 = getegid */ "profil", /* 44 = profil */ "ktrace", /* 45 = ktrace */ diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index 51ba0501d10..b1b4eba005f 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 296572 2016-03-09 19:05:11Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #include "opt_compat.h" @@ -42,6 +42,12 @@ #define compat7(n, name) 0, (sy_call_t *)nosys #endif +#ifdef COMPAT_FREEBSD10 +#define compat10(n, name) n, (sy_call_t *)__CONCAT(freebsd10_,name) +#else +#define compat10(n, name) 0, (sy_call_t *)nosys +#endif + /* The casts are bogus but will do for now. */ struct sysent freebsd32_sysent[] = { #if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) @@ -89,7 +95,7 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)sys_getppid, AUE_GETPPID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 39 = getppid */ { compat(AS(ofreebsd32_lstat_args),freebsd32_lstat), AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 40 = old freebsd32_lstat */ { AS(dup_args), (sy_call_t *)sys_dup, AUE_DUP, NULL, 0, 0, 0, SY_THR_STATIC }, /* 41 = dup */ - { 0, (sy_call_t *)sys_pipe, AUE_PIPE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 42 = pipe */ + { compat10(0,freebsd32_pipe), AUE_PIPE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 42 = freebsd10 freebsd32_pipe */ { 0, (sy_call_t *)sys_getegid, AUE_GETEGID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 43 = getegid */ { AS(profil_args), (sy_call_t *)sys_profil, AUE_PROFILE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 44 = profil */ { AS(ktrace_args), (sy_call_t *)sys_ktrace, AUE_KTRACE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 45 = ktrace */ diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index 765f5d52133..04247fff1f1 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -293,11 +293,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 1; break; } - /* pipe */ - case 42: { - *n_args = 0; - break; - } /* getegid */ case 43: { *n_args = 0; @@ -3768,9 +3763,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* pipe */ - case 42: - break; /* getegid */ case 43: break; @@ -9083,8 +9075,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* pipe */ - case 42: /* getegid */ case 43: /* profil */ diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 47f2f90bbc9..20971651e77 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #include "opt_compat.h" @@ -38,6 +38,12 @@ #define compat7(n, name) 0, (sy_call_t *)nosys #endif +#ifdef COMPAT_FREEBSD10 +#define compat10(n, name) n, (sy_call_t *)__CONCAT(freebsd10_,name) +#else +#define compat10(n, name) 0, (sy_call_t *)nosys +#endif + /* The casts are bogus but will do for now. */ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 0 = syscall */ @@ -82,7 +88,7 @@ struct sysent sysent[] = { { 0, (sy_call_t *)sys_getppid, AUE_GETPPID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = getppid */ { compat(AS(olstat_args),lstat), AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 40 = old lstat */ { AS(dup_args), (sy_call_t *)sys_dup, AUE_DUP, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = dup */ - { 0, (sy_call_t *)sys_pipe, AUE_PIPE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = pipe */ + { compat10(0,pipe), AUE_PIPE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = freebsd10 pipe */ { 0, (sy_call_t *)sys_getegid, AUE_GETEGID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = getegid */ { AS(profil_args), (sy_call_t *)sys_profil, AUE_PROFILE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = profil */ { AS(ktrace_args), (sy_call_t *)sys_ktrace, AUE_KTRACE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 45 = ktrace */ diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 2032b383a7d..649f371d361 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -89,6 +89,8 @@ * in the structure may have changed. */ +#include "opt_compat.h" + #include __FBSDID("$FreeBSD$"); @@ -445,9 +447,10 @@ kern_pipe(struct thread *td, int fildes[2], int flags, struct filecaps *fcaps1, return (0); } +#ifdef COMPAT_FREEBSD10 /* ARGSUSED */ int -sys_pipe(struct thread *td, struct pipe_args *uap) +freebsd10_pipe(struct thread *td, struct freebsd10_pipe_args *uap __unused) { int error; int fildes[2]; @@ -461,6 +464,7 @@ sys_pipe(struct thread *td, struct pipe_args *uap) return (0); } +#endif int sys_pipe2(struct thread *td, struct pipe2_args *uap) diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 35750285d8b..ba82aa865f2 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ const char *syscallnames[] = { @@ -49,7 +49,7 @@ const char *syscallnames[] = { "getppid", /* 39 = getppid */ "compat.lstat", /* 40 = old lstat */ "dup", /* 41 = dup */ - "pipe", /* 42 = pipe */ + "compat10.pipe", /* 42 = freebsd10 pipe */ "getegid", /* 43 = getegid */ "profil", /* 44 = profil */ "ktrace", /* 45 = ktrace */ diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index c2ea2b446ca..6c8d9d035ce 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -290,11 +290,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 1; break; } - /* pipe */ - case 42: { - *n_args = 0; - break; - } /* getegid */ case 43: { *n_args = 0; @@ -3775,9 +3770,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* pipe */ - case 42: - break; /* getegid */ case 43: break; @@ -9040,8 +9032,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* pipe */ - case 42: /* getegid */ case 43: /* profil */ diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 8a32a643618..accd20c22c2 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #define SYS_syscall 0 @@ -48,7 +48,7 @@ #define SYS_getppid 39 /* 40 is old lstat */ #define SYS_dup 41 -#define SYS_pipe 42 + /* 42 is freebsd10 pipe */ #define SYS_getegid 43 #define SYS_profil 44 #define SYS_ktrace 45 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index a264838ef3c..f2a8f913ae3 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -1,7 +1,7 @@ # FreeBSD system call object files. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb +# created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks MIASM = \ syscall.o \ exit.o \ @@ -39,7 +39,6 @@ MIASM = \ kill.o \ getppid.o \ dup.o \ - pipe.o \ getegid.o \ profil.o \ ktrace.o \ diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 6d2357a2e80..60c95b2c5d9 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #ifndef _SYS_SYSPROTO_H_ @@ -183,7 +183,7 @@ struct getppid_args { struct dup_args { char fd_l_[PADL_(u_int)]; u_int fd; char fd_r_[PADR_(u_int)]; }; -struct pipe_args { +struct freebsd10_pipe_args { register_t dummy; }; struct getegid_args { @@ -1824,7 +1824,6 @@ int sys_sync(struct thread *, struct sync_args *); int sys_kill(struct thread *, struct kill_args *); int sys_getppid(struct thread *, struct getppid_args *); int sys_dup(struct thread *, struct dup_args *); -int sys_pipe(struct thread *, struct pipe_args *); int sys_getegid(struct thread *, struct getegid_args *); int sys_profil(struct thread *, struct profil_args *); int sys_ktrace(struct thread *, struct ktrace_args *); @@ -2499,6 +2498,13 @@ int freebsd7_shmctl(struct thread *, struct freebsd7_shmctl_args *); #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *); + +#endif /* COMPAT_FREEBSD10 */ + #define SYS_AUE_syscall AUE_NULL #define SYS_AUE_exit AUE_EXIT #define SYS_AUE_fork AUE_FORK @@ -2540,7 +2546,7 @@ int freebsd7_shmctl(struct thread *, struct freebsd7_shmctl_args *); #define SYS_AUE_getppid AUE_GETPPID #define SYS_AUE_olstat AUE_LSTAT #define SYS_AUE_dup AUE_DUP -#define SYS_AUE_pipe AUE_PIPE +#define SYS_AUE_freebsd10_pipe AUE_PIPE #define SYS_AUE_getegid AUE_GETEGID #define SYS_AUE_profil AUE_PROFILE #define SYS_AUE_ktrace AUE_KTRACE -- 2.45.2