# IPC - [Overview](#section1091545606165622) - [Summary](#section1598747749165622) - [Files](#files) - [Data Structures](#nested-classes) - [Macros](#define-members) - [Typedefs](#typedef-members) - [Functions](#func-members) - [Details](#section429935514165622) - [Function](#section870563513165622) - [kill\(\)](#ga4539db972bcf3dd8c8b429af0dc3789d) - [mq\_close\(\)](#ga3fbd3906296be63451c64d69be2bc371) - [mq\_getattr\(\)](#ga8fafe8b1183830322f8ff875f4e6cb4c) - [mq\_open\(\)](#gaf5d8bf423701bd1783849119511381a5) - [mq\_receive\(\)](#gafcd715bf914289ca502136ef7022eab7) - [mq\_send\(\)](#ga2d07e256d809a61bdc82178cb0dd1ba1) - [mq\_setattr\(\)](#gaf5cc07adf7823fac8611200b55fc3a27) - [mq\_timedreceive\(\)](#gaa291cc1bc8bb02fd24bd0d4c563350f4) - [mq\_timedsend\(\)](#gae59709d01cc34d009edfeae9900568cb) - [mq\_unlink\(\)](#gaccd8c5ee36e60d990963e1d544ef4140) - [psignal\(\)](#gada1fed9730b224a68e768e5f2eac53ff) - [pthread\_sigmask\(\)](#ga8ca5be75c386a4aacd17be00721bf0f8) - [raise\(\)](#ga350675984ca13ce9b056e69098bda5c6) - [sem\_close\(\)](#ga4e398fea1080fd7919e5c72ee94e2fc5) - [sem\_destroy\(\)](#ga6bc9a7dd941a9b5e319715b767af5682) - [sem\_getvalue\(\)](#ga934bcc3cbc0c67a9e3a8e7a43c023460) - [sem\_init\(\)](#ga532509bd8a6499f8193253192fb83a3d) - [sem\_post\(\)](#ga015dce85cab8477c679cc47968958247) - [sem\_timedwait\(\)](#ga9d832817226c594e7628e2cc7ed7d723) - [sem\_trywait\(\)](#ga4de7a9a334b01b6373b017aaefa07cf0) - [sem\_unlink\(\)](#ga776256d1a473906f8b7490689bfcb75c) - [sem\_wait\(\)](#gaad70020dca2241a2b78e272ca033271b) - [sigaction\(\)](#ga5263ce0feb3eb0934bc56ab81cae8ddb) - [sigaddset\(\)](#gae412e6a5436a6c28424b0173251d349c) - [sigandset\(\)](#ga2a0910ff9d18931a05b995143dc4576e) - [sigdelset\(\)](#gab0025e4f32ce2737c40cc0074cc6d7d2) - [sigemptyset\(\)](#ga5925352f90eb589393274fa0376d7def) - [sigfillset\(\)](#ga88d7bbc77ea1569ee21c90db549ea023) - [sighold\(\)](#ga4378a40ea3370c436d4e46c7a2a58172) - [sigisemptyset\(\)](#gac41035aa05cb4523ae93e8a6d55f9453) - [sigismember\(\)](#ga63693cc65f43d772729b588b453fe1ef) - [signal\(\)](#gaf0f8ed40d30773bdb68e858ef0139b58) - [sigorset\(\)](#ga1a0d037b7fd84fb392a4c2ffc6c3525c) - [sigpause\(\)](#ga95a78da8c44db11c7031b678504d0b34) - [sigpending\(\)](#ga7b91eecad5998acd6162fde3ab530d7a) - [sigprocmask\(\)](#gae11d1cbeb529d0050ab5600fe4b5fef9) - [sigrelse\(\)](#ga96c4aed60b8b727709887e1fae0f5bea) - [sigsuspend\(\)](#gae5f92586ad50092a7813465eeef792c0) - [sigtimedwait\(\)](#ga155a526c3da5ffd1a79ba2925bdd278a) - [sigwait\(\)](#ga900d91a9635b965dbbae6b3cee2d2a2b) - [sigwaitinfo\(\)](#ga786f18a8e5b7eceed0ddcdc722f3340b) ## **Overview** **Description:** Provides functions and structures related to inter-process communication \(IPC\), including signals, semaphores, and message queues. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files
Describes the signal processing actions and related attributes. |
|
Defines the input parameter used to obtain information from the kernel. |
|
SEM_FAILED ((sem_t *)0) |
|
Stops a child process without sending the SIGCHLD signal. |
|
Sets the SIGCHLD flag to prevent zombie processes. |
|
Uses the signal stack specified by sigaltstack for signal processing. |
|
The signals being processed are not masked during signal processing. |
|
The default processing mode is restored after the signal processing is complete. |
|
_NSIG_BPW __BITS_PER_LONG |
|
Equivalent to SIGABRT. |
|
Virtual timer, used to calculate the CPU occupation time of a process. |
|
Calculates the CPU time occupied by a process and the system calling time. |
|
SIGPOLL SIGIO |
Equivalent to SIGIO. |
Equivalent to SIGSYS. |
|
SIGRTMAX _NSIG |
|
Transfers signals in a 32-bit mode even if the task runs in a 26-bit mode. |
|
SA_NOMASK SA_NODEFER |
Signals being processed are not masked during signal processing. |
SA_ONESHOT SA_RESETHAND |
The default processing mode is restored after the signal processing is complete. |
Defines the function behaviors such as sigprocmask() and pthread_sigmask(), which are used to add signals to the mask set. |
|
Defines the function behaviors such as sigprocmask() and pthread_sigmask(), which are used to remove signals from the mask set. |
|
Defines the function behaviors such as sigprocmask() and pthread_sigmask(), which are used to set the mask set. |
|
Defines the function behaviors such as sigset() and adds a specified signal to the process signal mask without changing the current processing mode of the signal. |
|
Defines the simplified writing used to indicate the __sa_handler.sa_handler field in sigaction. |
|
Defines the simplified writing used to indicate the __sa_handler.sa_sigaction field in sigaction. |
|
Sets the notification method in sigevent: signal notification. |
|
Sets the notification method in sigevent: no notification. |
|
Sets the notification method in sigevent: thread notification. |
|
Defines the value returned when a function such as signal() fails. |
|
Defines the signal processing mode in which the signal is ignored. |
|
Defines the input parameter used together with IPC_CREAT to prevent duplicate key values during IPC creation. |
|
Defines the input parameter that specifies whether the communication is in non-blocking mode. |
|
Defines the input parameter used to set information to the kernel. |
|
Defines the input parameter used to obtain the system-level restriction information of a specified communication type, for example, shminfo. |
|
IPC_PRIVATE ((key_t) 0) |
typedef struct __ucontext |
|
mq_getattr (mqd_t mqdes, struct mq_attr *attr) |
Obtains the attributes of the message queue specified by the descriptor. The values of mq_maxmsg, mq_msgsize, and mq_curmsgs are fixed. |
mq_open (const char *name, int oflag,...) |
|
mq_receive (mqd_t mqdes, char *buffer, size_t size, unsigned *prioptr) |
|
mq_send (mqd_t mqdes, const char *buffer, size_t size, unsigned prio) |
|
mq_setattr (mqd_t mqdes, const struct mq_attr *__restrict newattr, struct mq_attr *__restrict oldattr) |
Sets the attributes of the message queue specified by the descriptor. The mq_maxmsg, mq_msgsize, and mq_curmsgs attributes cannot be modified. mq_flags supports the O_NONBLOCK attribute only. |
mq_timedreceive (mqd_t mqdes, char *__restrict buffer, size_t size, unsigned *__restrict prioptr, const struct timespec *__restrict timeout) |
Receives a message from the message queue, with a timeout period specified. |
mq_timedsend (mqd_t mqdes, const char *buffer, size_t size, unsigned prio, const struct timespec *timeout) |
Sends a message to a specified message queue, with a timeout period specified. |
mq_unlink (const char *name) |
Decreases the reference count of the message queue by 1, or deletes the message queue if the reference count is 0. |
sem_destroy (sem_t *sem) |
Destroys a specified anonymous semaphore that is no longer used. |
sem_getvalue (sem_t *__restrict sem, int *__restrict sval) |
|
sem_timedwait (sem_t *__restrict sem, const struct timespec *__restrict timeout) |
|
sem_trywait (sem_t *sem) |
|
sem_unlink (const char *name) |
|
sigemptyset (sigset_t *set) |
|
sigfillset (sigset_t *set) |
|
sigaddset (sigset_t *set, int signum) |
|
sigdelset (sigset_t *set, int signum) |
|
sigismember (const sigset_t *set, int signum) |
|
sigprocmask (int how, const sigset_t *__restrict set, sigset_t *__restrict oldset) |
|
sigsuspend (const sigset_t *mask) |
Sets mask as the signal mask set of the current process and suspends the process until a signal processing action is triggered. |
sigaction (int signum, const struct sigaction *__restrict act, struct sigaction *__restrict oldact) |
Checks or changes the processing action associated with a specified signal. Do not use the process creation function or thread creation function in the registered callback processing function. Otherwise, the process is abnormal. For example, do not use the fork or pthread_create function. |
sigpending (sigset_t *set) |
|
sigwait (const sigset_t *__restrict set, int *__restrict sig) |
|
sigwaitinfo (const sigset_t *__restrict set, siginfo_t *__restrict info) |
Suspends the calling thread and waits for the signal, with a timeout period specified. |
sigtimedwait (const sigset_t *__restrict set, siginfo_t *__restrict info, const struct timespec *__restrict timeout) |
Suspends the calling thread and waits for the signal, with a timeout period specified. |
pthread_sigmask (int how, const sigset_t *__restrict set, sigset_t *__restrict oldset) |
|
psignal (int signum, const char *s) |
|
sigpause (int signum) |
Deletes the signal specified by signum from the signal mask of the calling process and suspends the process until the signal is received. |
sighold (int signum) |
Adds the signal specified by signum to the signal mask of the calling process. |
sigrelse (int signum) |
Deletes the signal specified by signum from the signal mask of the calling process. |
sigisemptyset (const sigset_t *set) |
|
sigorset (sigset_t *dest, const sigset_t *left, const sigset_t *right) |
|
sigandset (sigset_t *dest, const sigset_t *left, const sigset_t *right) |
|
signal (int signum, sighandler_t handler) |
Changes the processing action of a specified signal. Do not use the process creation function or thread creation function in the registered callback processing function. Otherwise, the process is abnormal. For example, do not use the fork or pthread_create function. |
raise (int signum) |
| pid | Indicates the target process ID. Parameters 0 and -1 are not supported. |
| sig | Indicates the signal to be sent. |
The current process does not have permission to send the signal to the target process. |
| mqdes | Indicates the descriptor of the message queue to be closed. |
Failed to release the space allocated with the message queue. |
|
mqdes is invalid when the message queue is deleted in the function. |
| mqdes | Indicates the message queue descriptor. |
| attr | Indicates the pointer to the obtained message queue attributes. |
| name | Indicates the name of the message queue to be created or opened. The maximum value is 259 bytes. |
| oflag | Indicates the open flag, including O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, and O_NONBLOCK. |
| mode | Used for permission control (not supported currently). Its type is mode_t. This is parameter is required only during the creation of a message queue. |
| attr | Indicates the pointer to the queue attributes to be set. Its type is struct mq_attr. This parameter is optional and is used only during the creation of a message queue. |
Both O_CREAT and O_EXCL are specified in oflag, and a queue with this name already exists. |
|
O_CREAT is specified in oflag, and attr is invalid. To be specific, the attribute value of the mq_maxmsg field is less than 0 or greater than USHRT_MAX, or the attribute value of mq_msgsize is less than 0 or greater than USHRT_MAX-4. name is NULL, or the length of the string specified by name is 0. |
|
O_CREAT is not specified in oflag, and no queue with this name exists. |
|
The message queue is full, and O_NONBLOCK is set for the message queue associated with mqdes. |
|
The size of the message to be sent is greater than the message size attribute of the message queue. |
|
| mqdes | Indicates the message queue descriptor. |
| newattr | Indicates the pointer to the message queue attribute to be set. |
| oldattr | Indicates the pointer to the original attribute. |
| name | Indicates the message queue name. |
name is NULL, or the length of the string specified by name is 0. |
| signum | Indicates the signal to be operated. |
| s | Indicates the customized string s to be printed. |
| how | Indicates the function behavior. |
| set | Indicates the signal set to be changed. |
| oldset | Used for returning the original mask set of the calling thread. |
The set or oldset points outside the process's allocated address space. |
| signum | Indicates the signal to be sent. |
| sem | Indicates the pointer to the semaphore to close. |
| sem | Indicates the pointer to the semaphore to destroy. |
| sem | Indicates the pointer to the semaphore. |
| sval | Indicates the pointer to the obtained count value. |
The input parameters are invalid and the initial count value exceeds the limit. |
| sem | Indicates the pointer to the semaphore to be operated. |
| sem | Indicates the pointer to the semaphore to be operated. |
| timeout | Indicates the timeout period to be set. |
The semaphore is set to non-blocking mode, and the semaphore count is 0. |
|
| sem | Indicates the pointer to the semaphore to be operated. |
The semaphore is set to non-blocking mode, and the semaphore count is 0. |
| name | Indicates the name of the semaphore to be deleted. |
| sem | Indicates the pointer to the semaphore to be obtained. |
The semaphore is set to non-blocking mode, and the semaphore count is 0. |
| signum | Indicates the signal to be operated. |
| act | Indicates the new signal processing action. |
| oldact | Indicates the original signal processing action if the value is not NULL. |
| set | Indicates the pointer to the signal set to hold signals. |
| signum | Indicates the signal to be added. |
| dest | Indicates the pointer to the target signal set. |
| left | Indicates the left set to be added. |
| right | Indicates the right set to be added. |
| set | Indicates the pointer to the signal set to hold signals. |
| signum | Indicates the signal to be deleted. |
| set | Indicates the pointer to the signal set to be cleared. |
| set | Indicates the pointer to the signal set to hold signals. |
| signum | Indicates the signal to be added. |
| set | Indicates the pointer to the signal set to be checked. |
| set | Indicates the pointer to the signal set to be checked. |
| signum | Indicates the signal to be checked. |
| signum | Indicates the signal to be operated. |
| handler | Indicates the pointer to the specified processing action (SIG_IGN or SIG_DFL, or to a custom processing action. |
| dest | Indicates the pointer to the target signal set. |
| left | Indicates the left set to be added. |
| right | Indicates the right set to be added. |
| signum | Indicates the signal to be operated. |
| set | Indicates the pointer to the signal set used to store the signal suspended by the current thread. |
| how | Indicates the function behavior. |
| set | Indicates the pointer to the signal set to be changed. |
| oldset | Indicates the pointer to the original mask set of the calling thread. |
The set or oldset points outside the process's allocated address space. |
| signum | Indicates the signal to be deleted. |
| mask | Indicates the pointer to the signal set to be set. |
| set | Indicates the pointer to the signal set to be waited. |
| info | Used to save the information about the waited signal if the value is not NULL. |
| timeout | Indicates the timeout duration. |
No signal specified by set is generated within the specified timeout period. |
|
| set | Indicates the pointer to the signal set to be waited. |
| sig | Used for saving the waited signal. |
| set | Indicates the pointer to the signal set to be waited. |
| info | Used to save the information about the waited signal if the value is not NULL. |