blob: 2556669b75886dd82a340304219b72b7363eaf93 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/*
2 * mq_notify.c - notify process that a message is available.
3 */
4
5#include <errno.h>
6#include <stddef.h>
7#include <sys/syscall.h>
8
9#include <mqueue.h>
10
11#ifdef __NR_mq_notify
12
13#define __NR___syscall_mq_notify __NR_mq_notify
14static __inline__ _syscall2(int, __syscall_mq_notify, int, mqdes,
15 const void *, notification);
16
17/* Register notification upon message arrival to an empty message queue */
18int mq_notify(mqd_t mqdes, const struct sigevent *notification)
19{
20 /* We don't support SIGEV_THREAD notification yet */
21 if (notification != NULL && notification->sigev_notify == SIGEV_THREAD) {
22 __set_errno(ENOSYS);
23 return -1;
24 }
25 return __syscall_mq_notify(mqdes, notification);
26}
27
28#endif