Process: Running a program
Threads: Functions that run
1.main ()
Startup routines
Exit (int main (argc, argv));
2. Process termination
The process terminates normally:
<1>main () return;
<2>exit (3);
1) Call Termination handler
2) Standard IO cleanup program
<3>_exit (2) _exit (2);
<4> last thread called Pthread_exit (3);
<5> the last thread returned from the startup routine
Abnormal termination:
<1>abort (3);
<2> thread response to cancellation
<3> Signal Termination
Atexit (3);
hook function
The order in which the registration functions are executed is the opposite of the order in which they are registered
Execution condition: the main () function calls return, or exit (3) is called at any location;
3. Environment variables and environment tables
"Name=value"
Getenv (3);
Setenv (3);
4. Parsing of command-line arguments
int getopt (int argc, char **argv, const char *optstring);
ARGC and argv are the two parameters of the main () function
Optstring There are rules:
"-ab:c::"
<1> start with "-" to resolve non-option parameters, return 1
<2> "a" parse option parameter "-a", return ' a '
<3> "B:" Parse with parameter option "-B argument", return ' B. ', Optarg point to argument
<4> "C::" Parse the option "-cargument" with parameters, return ' C ', Optarg point to argument, enter no parameters optarg==null
Homework:
#./a.out-y 4-m-d-h24filename
Strftime (3);
Getopt_long (3);
Ability to parse long format options
--help
--help Arg
--help=arg
Ls-l/etc/passed
GCC Hello.c-wall
TAR-CVF Bao.tar file1 file2 file3
-L: Option parameter
/ETC/PASSWD: Non-option parameter
-w: Option parameter with parameters all
-F: Option parameter with parameters Bao.tar
5.C Storage Distribution Layout
6. Shared libraries
Manual Loading Library
Dlopen ();
Dlsym ();
Dlclose ();
7.SETJMP () and longjmp ()
SETJMP (), longjmp () implements a jump between functions
Goto implementation jumps inside a function
8.getrlimit (2) and Setrlimit (2)
The process Environment for UNIX advanced programming