I know we're well behind 0.9.30 (there are various issues relating to
GCC bumps which in turn rely on libgsm fixes, etc that are slowly being
worked out that stop us from running something more recent) on the
astlinux project...  but we're trying workarounds to be able to make
some progress rather than being roadblocked altogether.

I was trying to add semtimedop() into 0.9.28 based on this posting:

http://lists.busybox.net/pipermail/uclibc-cvs/2008-January/024561.html

but changing __syscall_ipc to use _syscall6 instead of _syscall5 and
adding an extra 0 parameter everywhere seemed a bit heavy-handed, so I
tried to do something more lightweight.

Unfortunately, I'm stalled on a couple of issues including how to add
ASMFMT_6.

Can someone help us out?  This is what we have.

Thanks,

-Philip

diff -urN ../a/uClibc-0.9.28/include/sys/sem.h uClibc-0.9.28/include/sys/sem.h
--- ../a/uClibc-0.9.28/include/sys/sem.h        2005-08-17 16:49:41.000000000 
-0600
+++ uClibc-0.9.28/include/sys/sem.h     2010-02-06 17:03:30.000000000 -0700
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,6 +30,11 @@
 /* Get system dependent definition of `struct semid_ds' and more.  */
 #include <bits/sem.h>
 
+#ifdef __USE_GNU
+# define __need_timespec
+# include <time.h>
+#endif
+
 /* The following System V style IPC functions implement a semaphore
    handling.  The definition is found in XPG2.  */
 
@@ -53,6 +58,12 @@
 /* Operate on semaphore.  */
 extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW;
 
+#ifdef __USE_GNU
+/* Operate on semaphore with timeout.  */
+extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops,
+                      __const struct timespec *__timeout) __THROW;
+#endif
+
 __END_DECLS
 
 #endif /* sys/sem.h */
diff -urN ../a/uClibc-0.9.28/libc/misc/sysvipc/ipc.h 
uClibc-0.9.28/libc/misc/sysvipc/ipc.h
--- ../a/uClibc-0.9.28/libc/misc/sysvipc/ipc.h  2005-08-17 16:49:48.000000000 
-0600
+++ uClibc-0.9.28/libc/misc/sysvipc/ipc.h       2010-02-06 17:12:32.000000000 
-0700
@@ -9,12 +9,16 @@
 /* The actual system call: all functions are multiplexed by this.  */
 extern int __syscall_ipc __P((int __call, int __first, int __second,
                                          int __third, void *__ptr));
+extern int __syscall_ipc6 __P((int __call, int __first, int __second,
+                                          int __third, void *__ptr,
+                                          void *__fifth));
 
 
 /* The codes for the functions to use the multiplexer `__syscall_ipc'.  */
 #define IPCOP_semop     1
 #define IPCOP_semget    2
 #define IPCOP_semctl    3
+#define IPCOP_semtimedop 4
 #define IPCOP_msgsnd   11
 #define IPCOP_msgrcv   12
 #define IPCOP_msgget   13
diff -urN ../a/uClibc-0.9.28/libc/misc/sysvipc/Makefile 
uClibc-0.9.28/libc/misc/sysvipc/Makefile
--- ../a/uClibc-0.9.28/libc/misc/sysvipc/Makefile       2005-08-17 
16:49:48.000000000 -0600
+++ uClibc-0.9.28/libc/misc/sysvipc/Makefile    2010-03-07 17:23:13.000000000 
-0700
@@ -27,7 +27,7 @@
 DIRS=
 
 MSRC=sem.c
-MOBJ=semget.o semctl.o semop.o
+MOBJ=semget.o semctl.o semop.o semtimedop.o
 
 MSRC2=shm.c
 MOBJ2=shmat.o shmctl.o shmdt.o shmget.o
@@ -35,7 +35,7 @@
 MSRC3=msgq.c
 MOBJ3=msgctl.o msgget.o msgrcv.o msgsnd.o
 
-CSRC = ftok.c 
+CSRC = ftok.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 
 OBJS=$(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS)
diff -urN ../a/uClibc-0.9.28/libc/misc/sysvipc/sem.c 
uClibc-0.9.28/libc/misc/sysvipc/sem.c
--- ../a/uClibc-0.9.28/libc/misc/sysvipc/sem.c  2005-08-17 16:49:48.000000000 
-0600
+++ uClibc-0.9.28/libc/misc/sysvipc/sem.c       2010-02-13 17:58:08.000000000 
-0700
@@ -88,3 +88,18 @@
 }
 #endif
 #endif
+
+#ifdef L_semtimedop
+
+#ifdef __NR_semtimedop
+_syscall4(int, semtimedop, int, semid, struct sembuf *, sops, size_t, nsops, 
const struct timespec *, timeout);
+
+#else
+
+int semtimedop(int semid, struct sembuf *sops, size_t nsops,
+              const struct timespec *timeout)
+{
+    return __syscall_ipc5(IPCOP_semtimedop, semid, nsops, 0, sops, timeout);
+}
+#endif
+#endif
diff -urN ../a/uClibc-0.9.28/libc/misc/sysvipc/semtimedop.c 
uClibc-0.9.28/libc/misc/sysvipc/semtimedop.c
--- ../a/uClibc-0.9.28/libc/misc/sysvipc/semtimedop.c   1969-12-31 
17:00:00.000000000 -0700
+++ uClibc-0.9.28/libc/misc/sysvipc/semtimedop.c        2010-02-13 
17:59:57.000000000 -0700
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_semtimedop
+#include "sem.c"
diff -urN ../a/uClibc-0.9.28/libc/sysdeps/linux/common/bits/syscalls.h 
uClibc-0.9.28/libc/sysdeps/linux/common/bits/syscalls.h
--- ../a/uClibc-0.9.28/libc/sysdeps/linux/common/bits/syscalls.h        
2005-08-17 16:49:42.000000000 -0600
+++ uClibc-0.9.28/libc/sysdeps/linux/common/bits/syscalls.h     2010-03-07 
17:16:40.000000000 -0700
@@ -6,5 +6,5 @@
  */ 
 
 
-#error You have not provided architecture specific _syscall[0-5] macros
+#error You have not provided architecture specific _syscall[0-6] macros
 
diff -urN ../a/uClibc-0.9.28/libc/sysdeps/linux/i386/bits/syscalls.h 
uClibc-0.9.28/libc/sysdeps/linux/i386/bits/syscalls.h
--- ../a/uClibc-0.9.28/libc/sysdeps/linux/i386/bits/syscalls.h  2005-08-17 
16:49:43.000000000 -0600
+++ uClibc-0.9.28/libc/sysdeps/linux/i386/bits/syscalls.h       2010-03-07 
17:30:38.000000000 -0700
@@ -100,6 +100,14 @@
 return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \
 }
 
+#undef _syscall6
+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
+         type5,arg5,type6,arg6) \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6) 
\
+{ \
+return (type) (INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6)); \
+}
+
 #define INLINE_SYSCALL(name, nr, args...) \
   ({                                                                         \
     unsigned int resultvar;                                                  \
@@ -125,6 +133,7 @@
 #define LOADARGS_3     LOADARGS_1
 #define LOADARGS_4     LOADARGS_1
 #define LOADARGS_5     LOADARGS_1
+#define LOADARGS_6     LOADARGS_1
 
 #define RESTOREARGS_0
 #define RESTOREARGS_1 \
@@ -133,6 +142,7 @@
 #define RESTOREARGS_3  RESTOREARGS_1
 #define RESTOREARGS_4  RESTOREARGS_1
 #define RESTOREARGS_5  RESTOREARGS_1
+#define RESTOREARGS_6  RESTOREARGS_1
 
 #define ASMFMT_0()
 #define ASMFMT_1(arg1) \
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to