PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
atnotify.c
Go to the documentation of this file.
1#include <user/common/note.h>
2
3#include <sys/proc.h>
4
5#include <errno.h>
6
8{
9 if (func == NULL)
10 {
11 errno = EINVAL;
12 return ERR;
13 }
14
15 switch (action)
16 {
17 case ATNOTIFY_ADD:
18 if (_note_handler_add(func) == ERR)
19 {
20 errno = ENOMEM;
21 return ERR;
22 }
23 break;
24 case ATNOTIFY_REMOVE:
26 break;
27 default:
28 errno = EINVAL;
29 return ERR;
30 }
31
32 return 0;
33}
#define EINVAL
Invalid argument.
Definition errno.h:142
#define ENOMEM
Out of memory.
Definition errno.h:92
#define errno
Error number variable.
Definition errno.h:27
atnotify_t
Action type for atnotify().
Definition proc.h:310
uint64_t(* atnotify_func_t)(char *note)
User space atnotify() handler function type.
Definition proc.h:318
uint64_t atnotify(atnotify_func_t func, atnotify_t action)
Adds or removes a handler to be called in user space when a note is received.
Definition atnotify.c:7
@ ATNOTIFY_REMOVE
Definition proc.h:312
@ ATNOTIFY_ADD
Definition proc.h:311
#define NULL
Pointer error value.
Definition NULL.h:23
#define ERR
Integer error value.
Definition ERR.h:17
uint64_t _note_handler_add(atnotify_func_t func)
Definition note.c:76
void _note_handler_remove(atnotify_func_t func)
Definition note.c:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:17