shithub: mc

Download patch

ref: a843f825632bd19e34a81bccf9b8a015a0196586
parent: ca81d8ad5f3b478d933ea0b3604e12a2006af6c5
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Sep 16 15:01:19 EDT 2015

Add futex op constants.

    Needed for Linux libthread.

--- a/6/asm.h
+++ b/6/asm.h
@@ -71,6 +71,7 @@
 
 struct Blob {
     Blobtype type;
+    size_t align;
     char *lbl;  /* may be null */
     char isglobl;
     union {
--- a/6/gengas.c
+++ b/6/gengas.c
@@ -379,6 +379,7 @@
     lbl = htget(globls, blob);
     if (blob->decl.vis != Visintern)
         fprintf(fd, ".globl %s\n", lbl);
+    fprintf(fd, ".align %zd\n", tyalign(decltype(blob)));
     fprintf(fd, "%s:\n", lbl);
     if (blob->decl.init)
         b = litblob(globls, strtab, blob->decl.init);
--- a/lib/sys/sys+linux-x64.myr
+++ b/lib/sys/sys+linux-x64.myr
@@ -26,6 +26,8 @@
 
 	type pollevt	= uint16
 
+	type futexop	= uint32
+
 	type clock = union
 		`Clockrealtime
 		`Clockmonotonic
@@ -244,6 +246,14 @@
 	const Epollwakeup	: epollevttype = 1 << 29
 	const Epolloneshot	: epollevttype = 1 << 30
 	const Epolledge	: epollevttype = 1 << 31
+	
+	/* futex ops */
+	const Futexwait	: futexop = 0
+	const Futexwake	: futexop = 1
+	/* Futexfd: removed */
+	const Futexrequeue	: futexop  = 3
+	const Futexpriv	: futexop = 128
+	const Futexclockrt	: futexop = 256
 
 	/* poll events : posix */
 	const Pollin	: pollevt = 0x001	/* There is data to read.  */
@@ -632,8 +642,8 @@
 	const dup2	: (src : fd, dst : fd -> fd)
 
 	/* threading */
-	const futex	: (uaddr : int32#, op : int32, val : int32, \
-		ts : timespec#, uaddr2 : int#, val3 : int# -> int64)
+	const futex	: (uaddr : int32#, op : futexop, val : int32, \
+		timeout : timespec#, uaddr2 : int#, val3 : int -> int64)
 
 	/* polling */
 	const epollcreate	: (flg : epollflags	-> fd)	/* actually epoll_create1 */