Linux services)It is important for Linux users. Disabling unnecessary services can make Linux run more efficiently, but not all Linux services can be disabled. After installing centos Linux today, we found that many services were started when
Signal classification is unreliable signal VS. Reliable signalThe Linux signaling mechanism is basically inherited from Unix systems. The signaling mechanism in the early Unix system was relatively simple and primitive, and later exposed some problems in practice, and its main problems were:1. Each time the process processes the signal, the response to the signal is set to the default action. In some cases, it will cause error handling of the signal,
'); //Description is not a signal of the non-tactic status } printf ("\ n");}intMainintargcChar*argv[]) {sigset_t PSet; for (;;) {sigpending (PSet); //This function is a set of signals that gets the pset state of the process, stored in the Printsigset (PSet); //Print the status of the signal set to see if there is no state signal to produce sleep (1); } return 0;}"description": Sigpending is used to obtain all the non-tactic signal sets in the process:Now look at the effect of the ope
Simple Analysis of system functions in linux, linuxsystem Functions
1 int 2 __libc_system (const char *line) 3 { 4 if (line == NULL) 5 /* Check that we have a command processor available. It might 6 not be available after a chroot(), for example. */ 7 return do_system ("exit 0") == 0; 8 9 return do_system (line);10 }11 weak_alias (__libc_system, system)
The code is located in glibc/sysdeps/posix/system. c. Here, system is the we
In Linux, the Trap command is used primarily to receive signals and act, signals are sent asynchronously to a program's event, by default, a program can be terminated, and the Trap command prototype is as follows:
Trap command Signal
Signal is the signal received, the command is received by the signal to take action. The following are two simple signals.
Signal
Description
INT (2)
Ctrl + C
QUIT (3)
Ctrl + \
The sample code is as follows
[Root@localh
permissions for synchronization are 7552. Time Outrsync:failed to connect to 203.100.192.66:connection timed out (110)Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C (124) [receiver=3.0.5]Check the server's port NETSTAT–TUNLP, remote Telnet test.It is possible to set rules to release rsync (873 port) or to shut down the firewall directly because the firewall on the client or server is not able to communicate.There is also a way in the synchronization process may be prompted to do no
The Linux terminal closes the background process and ends the Cause Analysis and nohup usage. The background process nohup
Windows and Linux Remote connections (both called remote connections) are different:
1) after Windows Remote connection, if you run a program on a remote machine, you can log out of the connection and connect to the machine for a while to see if the connection has ended, that is to say,
first, what is the signalWe all know that with windows, when we can't end a program properly, we can force this process to end with the task manager, but how does it work? The same functionality is achieved on Linux by generating signals and capturing signals, and the running process captures the signal and then makes certain operations and ends up being terminated.The signal is an event that occurs when UNIX and
SIGALRM/SIGVTALRM, but includes the CPU time used by the process and the time of the system call.Sigwinch)emitted when the window size changes.) SIGIOThe file descriptor is ready to start the input/output operation.SIGPWR)Power failureSigsys)An illegal system call.In the signals listed above, the program can not capture, block or ignore the signal is: sigkill,sigstopSignals that cannot be restored to the default action are: Sigill,sigtrapThe default causes the process to abort the signal is: Si
signal. is similar to SIGALRM, but calculates the CPU time that is consumed by the process.SIGPROF)Similar to SIGALRM/SIGVTALRM, but includes the CPU time used by the process and the time of the system call.Sigwinch)emitted when the window size changes.) SIGIOThe file descriptor is ready to start the input/output operation.SIGPWR)Power failureSigsys)An illegal system call.In the signals listed above, the program can not capture, block or ignore the signal is: sigkill,sigstopSignals that cannot
Original URL: http://www.2cto.com/os/201108/98426.htmlInittab files in Linux
The init process number is 1 (ps-aux | Less), it can be seen from this point that the INIT process is the starting point for all processes in the system, and Linux starts to run the INIT program after it completes the kernel boot.
The INIT program needs to read the configuration file/etc/inittab. Inittab is a non-executa
Linux-(2) Basic file operations in Linux, linux-linux
In linux, everything is files, directories are files, and hardware is files. Therefore, basic file operations are especially important.
1. List the contents of the directory:
Ls
Parameters:
-A: displays all files (includ
Logout Exit SystemGedit Text Editor ToolsUname–r View kernel version information, uname–a more detailsCat/proc/cpuinfo viewing CPUsCat/proc/meminfo Viewing memoryHostname Viewing host namesIfconfig eth0 view eth0 IP AddressAlias ls= ' ls–ll ' setting aliasesTo view the path of the current terminal: TTYView current Shell:echo $SHELLAll Shell:cat/etc/shells under the current systemView CentOS System hostname Format: Echo $PS 1Distinguish internal or external commands: Type CDWhich find the locatio
The init process number is 1 (ps-aux | less). From this point, we can see that the init process is the starting point of all processes in the system. After Linux completes the kernel boot, start to run the init program.
The init program needs to read the configuration file/etc/inittab. Inittab is an unexecutable text file consisting of several lines of commands.
Understand Runlevel:
Runlevel is used to indicate the state of the system after the init p
Signal processing is a feature of Linux programs. Signal processing is used to simulate the interrupt function of the operating system. To use the signal processing function, all you have to do is fill out a signal processing function.1#include 2#include 3#include 4#include 5 6 intFlag =1; 7 8 voidFuncintSig)9 { Tenprintf"I get a signal!\n"); OneFlag =0; A } - - intMain () the { - signal (SIGINT
.
As we all know,linux system everything is a file, so each process has its file descriptor, The Nginx process writes its own file descriptor to the Nginx.pid, and we need to tell Nginx to reopen a new log file (the configuration details of the log file can be seen here, simply by letting the log record what. So we need this directive:kill -USR1 `cat ${pid_path}`This instruction means: first cat to Nginx PID, is an integer, and then send the signal
This article only analyzes the changes in the user stack and kernel stack after the signal is sent to the user program. Without analyzing real-time signals, the entire process is basically the same. Many references
1. A small signal example
Hex @ Gentoo ~ /Signal $ cat sigint. c
# Include
# Include
# Include
Void sig_int (int signo)
{
Printf ("hello \ n ");
}
Int main ()
{
If (signal (SIGINT, sig_in
.) SIGIOThe file descriptor is ready to start the input/output operation.SIGPWR)Power failureSigsys)An illegal system call.Among the signals listed above, the more specific are:
Signals that are not captured, blocked, or ignored by the program are: Sigkill,sigstop
Signals that cannot be restored to the default action are: Sigill,sigtrap
The default causes the process to abort the signal is: Sigabrt,sigbus,sigfpe,sigill,sigiot,sigquit,sigsegv,sigtrap,sigxcpu,sigxfsz
The signa
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.