-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsigmsg.h
More file actions
32 lines (21 loc) · 1.31 KB
/
sigmsg.h
File metadata and controls
32 lines (21 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _SIGMSG_H
#define _SIGMSG_H
#include <sys/shm.h>
#define MAX_SIGMSG_SZ 256
typedef void (*sigmsghnd)(int sig, const void *msgp, size_t msgsz, void *userp);
struct sigmsgid_ds {
// TODO: add fields of shmid_ds
shmatt_t sigmsg_nattch; /* No. of current attaches */
};
int sigmsgctl (key_t key, int cmd, struct sigmsgid_ds *buf);
int sigmsginit (key_t key, int msgflg); // initialize the message canal
int sigmsgreg (int sig, sigmsghnd func, void *userp); // register a function which will be called on a received message
int sigmsgsend (int sig, const void *msgp, size_t msgsz); // send a message on the canal
int sigmsgans (const void *msgp, size_t msgsz); // answer to a message on the canal (you need to be in the signal handler to call it)
int sigmsgtrans (int sig, void *msgp, size_t *msgsz); // send a message on the canal and get the answer immediately sent (if any)
inline
int sigmsglock (); // lock the canal [use at your own risks]
inline
int sigmsgunlock (); // unlock the canal [use at your own risks]
int sigmsgdeinit (int destroy); // deinit the message canal
#endif