yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | /* |
| 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 |
| 14 | static __inline__ _syscall2(int, __syscall_mq_notify, int, mqdes, |
| 15 | const void *, notification); |
| 16 | |
| 17 | /* Register notification upon message arrival to an empty message queue */ |
| 18 | int 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 |