diff options
author | Eric Andersen <andersen@codepoet.org> | 2005-01-11 09:41:40 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2005-01-11 09:41:40 +0000 |
commit | 50a6ac7fb90ad4008b354ff8e72c6ce511dbeb3a (patch) | |
tree | bbfa2262a83889c6aeed9e9017df8517536e3b4a /librt/mq_notify.c | |
parent | 45a95a466117aee2cd60f97be8310b6a04197244 (diff) |
Patch from Paul Mundt (lethal) adding an initial librt implementation.
I then reworked the syscall handling and made minor cleanups. With luck
I've not completely broken his patch...
Diffstat (limited to 'librt/mq_notify.c')
-rw-r--r-- | librt/mq_notify.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/librt/mq_notify.c b/librt/mq_notify.c new file mode 100644 index 000000000..4e7953242 --- /dev/null +++ b/librt/mq_notify.c @@ -0,0 +1,28 @@ +/* + * mq_notify.c - notify process that a message is available. + */ + +#include <errno.h> +#include <stddef.h> +#include <sys/syscall.h> + +#include <mqueue.h> + +#ifdef __NR_mq_notify + +#define __NR___syscall_mq_notify __NR_mq_notify +static inline _syscall2(int, __syscall_mq_notify, int, mqdes, + const void *, notification); + +/* Register notification upon message arrival to an empty message queue */ +int mq_notify(mqd_t mqdes, const struct sigevent *notification) +{ + /* We don't support SIGEV_THREAD notification yet */ + if (notification != NULL && notification->sigev_notify == SIGEV_THREAD) { + __set_errno(ENOSYS); + return -1; + } + return __syscall_mq_notify(mqdes, notification); +} + +#endif |