Unix system processes for sigterm, SIGUSR1, and SIGUSR2 signal processing
Vfhky | Time: 2015-08-05-17:41 | Category: CSeries
Long time no update blog, write an article in addition to weeding. This article focuses on a simple example of
Linux embedded due to a number of limitations, debugging methods are limited, often appear to face bugs helpless situation, now introduced a signal processing of Linux embedded applications debugging methods.
Linux in a total of 32 kinds of signals,
SIGUSR1 user-defined signal default processing: Process terminationSIGUSR2 user-defined signal default processing: Process terminationWhen a process calls fork, because the child process replicates the storage image of the parent process at the
When you use GDB or CDT to encrypt qemu, it will stop fire SIGUSR1, and GDB will stop at some of the nodes that are not set by you. To disable SIGUSR1, use the following method:
(GDB) info signal SIGUSR1
Signal stop print pass to program
Topic 3:Write a program to implement the countdown Exit function, when the process receives the SIGUSR1 signal to start the countdown, 3 seconds after exiting the program.The process of requiring output from the terminal to receive a signal and
1. Signal Set and signal set processing functions
A signal set is a single vector, each of which corresponds to a signal of the Linux system. You can use the following functions to process the signal set:
# Include
Int sigemptyset (sigset_t * Set
1. Signal pending and blocking"Signal status:
The "pending" Status of the signal refers to the period from the generation of the signal to the time before the signal is processed. The "blocking" Status of the signal is a switching action, it
Signal mounting signaltypedef void (*__sighandler_t) (int);__sighandler_t Signal (int __sig, __sighandler_t __handler) : The signal handler is installed, the 1th parameter is the received signal, the 2nd parameter is the function pointer that is
Changing the signal screen word of a process can block the selected signal or unblock them. Use this technique to protect code critical sections that you do not want to be interrupted by a signal. What if you want to unblock a signal and then pause
the concept of a signal
Signal (signal)--the way communication between processes is a software interrupt. Once a process receives a signal, it interrupts the original program execution process to process the signal.
Several common signals:
SIGINT
The concept of the signal
Signal (signal)--the way communication between processes is a software outage. Once a process receives a signal, it interrupts the original program execution process to process the signal.
Several common signals:
SIGINT
Signal () function to describe Linux functions in detail
A signal (signal) is a interprocess communication mechanism that provides an application with an asynchronous software interrupt that gives the application the opportunity to accept
1. Shielding SIGUSR1 signals in the main thread2. creat the two subthreads write and read to cancel the blocking of SIGUSR1 in the write thread.
3. The SIGUSR1 signal sent from other processes will be accepted by the write thread.
Sigprocmask is
Each thread has its own signal shielding word, but the signal processing is shared by all threads in the process.
This means that although a single thread can block some signals, when the thread modifies the processing behavior related to a certain
Lien0000342014-10-291. Concept of Signal
The description of signals in Wikipedia is as follows:
In computer science, signals (English: Signals) are a restricted way of inter-process communication in UNIX, Unix-like, and other POSIX-compatible
A signal is a software interrupt, an asynchronous communication method that handles an asynchronous event. For example, we run the program in the terminal, by pressing the keyboard "CTRL + C", you can send a SIGINT interrupt signal to stop the
The main differences between POSIX Message Queuing and System V Message Queuing are:1. The total number of reads to the POSIX queue returns the highest priority to the oldest message, and the SV queue to read can return any specified priority
Each process has a different user address space, the global variables of any one process can not be seen in another process, so the process to exchange data between the kernel, the kernel to open a buffer, process 1 data from the user space to the
Today, customers are asked to provide a MONGO log cleanup solution, and the customer provides a KILL-SIGUSR1 way to record the learning and testing process as well as several other log cleanup methods.Method 1: Use Db.runcommand ({logrotate:1}) in
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.