Lines Matching refs:program
2 @c %MENU% Writing the beginning and end of your program
6 @cindex program
11 thread of control. A process executes a program; you can have multiple
12 processes executing the same program, but each process has its own copy
13 of the program within its own address space and executes it
15 of control within the same program and a program may be composed of
17 one program.
19 Note that we are using a specific definition of ``program'' for the
21 context of Unix systems. In popular usage, ``program'' enjoys a much
26 Writing the program is what this manual is all about. This chapter
27 explains the most basic interface between your program and the system
30 system, and telling the system the program is done.
32 A program starts another program with the @code{exec} family of system calls.
33 This chapter looks at program startup from the execee's point of view. To
37 * Program Arguments:: Parsing your program's command-line arguments
38 * Environment Variables:: Less direct parameters affecting your program
39 * Auxiliary Vector:: Least direct parameters affecting your program
46 @cindex program arguments
48 @cindex arguments, to program
50 @cindex program startup
51 @cindex startup of program
52 @cindex invocation of program
55 The system starts a C program by calling the function @code{main}. It
57 won't even be able to link your program without errors.
61 program, like this:
67 @cindex argc (program argument count)
68 @cindex argv (program argument vector)
70 the shell command used to invoke the program; thus, in @samp{cat foo
72 program can look at its command line arguments is via the arguments of
79 name of the program being run is also included in the vector as the
94 @var{envp} gives the program's environment; it is the same as the value
101 * Parsing Program Arguments:: Ways to parse program options and arguments.
106 @cindex program argument syntax
107 @cindex syntax, for program arguments
142 parsing, even if the user of your program intermixed option and
159 interpretation is left up to the particular application program.
179 @cindex program arguments, parsing
181 @cindex parsing program arguments
182 If the syntax for the command line arguments to your program is simple
184 But unless your program takes a fixed number of arguments, or all of the
195 * Getopt:: Parsing program options using @code{getopt}.
196 * Argp:: Parsing program options using @code{argp_parse}.
258 The code which might appear in the @code{mount}(8) program is a perfect
270 When a program is executed, it receives information about the context in
277 arguments specific to the particular program being invoked. The
345 program file has SUID or SGID bits set. General-purpose libraries
347 vulnerabilities if the library is referenced from a SUID/SGID program.
471 communicate with another program you are about to execute;
524 identify the user who is running a program; a function like
551 This means that if the user tries to execute a program named @code{foo},
560 This specifies the kind of terminal that is receiving program output.
652 When a program is executed, it receives information from the operating
676 the program is being executed.
682 A system call is a request for service that a program makes of the
787 @cindex program termination
791 The usual way for a program to terminate is simply for its @code{main}
796 A program can also terminate normally by calling the @code{exit}
801 a signal that kills the program.
804 * Normal Termination:: If a program calls @code{exit}, a
811 abnormal program termination.
818 A process terminates normally when its program signals it is done by
829 The @code{exit} function tells the system that the program is done, which
832 @var{status} is the program's exit status, which becomes part of the
843 to be performed at program termination. Typically, this is used to do
844 things like saving program state information in a file, or unlocking
853 @code{_exit} is called, terminating the program. @xref{Termination Internals}.
860 When a program exits, it can return to the parent process a small
874 indicate an inability to compare. Your program should follow an
879 execute another program in a subprocess. This convention is not
886 Thus, if the program tried to report 256 errors, the parent would
902 successful program completion.
912 unsuccessful program completion in a general sense.
923 Don't confuse a program's exit status with a process' termination status.
924 There are lots of ways a process can terminate besides having its program
925 finish. In the event that the process termination @emph{is} caused by program
926 termination (i.e., @code{exit}), though, the program's exit status becomes
932 Your program can arrange to run its own cleanup functions if normal
952 called at normal program termination. The @var{function} is called with
967 pointer @var{arg}. At normal program termination, the @var{function} is
975 Here's a trivial program that illustrates the use of @code{exit} and
983 When this program is executed, it just prints the message and exits.
987 @cindex aborting a program
989 You can abort your program using the @code{abort} function. The prototype
999 The @code{abort} function causes abnormal program termination. This
1004 @code{SIGABRT} signal, and your program can include a handler to
1039 When a process terminates for any reason---either because the program
1052 program exited, this status includes as its low-order 8 bits the program