Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Nov 2018 16:55:04 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340221 - in head/sys: compat/freebsd32 kern
Message-ID:  <201811071655.wA7Gt4hU097183@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Wed Nov  7 16:55:04 2018
New Revision: 340221
URL: https://svnweb.freebsd.org/changeset/base/340221

Log:
  makesyscalls.sh: allow pointer return types.
  
  The previous code required that the return type be a single word.  This
  allows it to be a pointer without using a typedef.
  
  Update the return types of break, mmap, and shmat to be void * as
  declared.  This only effects systrace output in-tree, but can aid in
  generating system call wrappers from syscalls.master.
  
  Reviewed by:	kib
  Obtained from:	CheriBSD
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D17873

Modified:
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/makesyscalls.sh
  head/sys/kern/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==============================================================================
--- head/sys/compat/freebsd32/syscalls.master	Wed Nov  7 16:28:09 2018	(r340220)
+++ head/sys/compat/freebsd32/syscalls.master	Wed Nov  7 16:55:04 2018	(r340221)
@@ -88,7 +88,7 @@
 					int mode, int dev); }
 15	AUE_CHMOD	NOPROTO	{ int chmod(const char *path, mode_t mode); }
 16	AUE_CHOWN	NOPROTO	{ int chown(const char *path, int uid, int gid); }
-17	AUE_NULL	NOPROTO	{ caddr_t break(char *nsize); }
+17	AUE_NULL	NOPROTO	{ void *break(char *nsize); }
 18	AUE_GETFSSTAT	COMPAT4	{ int freebsd32_getfsstat( \
 				    struct statfs32 *buf, long bufsize, \
 				    int mode); }
@@ -175,7 +175,7 @@
 68	AUE_NULL	OBSOL	vwrite
 69	AUE_SBRK	NOPROTO	{ int sbrk(int incr); }
 70	AUE_SSTK	NOPROTO	{ int sstk(int incr); }
-71	AUE_MMAP	COMPAT|NOPROTO	{ int mmap(void *addr, int len, \
+71	AUE_MMAP	COMPAT|NOPROTO	{ void *mmap(void *addr, int len, \
 				    int prot, int flags, int fd, int pos); }
 72	AUE_O_VADVISE	COMPAT11|NOPROTO	{ int vadvise(int anom); }
 73	AUE_MUNMAP	NOPROTO	{ int munmap(void *addr, size_t len); }
@@ -373,7 +373,7 @@
 				    __setrlimit_args int
 196	AUE_GETDIRENTRIES COMPAT11 { int freebsd32_getdirentries(int fd, \
 				    char *buf, u_int count, int32_t *basep); }
-197	AUE_MMAP	COMPAT6	{ caddr_t freebsd32_mmap(void *addr, \
+197	AUE_MMAP	COMPAT6	{ void *freebsd32_mmap(void *addr, \
 				    size_t len, int prot, int flags, int fd, \
 				    int pad, uint32_t pos1, uint32_t pos2); }
 198	AUE_NULL	NOPROTO	{ int nosys(void); } __syscall \
@@ -432,7 +432,7 @@
 				    size_t msgsz, int msgflg); }
 227	AUE_MSGRCV	NOSTD	{ int freebsd32_msgrcv(int msqid, void *msgp, \
 				    size_t msgsz, long msgtyp, int msgflg); }
-228	AUE_SHMAT	NOSTD|NOPROTO	{ int shmat(int shmid, void *shmaddr, \
+228	AUE_SHMAT	NOSTD|NOPROTO	{ void *shmat(int shmid, void *shmaddr, \
 				    int shmflg); }
 229	AUE_SHMCTL	COMPAT7|NOSTD	{ int freebsd32_shmctl( \
 				    int shmid, int cmd, \
@@ -876,7 +876,7 @@
 				    const void *buf, size_t nbyte, \
 				    int pad, \
 				    uint32_t offset1, uint32_t offset2); }
-477	AUE_MMAP	STD 	{ caddr_t freebsd32_mmap(void *addr, \
+477	AUE_MMAP	STD 	{ void *freebsd32_mmap(void *addr, \
 				    size_t len, int prot, int flags, int fd, \
 				    int pad, \
 				    uint32_t pos1, uint32_t pos2); }
@@ -897,7 +897,7 @@
 476	AUE_PWRITE	STD	{ ssize_t freebsd32_pwrite(int fd, \
 				    const void *buf, size_t nbyte, \
 				    uint32_t offset1, uint32_t offset2); }
-477	AUE_MMAP	STD 	{ caddr_t freebsd32_mmap(void *addr, \
+477	AUE_MMAP	STD 	{ void *freebsd32_mmap(void *addr, \
 				    size_t len, int prot, int flags, int fd, \
 				    uint32_t pos1, uint32_t pos2); }
 478	AUE_LSEEK	STD	{ off_t freebsd32_lseek(int fd, \

Modified: head/sys/kern/makesyscalls.sh
==============================================================================
--- head/sys/kern/makesyscalls.sh	Wed Nov  7 16:28:09 2018	(r340220)
+++ head/sys/kern/makesyscalls.sh	Wed Nov  7 16:55:04 2018	(r340221)
@@ -325,6 +325,7 @@ sed -e '
 	}
 	function parseline() {
 		f=4			# toss number, type, audit event
+		ret_inc = 0
 		argc= 0;
 		argssize = "0"
 		thr_flag = "SY_THR_STATIC"
@@ -340,12 +341,15 @@ sed -e '
 			funcalias=""
 			argalias=""
 			rettype="int"
+			if ($(f+2) == "*") {
+				ret_inc = 1
+			}
 			end=NF
 		}
 		if (flag("NODEF")) {
 			auditev="AUE_NULL"
-			funcname=$4
-			argssize = "AS(" $6 ")"
+			funcname=$(4 + ret_inc)
+			argssize = "AS(" $(6 + ret_inc) ")"
 			return
 		}
 		if ($f != "{")
@@ -363,6 +367,11 @@ sed -e '
 
 		syscallret=$f
 		f++
+		while (ret_inc > 0) {
+			syscallret=syscallret " " $f
+			f++
+			ret_inc--
+		}
 
 		funcname=$f
 

Modified: head/sys/kern/syscalls.master
==============================================================================
--- head/sys/kern/syscalls.master	Wed Nov  7 16:28:09 2018	(r340220)
+++ head/sys/kern/syscalls.master	Wed Nov  7 16:55:04 2018	(r340221)
@@ -180,7 +180,7 @@
 		);
 	}
 17	AUE_NULL	STD {
-		caddr_t break(
+		void *break(
 		    _In_ char *nsize
 		);
 	}
@@ -480,7 +480,7 @@
 		);
 	}
 71	AUE_MMAP	COMPAT {
-		int mmap(
+		void *mmap(
 		    _In_ void *addr,
 		    int len,
 		    int prot,
@@ -1168,7 +1168,7 @@
 		);
 	}
 197	AUE_MMAP	COMPAT6 {
-		caddr_t mmap(
+		void *mmap(
 		    _In_ void *addr,
 		    size_t len,
 		    int prot,
@@ -1317,7 +1317,7 @@
 		);
 	}
 228	AUE_SHMAT	NOSTD {
-		int shmat(
+		void *shmat(
 		    int shmid,
 		    _In_ const void *shmaddr,
 		    int shmflg
@@ -2543,7 +2543,7 @@
 		);
 	}
 477	AUE_MMAP	STD {
-		caddr_t mmap(
+		void *mmap(
 		    _In_ void *addr,
 		    size_t len,
 		    int prot,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811071655.wA7Gt4hU097183>