shithub: mc

Download patch

ref: 6f55ccbfe4eca08f1fa81f7cd19935ff53ac3e11
parent: ea6a106b2f1ed6748ea55f6f9730b4138ff0dbf8
author: Ori Bernstein <[email protected]>
date: Sun May 8 15:06:52 EDT 2016

Clean up OpenBSD syscalls.

--- a/lib/sys/sys+openbsd-x64.myr
+++ b/lib/sys/sys+openbsd-x64.myr
@@ -19,17 +19,10 @@
 
 	type clock = union
 		`Clockrealtime
-		`Clockrealtime_precise
-		`Clockrealtime_fast
 		`Clockmonotonic
-		`Clockmonotonic_precise     
-		`Clockmonotonic_fast
+		`Clockproccputime
+		`Clockthreadcputime
 		`Clockuptime
-		`Clockuptime_precise
-		`Clockuptime_fast
-		`Clockvirtual
-		`Clockprof
-		`Clocksecond
 	;;
 
 	type waitstatus = union
@@ -129,7 +122,7 @@
 		fam	: sockfam
 		__pad1  : byte[6]
 		__align : int64
-		__pad2  : byte[112]
+		__pad2  : byte[240]
 	;;	
 	
 	type dirent = struct
@@ -138,28 +131,10 @@
 		reclen	: uint16
 		ftype	: uint8
 		namlen	: uint8
+		__pad	: byte[4]
 		name	: byte[256]	
 	;;
 
-	type rtprio = struct
-		rttype	: uint16
-		rtprio	: uint16
-	;;
-
-	type thrparam = struct
-		startfn	: void#	/* pointer to code for thread entry */
-		arg	: void#	/* pointer argument for thread entry */
-		stkbase	: byte#	/* stack base address */
-		stksz	: size	/* size of stack */
-		tlsbase	: byte#	/* base of thread local storage */
-		tlssz	: size	/* size of tls */
-		tid	: uint64#	/* place to store new tid */
-		ptid	: uint64#	/* place to store parent tid */
-		flags	: int32	/* flags for the thread */
-		rtp	: rtprio#	/* realtime priority */
-		spare	: void#[3]	/* padding */
-	;;
-
 	/* open options */
 	const Ordonly  	: fdopt = 0x0
 	const Owronly  	: fdopt = 0x1
@@ -180,6 +155,7 @@
 	const Sifreg	: filemode = 0x8000
 	const Siflnk	: filemode = 0xa000
 	const Sifsock 	: filemode = 0xc000
+	const Sisvtx 	: filemode = 0x0200
 
 	/* mmap protection */
 	const Mprotnone	: mprot = 0x0
@@ -194,7 +170,7 @@
 	const Mfixed	: mopt = 0x10
 	const Mfile	: mopt = 0x0
 	const Manon	: mopt = 0x1000
-	const M32bit	: mopt = 0x80000
+	const Mnoreplace	: mopt = 0x0800
 
 	/* file types */
 	const Dtunknown	: filetype = 0
@@ -205,13 +181,12 @@
 	const Dtreg	: filetype = 8
 	const Dtlnk	: filetype = 10
 	const Dtsock	: filetype = 12
-	const Dtwht	: filetype = 14
 
 	/* socket families. INCOMPLETE. */
 	const Afunspec	: sockfam = 0
 	const Afunix	: sockfam = 1
 	const Afinet	: sockfam = 2
-	const Afinet6	: sockfam = 28
+	const Afinet6	: sockfam = 24
 
 	/* socket types. */
 	const Sockstream	: socktype = 1
@@ -270,45 +245,10 @@
 	const Fsetown	 : fcntlcmd = 6		/* set SIGIO/SIGURG proc/pgrp */
 	const Fogetlk	 : fcntlcmd = 7		/* get record locking information */
 	const Fosetlk	 : fcntlcmd = 8		/* set record locking information */
-	const Fosetlkw	 : fcntlcmd = 9		/* F_SETLK; wait if blocked */
-	const Fdup2fd	 : fcntlcmd = 10		/* duplicate file descriptor to arg */
-	const Fgetlk	 : fcntlcmd = 11		/* get record locking information */
-	const Fsetlk	 : fcntlcmd = 12		/* set record locking information */
-	const Fsetlkw	 : fcntlcmd = 13		/* F_SETLK; wait if blocked */
-	const Fsetlk_remote	 : fcntlcmd = 14		/* debugging support for remote locks */
-	const Freadahead	 : fcntlcmd = 15		/* read ahead */
-	const Frdahead	 : fcntlcmd = 16		/* Darwin compatible read ahead */
-	const Fdupfd_cloexec	 : fcntlcmd = 17		/* Like F_DUPFD, but FD_CLOEXEC is set */
-	const Fdup2fd_cloexec	 : fcntlcmd = 18		/* Like F_DUP2FD, but FD_CLOEXEC is set */
 
 	/* return value for a failed mapping */
 	const Mapbad	: byte# = -1 castto(byte#)
 
-	/* umtx ops */
-	const Umtxlock	: umtxop = 0
-	const Umtxunlock	: umtxop = 1
-	const Umtxwait	: umtxop = 2
-	const Umtxwake	: umtxop = 3
-	const UmtxmtxTrylock	: umtxop = 4
-	const Umtxmtxlock	: umtxop = 5
-	const Umtxmtxunlock	: umtxop = 6
-	const Umtxsetceiling	: umtxop = 7
-	const Umtxcvwait	: umtxop = 8
-	const Umtxcvsignal	: umtxop = 9
-	const Umtxcvbroadcast	: umtxop = 10
-	const Umtxwaituint	: umtxop = 11
-	const Umtxrwrdlock	: umtxop = 12
-	const Umtxrwwrlock	: umtxop = 13
-	const Umtxrwunlock	: umtxop = 14
-	const Umtxwaituintpriv	: umtxop = 15
-	const Umtxwakepriv	: umtxop = 16
-	const Umtxmutexwait	: umtxop = 17
-	const Umtxsemwait	: umtxop = 19
-	const Umtxsemwake	: umtxop = 20
-	const Umtxnwakepriv	: umtxop = 21
-	const Umtxmtxwake2	: umtxop = 22
-	const Umtxmax	: umtxop = 23
-
 	/* syscalls */
 	const Syssyscall : scno = 0
 	const Sysexit : scno = 1
@@ -784,20 +724,13 @@
 
 const clockid = {clk
 	match clk
-	| `Clockrealtime:		-> 0
-	| `Clockvirtual:		-> 1
-	| `Clockprof:			-> 2
-	| `Clockmonotonic:		-> 4
-	| `Clockuptime:			-> 5
-	| `Clockuptime_precise:		-> 7
-	| `Clockuptime_fast:		-> 8
-	| `Clockrealtime_precise:	-> 9
-	| `Clockrealtime_fast:		-> 10
-	| `Clockmonotonic_precise:	-> 11
-	| `Clockmonotonic_fast:		-> 12
-	| `Clocksecond:			-> 13
+	| `Clockrealtime:	-> 0
+	| `Clockproccputime:	-> 2
+	| `Clockmonotonic:	-> 3
+	| `Clockthreadcputime:	-> 4
+	| `Clockuptime:	-> 5
 	;;
-	-> a(-1)
+	-> -1
 }
 
 const waitstatus = {st
--- a/lib/sys/syscall+openbsd-x64.s
+++ b/lib/sys/syscall+openbsd-x64.s
@@ -22,22 +22,3 @@
 
 .success:
 	ret
-
-/*
- * pipe() syscall returns the pipes created in eax:edx, and
- * needs to copy them to the destination locations manually.
- */
-.globl sys$__freebsd_pipe
-sys$__freebsd_pipe:
-	movq $0x2a,%rax
-	syscall
-
-	jae .pipesuccess
-	negq %rax
-
-.pipesuccess:
-	movl %eax,(%rdi)
-	movl %edx,4(%rdi)
-	xorq %rax,%rax
-	ret
-