From 8a709a3b44a05cef22d9a4a7ca91f297c8f6a54e Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Thu, 20 Oct 2016 22:15:32 +0200
Subject: [PATCH 2/2] Remove useless compat syscalls (functions are in libc).

---
 sys/kern/init_sysent.c   | 14 ++++++-------
 sys/kern/syscalls.c      | 14 ++++++-------
 sys/kern/syscalls.master | 15 +++++++-------
 sys/sys/syscall.h        | 14 ++++++-------
 sys/sys/sysproto.h       | 53 ------------------------------------------------
 sys/sys/sysunion.h       |  1 -
 6 files changed, 28 insertions(+), 83 deletions(-)

diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c
index 0da44a4..53d065a 100644
--- a/sys/kern/init_sysent.c
+++ b/sys/kern/init_sysent.c
@@ -23,7 +23,7 @@ struct sysent sysent[] = {
 	{ AS(open_args), (sy_call_t *)sys_open },	/* 5 = open */
 	{ AS(close_args), (sy_call_t *)sys_close },	/* 6 = close */
 	{ AS(wait_args), (sy_call_t *)sys_wait4 },	/* 7 = wait4 */
-	{ compat(AS(ocreat_args),creat) },		/* 8 = old creat */
+	{ 0, (sy_call_t *)sys_nosys },			/* 8 = obsolete 4.3 creat */
 	{ AS(link_args), (sy_call_t *)sys_link },	/* 9 = link */
 	{ AS(unlink_args), (sy_call_t *)sys_unlink },	/* 10 = unlink */
 	{ 0, (sy_call_t *)sys_nosys },			/* 11 = obsolete execv */
@@ -123,9 +123,9 @@ struct sysent sysent[] = {
 	{ AS(setsockopt_args), (sy_call_t *)sys_setsockopt },	/* 105 = setsockopt */
 	{ AS(listen_args), (sy_call_t *)sys_listen },	/* 106 = listen */
 	{ 0, (sy_call_t *)sys_nosys },			/* 107 = obsolete vtimes */
-	{ compat(AS(osigvec_args),sigvec) },		/* 108 = old sigvec */
-	{ compat(AS(osigblock_args),sigblock) },	/* 109 = old sigblock */
-	{ compat(AS(osigsetmask_args),sigsetmask) },	/* 110 = old sigsetmask */
+	{ 0, (sy_call_t *)sys_nosys },			/* 108 = obsolete 4.3 sigvec */
+	{ 0, (sy_call_t *)sys_nosys },			/* 109 = obsolete 4.3 sigblock */
+	{ 0, (sy_call_t *)sys_nosys },			/* 110 = obsolete 4.3 sigsetmask */
 	{ 0, (sy_call_t *)sys_nosys },			/* 111 = obsolete freebsd3_sigsuspend */
 	{ compat(AS(osigstack_args),sigstack) },	/* 112 = old sigstack */
 	{ compat(AS(orecvmsg_args),recvmsg) },		/* 113 = old recvmsg */
@@ -157,11 +157,11 @@ struct sysent sysent[] = {
 	{ 0, (sy_call_t *)sys_nosys },			/* 139 = obsolete 4.2 sigreturn */
 	{ AS(adjtime_args), (sy_call_t *)sys_adjtime },	/* 140 = adjtime */
 	{ compat(AS(ogetpeername_args),getpeername) },	/* 141 = old getpeername */
-	{ compat(0,gethostid) },			/* 142 = old gethostid */
-	{ compat(AS(osethostid_args),sethostid) },	/* 143 = old sethostid */
+	{ 0, (sy_call_t *)sys_nosys },			/* 142 = obsolete 4.3 gethostid */
+	{ 0, (sy_call_t *)sys_nosys },			/* 143 = obsolete 4.3 sethostid */
 	{ compat(AS(ogetrlimit_args),getrlimit) },	/* 144 = old getrlimit */
 	{ compat(AS(osetrlimit_args),setrlimit) },	/* 145 = old setrlimit */
-	{ compat(AS(okillpg_args),killpg) },		/* 146 = old killpg */
+	{ 0, (sy_call_t *)sys_nosys },			/* 146 = obsolete 4.3 killpg */
 	{ 0, (sy_call_t *)sys_setsid },			/* 147 = setsid */
 	{ AS(quotactl_args), (sy_call_t *)sys_quotactl },	/* 148 = quotactl */
 	{ compat(0,quota) },				/* 149 = old quota */
diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c
index ca458fa..86f917a 100644
--- a/sys/kern/syscalls.c
+++ b/sys/kern/syscalls.c
@@ -14,7 +14,7 @@ const char *syscallnames[] = {
 	"open",			/* 5 = open */
 	"close",			/* 6 = close */
 	"wait4",			/* 7 = wait4 */
-	"old.creat",		/* 8 = old creat */
+	"obs_4.3",			/* 8 = obsolete 4.3 creat */
 	"link",			/* 9 = link */
 	"unlink",			/* 10 = unlink */
 	"obs_execv",			/* 11 = obsolete execv */
@@ -114,9 +114,9 @@ const char *syscallnames[] = {
 	"setsockopt",			/* 105 = setsockopt */
 	"listen",			/* 106 = listen */
 	"obs_vtimes",			/* 107 = obsolete vtimes */
-	"old.sigvec",		/* 108 = old sigvec */
-	"old.sigblock",		/* 109 = old sigblock */
-	"old.sigsetmask",		/* 110 = old sigsetmask */
+	"obs_4.3",			/* 108 = obsolete 4.3 sigvec */
+	"obs_4.3",			/* 109 = obsolete 4.3 sigblock */
+	"obs_4.3",			/* 110 = obsolete 4.3 sigsetmask */
 	"obs_freebsd3_sigsuspend",			/* 111 = obsolete freebsd3_sigsuspend */
 	"old.sigstack",		/* 112 = old sigstack */
 	"old.recvmsg",		/* 113 = old recvmsg */
@@ -148,11 +148,11 @@ const char *syscallnames[] = {
 	"obs_4.2",			/* 139 = obsolete 4.2 sigreturn */
 	"adjtime",			/* 140 = adjtime */
 	"old.getpeername",		/* 141 = old getpeername */
-	"old.gethostid",		/* 142 = old gethostid */
-	"old.sethostid",		/* 143 = old sethostid */
+	"obs_4.3",			/* 142 = obsolete 4.3 gethostid */
+	"obs_4.3",			/* 143 = obsolete 4.3 sethostid */
 	"old.getrlimit",		/* 144 = old getrlimit */
 	"old.setrlimit",		/* 145 = old setrlimit */
-	"old.killpg",		/* 146 = old killpg */
+	"obs_4.3",			/* 146 = obsolete 4.3 killpg */
 	"setsid",			/* 147 = setsid */
 	"quotactl",			/* 148 = quotactl */
 	"old.quota",		/* 149 = old quota */
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 4647cc4..48c200b 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -51,7 +51,7 @@
 6	STD	{ int close(int fd); }
 7	STD	{ int wait4(int pid, int *status, int options, \
 			    struct rusage *rusage); } wait4 wait_args int
-8	COMPAT	{ int creat(char *path, int mode); }
+8	OBSOL	4.3 creat
 9	STD	{ int link(char *path, char *link); }
 10	STD	{ int unlink(char *path); }
 11	OBSOL	execv
@@ -174,10 +174,9 @@
 			    caddr_t val, int valsize); }
 106	STD	{ int listen(int s, int backlog); }
 107	OBSOL	vtimes
-108	COMPAT	{ int sigvec(int signum, struct sigvec *nsv, \
-			    struct sigvec *osv); }
-109	COMPAT	{ int sigblock(int mask); }
-110	COMPAT	{ int sigsetmask(int mask); }
+108	OBSOL	4.3 sigvec
+109	OBSOL	4.3 sigblock
+110	OBSOL	4.3 sigsetmask
 111	OBSOL	freebsd3_sigsuspend
 ; XXX note nonstandard (bogus) calling convention - the libc stub passes
 ; us the mask, not a pointer to it.
@@ -221,11 +220,11 @@
 140	STD	{ int adjtime(struct timeval *delta, \
 			    struct timeval *olddelta); }
 141	COMPAT	{ int getpeername(int fdes, caddr_t asa, int *alen); }
-142	COMPAT	{ long gethostid(void); }
-143	COMPAT	{ int sethostid(long hostid); }
+142	OBSOL	4.3 gethostid
+143	OBSOL	4.3 sethostid
 144	COMPAT	{ int getrlimit(u_int which, struct orlimit *rlp); }
 145	COMPAT	{ int setrlimit(u_int which, struct orlimit *rlp); }
-146	COMPAT	{ int killpg(int pgid, int signum); }
+146	OBSOL	4.3 killpg
 147	STD	{ int setsid(void); }
 148	STD	{ int quotactl(char *path, int cmd, int uid, \
 			    caddr_t arg); }
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index 6260b76..c5fc2e8 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -13,7 +13,7 @@
 #define	SYS_open	5
 #define	SYS_close	6
 #define	SYS_wait4	7
-				/* 8 is old creat */
+				/* 8 is obsolete 4.3 creat */
 #define	SYS_link	9
 #define	SYS_unlink	10
 				/* 11 is obsolete execv */
@@ -111,9 +111,9 @@
 #define	SYS_setsockopt	105
 #define	SYS_listen	106
 				/* 107 is obsolete vtimes */
-				/* 108 is old sigvec */
-				/* 109 is old sigblock */
-				/* 110 is old sigsetmask */
+				/* 108 is obsolete 4.3 sigvec */
+				/* 109 is obsolete 4.3 sigblock */
+				/* 110 is obsolete 4.3 sigsetmask */
 				/* 111 is obsolete freebsd3_sigsuspend */
 				/* 112 is old sigstack */
 				/* 113 is old recvmsg */
@@ -144,11 +144,11 @@
 				/* 139 is obsolete 4.2 sigreturn */
 #define	SYS_adjtime	140
 				/* 141 is old getpeername */
-				/* 142 is old gethostid */
-				/* 143 is old sethostid */
+				/* 142 is obsolete 4.3 gethostid */
+				/* 143 is obsolete 4.3 sethostid */
 				/* 144 is old getrlimit */
 				/* 145 is old setrlimit */
-				/* 146 is old killpg */
+				/* 146 is obsolete 4.3 killpg */
 #define	SYS_setsid	147
 #define	SYS_quotactl	148
 				/* 149 is old quota */
diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h
index d71e0b4..359aeab 100644
--- a/sys/sys/sysproto.h
+++ b/sys/sys/sysproto.h
@@ -766,12 +766,6 @@ struct	adjtime_args {
 	struct timeval *	delta;	char delta_[PAD_(struct timeval *)];
 	struct timeval *	olddelta;	char olddelta_[PAD_(struct timeval *)];
 };
-struct	ogethostid_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	register_t dummy;
-};
 struct	setsid_args {
 #ifdef _KERNEL
 	struct sysmsg sysmsg;
@@ -2331,13 +2325,6 @@ struct	ppoll_args {
 	const struct timespec *	ts;	char ts_[PAD_(const struct timespec *)];
 	const sigset_t *	sigmask;	char sigmask_[PAD_(const sigset_t *)];
 };
-struct	ocreat_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	char *	path;	char path_[PAD_(char *)];
-	int	mode;	char mode_[PAD_(int)];
-};
 struct	olseek_args {
 #ifdef _KERNEL
 	struct sysmsg sysmsg;
@@ -2425,26 +2412,6 @@ struct	orecv_args {
 	int	len;	char len_[PAD_(int)];
 	int	flags;	char flags_[PAD_(int)];
 };
-struct	osigvec_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	int	signum;	char signum_[PAD_(int)];
-	struct sigvec *	nsv;	char nsv_[PAD_(struct sigvec *)];
-	struct sigvec *	osv;	char osv_[PAD_(struct sigvec *)];
-};
-struct	osigblock_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	int	mask;	char mask_[PAD_(int)];
-};
-struct	osigsetmask_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	int	mask;	char mask_[PAD_(int)];
-};
 struct	osigstack_args {
 #ifdef _KERNEL
 	struct sysmsg sysmsg;
@@ -2490,12 +2457,6 @@ struct	ogetpeername_args {
 	caddr_t	asa;	char asa_[PAD_(caddr_t)];
 	int *	alen;	char alen_[PAD_(int *)];
 };
-struct	osethostid_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	long	hostid;	char hostid_[PAD_(long)];
-};
 struct	ogetrlimit_args {
 #ifdef _KERNEL
 	struct sysmsg sysmsg;
@@ -2510,13 +2471,6 @@ struct	osetrlimit_args {
 	u_int	which;	char which_[PAD_(u_int)];
 	struct orlimit *	rlp;	char rlp_[PAD_(struct orlimit *)];
 };
-struct	okillpg_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	int	pgid;	char pgid_[PAD_(int)];
-	int	signum;	char signum_[PAD_(int)];
-};
 struct	ogetdirentries_args {
 #ifdef _KERNEL
 	struct sysmsg sysmsg;
@@ -2529,7 +2483,6 @@ struct	ogetdirentries_args {
 
 #ifdef _KERNEL
 
-int	sys_ocreat (struct ocreat_args *);
 int	sys_olseek (struct olseek_args *);
 int	sys_ostat (struct ostat_args *);
 int	sys_olstat (struct olstat_args *);
@@ -2544,9 +2497,6 @@ int	sys_osethostname (struct sethostname_args *);
 int	sys_oaccept (struct accept_args *);
 int	sys_osend (struct osend_args *);
 int	sys_orecv (struct orecv_args *);
-int	sys_osigvec (struct osigvec_args *);
-int	sys_osigblock (struct osigblock_args *);
-int	sys_osigsetmask (struct osigsetmask_args *);
 int	sys_osigstack (struct osigstack_args *);
 int	sys_orecvmsg (struct orecvmsg_args *);
 int	sys_osendmsg (struct osendmsg_args *);
@@ -2554,11 +2504,8 @@ int	sys_orecvfrom (struct recvfrom_args *);
 int	sys_otruncate (struct otruncate_args *);
 int	sys_oftruncate (struct oftruncate_args *);
 int	sys_ogetpeername (struct ogetpeername_args *);
-int	sys_ogethostid (struct ogethostid_args *);
-int	sys_osethostid (struct osethostid_args *);
 int	sys_ogetrlimit (struct ogetrlimit_args *);
 int	sys_osetrlimit (struct osetrlimit_args *);
-int	sys_okillpg (struct okillpg_args *);
 int	sys_oquota (struct oquota_args *);
 int	sys_ogetsockname (struct getsockname_args *);
 int	sys_ogetdirentries (struct ogetdirentries_args *);
diff --git a/sys/sys/sysunion.h b/sys/sys/sysunion.h
index 4169515..765c9f0 100644
--- a/sys/sys/sysunion.h
+++ b/sys/sys/sysunion.h
@@ -113,7 +113,6 @@ union sysunion {
 	struct	rmdir_args rmdir;
 	struct	utimes_args utimes;
 	struct	adjtime_args adjtime;
-	struct	ogethostid_args sys_ogethostid;
 	struct	setsid_args setsid;
 	struct	quotactl_args quotactl;
 	struct	oquota_args sys_oquota;
-- 
2.9.2

