-/* 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
/* 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. */
/* 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 */
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := ftok.c
+CSRC := ftok.c __syscall_ipc.c
# multi source sem.c
-CSRC += semget.c semctl.c semop.c
+CSRC += semget.c semctl.c semop.c semtimedop.c
# multi source shm.c
CSRC += shmat.c shmctl.c shmdt.c shmget.c
#ifdef __NR_ipc
#define __NR___syscall_ipc __NR_ipc
-#include "../../../misc/sysvipc/ipc.h"
-_syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int,
- third, void *, ptr);
+#include "ipc.h"
+_syscall6(int, __syscall_ipc, unsigned int, call, long, first, long, second, long,
+ third, void *, ptr, void *, fifth);
#endif
#ifdef __NR_ipc
/* The actual system call: all functions are multiplexed by this. */
-extern int __syscall_ipc (unsigned int __call, int __first, int __second,
- int __third, void *__ptr) attribute_hidden;
+extern int __syscall_ipc (unsigned int __call, long __first, long __second,
+ long __third, void *__ptr, void *__fifth) attribute_hidden;
/* 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
#ifdef __NR_msgctl
return __libc_msgctl(msqid, cmd | __IPC_64, buf);
#else
- return __syscall_ipc(IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf);
+ return __syscall_ipc(IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf, 0);
#endif
}
#endif
/* Get messages queue. */
int msgget (key_t key, int msgflg)
{
- return __syscall_ipc(IPCOP_msgget ,key ,msgflg ,0 ,0);
+ return __syscall_ipc(IPCOP_msgget ,key ,msgflg ,0 ,0, 0);
}
#endif
#endif
temp.r_msgtyp = msgtyp;
temp.oldmsg = msgp;
- return __syscall_ipc(IPCOP_msgrcv ,msqid ,msgsz ,msgflg ,&temp);
+ return __syscall_ipc(IPCOP_msgrcv ,msqid ,msgsz ,msgflg ,&temp, 0);
}
#endif
#endif
/* Send message to message queue. */
int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
{
- return __syscall_ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp);
+ return __syscall_ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp, 0);
}
#endif
#endif
#ifdef __NR_semctl
return __semctl(semid, semnum, cmd | __IPC_64, arg.__pad);
#else
- return __syscall_ipc(IPCOP_semctl, semid, semnum, cmd | __IPC_64, &arg);
+ return __syscall_ipc(IPCOP_semctl, semid, semnum, cmd | __IPC_64, &arg, 0);
#endif
}
#endif
* with KEY. */
int semget (key_t key, int nsems, int semflg)
{
- return __syscall_ipc(IPCOP_semget, key, nsems, semflg, NULL);
+ return __syscall_ipc(IPCOP_semget, key, nsems, semflg, NULL, 0);
}
#endif
#endif
/* Perform user-defined atomical operation of array of semaphores. */
int semop (int semid, struct sembuf *sops, size_t nsops)
{
- return __syscall_ipc(IPCOP_semop, semid, (int) nsops, 0, sops);
+ return __syscall_ipc(IPCOP_semop, semid, (int) nsops, 0, sops, 0);
+}
+#endif
+#endif
+
+#ifdef L_semtimedop
+
+#ifdef __NR_semtimedop
+_syscall6(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_ipc(IPCOP_semtimedop, semid, nsops, 0, sops, timeout);
}
#endif
#endif
--- /dev/null
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_semtimedop
+#include "sem.c"
int retval;
unsigned long raddr;
- retval = __syscall_ipc(IPCOP_shmat, shmid, shmflg, (int) &raddr, (void *) shmaddr);
+ retval = __syscall_ipc(IPCOP_shmat, shmid, shmflg, (int) &raddr, (void *) shmaddr, 0);
return ((unsigned long int) retval > -(unsigned long int) SHMLBA
? (void *) retval : (void *) raddr);
}
#ifdef __NR_shmctl
return __libc_shmctl(shmid, cmd | __IPC_64, buf);
#else
- return __syscall_ipc(IPCOP_shmctl, shmid, cmd | __IPC_64, 0, buf);
+ return __syscall_ipc(IPCOP_shmctl, shmid, cmd | __IPC_64, 0, buf, 0);
#endif
}
#endif
#else
int shmdt (const void *shmaddr)
{
- return __syscall_ipc(IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
+ return __syscall_ipc(IPCOP_shmdt, 0, 0, 0, (void *) shmaddr, 0);
}
#endif
#endif
#else
int shmget (key_t key, size_t size, int shmflg)
{
- return __syscall_ipc(IPCOP_shmget, key, size, shmflg, NULL);
+ return __syscall_ipc(IPCOP_shmget, key, size, shmflg, NULL, 0);
}
#endif
#endif