Table Size Declaration in lex %kn Number of packed character classes 10000 Programs generated by lex need either the -e or -w option to handle input thatcontains EUC characters from supp
Trang 1The runtime linker categorizes a process as secure if the user is not a super-user, andeither the real user and effective user identifiers are not equal, or the real group andeffective group identifiers are not equal See getuid(2), geteuid(2), getgid(2), andgetegid(2).
The default trusted directory known to the runtime linker is /usr/lib/secure for32-bit objects or /usr/lib/secure/64 for 64-bit objects The utility crle(1) may beused to specify additional trusted directories applicable for secure applications.Administrators who use this technique should ensure that the target directories aresuitably protected from malicious intrusion
If an LD_LIBRARY_PATH environment variable is in effect for a secure process, then
only the trusted directories specified by this variable will be used to augment the
runtime linker’s search rules
In a secure process, any runpath specifications provided by the application or any ofits dependencies will be used, provided they are full pathnames, that is, the pathnamestarts with a ’/’
In a secure process, the expansion of the $ORIGIN string is allowed only if it expands
to a trusted directory.
In a secure process, LD_SIGNAL is ignored
Additional objects may be loaded with a secure process using the LD_PRELOAD, orLD_AUDITenvironment variables These objects must be specified as full pathnames
or simple file names Full pathnames are restricted to known trusted directories Simple
file names, in which no ’/’ appears in the name, are located subject to the search path
restrictions previously described, and thus will only resolve to known trusted
directories
In a secure process, any dependencies that consist of simple filenames will beprocessed using the pathname restrictions previously described Dependencies thatare expressed as full or relative pathnames will be used as is Therefore, the developer
of a secure process should ensure that the target directory referenced as a full orrelative pathname dependency is suitably protected from malicious intrusion
When creating a secure process, it is recommended that relative pathnames not be
used to express dependencies or to construct dlopen(3DL) pathnames This
restriction should be applied to the application and to all dependencies.
EXAMPLE 1Using LD_FLAGS to group environment variable informationThe following use of LD_FLAGS,
example% LD_FLAGS_32=bind_now,library_path=/lib/one:/lib/two example% LD_FLAGS_64=library_path=/lib/one/64,preload=foo.so
ld.so.1(1)
EXAMPLES
682 man pages section 1: User Commands • Last Revised 29 Oct 2001
Trang 2EXAMPLE 1Using LD_FLAGS to group environment variable information (Continued)
is equivalent to setting the individual environment variables LD_BIND_NOW andLD_LIBRARY_PATHfor 32–bit applications, and LD_LIBRARY_PATH andLD_PRELOADfor 64–bit applications
/usr/lib/libc.so.1 Alternate interpreter for SVID ABI
compatibility
/usr/lib/0@0.so.1 Null character pointer compatibility library
/usr/lib/64/0@0.so.1 Null character pointer compatibility library
for the 64–bit applications
/var/ld/ld.config Default configuration file for 32–bit
applications
/var/ld/64/ld.config Default configuration file for 64–bit
applications
See attributes(5) for descriptions of the following attributes:
crle(1), gprof(1), ld(1), ldd(1), exec(2), getegid(2), geteuid(2), getuid(2),kill(2), mmap(2), profil(2), dladdr(3DL), dlclose(3DL), dldump(3DL),dlerror(3DL), dlopen(3DL), dlsym(3DL), proc(4), attributes(5)
Linker and Libraries Guide
Care should be exercised when using LD_PROFILE in combination with other processmonitoring techniques (for example, users of proc(4)) as deadlock conditions can
Trang 3try to record profiling information To reduce this likelihood, the runtime linker’sprofile implementation determines if the process is being monitored at startup, and if
so, silently disables profiling of the process However, this mechanism can not catchmonitoring processes that attach to the process during its execution
The user compatibility library /usr/lib/0@0.so.1 provides a mechanism thatestablishes a value of 0 at location 0 Some applications exist that erroneously assume
a null character pointer should be treated the same as a pointer to a null string Asegmentation violation will occur in these applications when a null character pointer
is accessed If this library is added to such an application at runtime usingLD_PRELOAD, it provides an environment that is sympathetic to this errant behavior.However, the user compatibility library is intended neither to enable the generation ofsuch applications, nor to endorse this particular programming practice
ld.so.1(1)
684 man pages section 1: User Commands • Last Revised 29 Oct 2001
Trang 4let – shell built-in function to evaluate one or more arithmetic expressions
let arg…
Each arg is a separate "arithmetic expression" to be evaluated.
The following exit values are returned:
0 The value of the last expression is non-zero
1 The value of the last expression is zero
See attributes(5) for descriptions of the following attributes:
Trang 5lex – generate programs for lexical tasks
lex [-cntv] [-e | -w] [-V -Q [y | n]] [file…]
The lex utility generates C programs to be used in lexical processing of characterinput, and that can be used as an interface to yacc The C programs are generatedfrom lex source code and conform to the ISO C standard Usually, the lex utilitywrites the program it generates to the file lex.yy.c; the state of this file isunspecified if lex exits with a non-zero exit status See EXTENDED DESCRIPTION for
a complete description of the lex input language
The following options are supported:
-c Indicate C-language action (default option)
-e Generate a program that can handle EUC characters (cannot be
used with the -w option) yytext[ ] is of type unsignedchar[ ]
-n Suppress the summary of statistics usually written with the -v
option If no table sizes are specified in the lex source code andthe -v option is not specified, then -n is implied
-t Write the resulting program to standard output instead of
lex.yy.c.-v Write a summary of lex statistics to the standard error (See the
discussion of lex table sizes under the heading Definitions inlex.) If table sizes are specified in the lex source code, and if the-noption is not specified, the -v option may be enabled
-w Generate a program that can handle EUC characters (cannot be
used with the -e option) Unlike the -e option, yytext[ ] is oftype wchar_t[ ]
-V Print out version information on standard error
-Q[y|n] Print out version information to output file lex.yy.c by using
-Qy The -Qn option does not print out version information and isthe default
The following operand is supported:
file A pathname of an input file If more than one such file is specified, all
files will be concatenated to produce a single lex program If no fileoperands are specified, or if a file operand is−, the standard input will beused
If the -t option is specified, the text file of C source code output of lex will be written
Trang 6If the -t option is not specified:
1 Informational error and warning messages concerning the contents of lex sourcecode input will be written to either the standard output or standard error
2 If the -v option is specified and the -n option is not specified, lex statistics willalso be written to standard error These statistics may also be generated if tablesizes are specified with a % operator in the Definitions in lex section (seeEXTENDED DESCRIPTION), as long as the -n option is not specified
A text file containing C source code will be written to lex.yy.c, or to the standardoutput if the -t option is present
Each input file contains lex source code, which is a table of regular expressions withcorresponding actions in the form of C program fragments
When lex.yy.c is compiled and linked with the lex library (using the -l loperand with c89 or cc), the resulting program reads character input from thestandard input and partitions it into strings that match the given expressions
When an expression is matched, these actions will occur:
■ The input string that was matched is left in yytext as a null-terminated string; yytext
is either an external character array or a pointer to a character string As explained
in Definitions in lex, the type can be explicitly selected using the %array or
%pointerdeclarations, but the default is %array
■ The external int yyleng is set to the length of the matching string.
■ The expression’s corresponding program fragment, or action, is executed
During pattern matching, lex searches the set of patterns for the single longestpossible match Among rules that match the same number of characters, the rule givenfirst will be chosen
The general format of lex source is:
lex(1)
Output Files
EXTENDED
DESCRIPTION
Trang 7Any such input (beginning with a blank character or within %{ and %} delimiter lines)
appearing at the beginning of the Rules section before any rules are specified will be
written to lex.yy.c after the declarations of variables for the yylex function andbefore the first line of code in yylex Thus, user variables local to yylex can bedeclared here, as well as application code to execute upon entry to yylex
The action taken by lex when encountering any input beginning with a blank
character or within %{ and %} delimiter lines appearing in the Rules section but
coming after one or more rules is undefined The presence of such input may result in
an erroneous definition of the yylex function
Definitions in lexappear before the first %% delimiter Any line in this section notcontained between %{ and %} lines and not beginning with a blank character isassumed to define a lex substitution string The format of these lines is:
name substitute
If a name does not meet the requirements for identifiers in the ISO C standard, the result is undefined The string substitute will replace the string { name } when it is used
in a rule The name string is recognized in this context only when the braces are
provided and when it does not appear within a bracket expression or withindouble-quotes
In the Definitions in lex section, any line beginning with a % (percent sign)character and followed by an alphanumeric word beginning with either s or S defines
a set of start conditions Any line beginning with a % followed by a word beginningwith either x or X defines a set of exclusive start conditions When the generatedscanner is in a %s state, patterns with no state specified will be also active; in a %xstate, such patterns will not be active The rest of the line, after the first word, isconsidered to be one or more blank-character-separated names of start conditions.Start condition names are constructed in the same way as definition names Startconditions can be used to restrict the matching of regular expressions to one or morestates as described in Regular expressions in lex
Implementations accept either of the following two mutually exclusive declarations inthe Definitions in lex section:
%array Declare the type of yytext to be a null-terminated character array.
%pointer Declare the type of yytext to be a pointer to a null-terminated
character string
Note: When using the %pointer option, you may not also use the yyless function to
alter yytext.
%arrayis the default If %array is specified (or neither %array nor %pointer is
specified), then the correct way to make an external reference to yyext is with a
declaration of the form:
lex(1)
Definitions in lex
688 man pages section 1: User Commands • Last Revised 22 Aug 1997
Trang 8extern charyytext[ ]
If %pointer is specified, then the correct external reference is of the form:
extern char *yytext;
lexwill accept declarations in the Definitions in lex section for setting certaininternal table sizes The declarations are shown in the following table
Table Size Declaration in lex
%kn Number of packed character classes 10000
Programs generated by lex need either the -e or -w option to handle input thatcontains EUC characters from supplementary codesets If neither of these options isspecified, yytext is of the type char[ ], and the generated program can handle onlyASCII characters
When the -e option is used, yytext is of the type unsigned char[ ] and yyleng
gives the total number of bytes in the matched string With this option, the macros
input(), unput(c), and output(c) should do a byte-based I/O in the same way aswith the regular ASCII lex Two more variables are available with the -e option,yywtextand yywleng, which behave the same as yytext and yyleng would underthe -w option
When the -w option is used, yytext is of the type wchar_t[ ] and yyleng gives
the total number of characters in the matched string If you supply your own input(),
unput(c), or output(c) macros with this option, they must return or accept EUC
characters in the form of wide character (wchar_t) This allows a different interfacebetween your program and the lex internals, to expedite some programs
The Rules in lex source files are a table in which the left column contains regularexpressions and the right column contains actions (C program fragments) to beexecuted when the expressions are recognized
ERE action
lex(1)
Rules in lex
Trang 9The extended regular expression (ERE) portion of a row will be separated from action
by one or more blank characters A regular expression containing blank characters isrecognized under one of the following conditions:
■ The entire expression appears within double-quotes
■ The blank characters appear within double-quotes or square brackets
■ Each blank character is preceded by a backslash character
Anything in the user subroutines section will be copied to lex.yy.c followingyylex
The lex utility supports the set of Extended Regular Expressions (EREs) described onregex(5) with the following additions and exceptions to the syntax:
.Any string enclosed in double-quotes will represent the characters within thedouble-quotes as themselves, except that backslash escapes (which appear in thefollowing table) are recognized Any backslash-escape sequence is terminated bythe closing quote For example, " \ 01""1" represents a single string: the octal value 1followed by the character 1
<state>r
<state1, state2, >r The regular expression r will be matched only when the program is in one of the start conditions indicated by state, state1, and so forth; for more information see
Actions in lex(As an exception to the typographical conventions of the rest of
this document, in this case <state> does not represent a metavariable, but the literal
angle-bracket characters surrounding a symbol.) The start condition is recognized
as such only at the beginning of a regular expression
r/x
The regular expression r will be matched only if it is followed by an occurrence of regular expression x The token returned in yytext will only match r If the trailing portion of r matches the beginning of x, the result is unspecified The r expression cannot include further trailing context or the $ (match-end-of-line) operator; x
cannot include the ^ (match-beginning-of-line) operator, nor trailing context, northe $ operator That is, only one occurrence of trailing context is allowed in a lexregular expression, and the ^ operator only can be used at the beginning of such anexpression A further restriction is that the trailing-context operator / (slash) cannot
be grouped within parentheses
{name}
When name is one of the substitution symbols from the Definitions section, the string, including the enclosing braces, will be replaced by the substitute value The
substitute value will be treated in the extended regular expression as if it were
enclosed in parentheses No substitution will occur if {name} occurs within a
bracket expression or within double-quotes
Trang 10Within an ERE, a backslash character ( \\, \ a, \ b, \ f, \ n, \ r, \ t, \ v) isconsidered to begin an escape sequence In addition, the escape sequences in thefollowing table will be recognized.
A literal newline character cannot occur within an ERE; the escape sequence \ n can
be used to represent a newline character A newline character cannot be matched by aperiod operator
Escape Sequences in lex
Escape Sequences in lex
\digits A backslash character followed by the longest
sequence of one, two or three octal-digit characters (01234567) Ifall of the digits are 0, (that is, representation of the NUL character), the behavior is undefined.
The character whose encoding is
represented by the one-, two- or three-digit octal integer Multi-byte characters require multiple, concatenated escape sequences of this type, including the leading \ for each byte.
\xdigits A backslash character followed by the longest
sequence of hexadecimal-digit characters (01234567abcdefABCDEF) If all of the digits are
0, (that is, representation of the NUL character), the behavior is undefined.
The character whose encoding is
represented by the hexadecimal integer.
\c A backslash character followed by any character
not described in this table (\\, \a, \b, \f, \en,
\r, \t, \v).
The character c, unchanged.
The order of precedence given to extended regular expressions for lex is as shown inthe following table, from high to low
Note: The escaped characters entry is not meant to imply that these are operators,
but they are included in the table to show their relationships to the trueoperators The start condition, trailing context and anchoring notationshave been omitted from the table because of the placement restrictionsdescribed in this section; they can only appear at the beginning or ending
of an ERE
lex(1)
Trang 11ERE Precedence in lex
collation-related bracket symbols [= =] [: :] [ .]
escaped characters \<special character>
Unlike the general ERE rules, embedded anchoring is not allowed by most historicalleximplementations An example of embedded anchoring would be for patterns such
as (^)foo($) to match foo when it exists as a complete word This functionality can beobtained using existing lex features:
^foo/[ \ n]|
" foo"/[ \ n] /* found foo as a separate word */
Note also that $ is a form of trailing context (it is equivalent to /\ n and as suchcannot be used with regular expressions containing another instance of the operator(see the preceding discussion of trailing context)
The additional regular expressions trailing-context operator / (slash) can be used as anordinary character if presented within double-quotes, " / "; preceded by a
backslash, \ /; or within a bracket expression, [ / ] The start-condition < and >operators are special only in a start condition at the beginning of a regular expression;elsewhere in the regular expression they are treated as ordinary characters
The following examples clarify the differences between lex regular expressions andregular expressions appearing elsewhere in this document For regular expressions of
the form r/x, the string matching r is always returned; confusion may arise when the
lex(1)
692 man pages section 1: User Commands • Last Revised 22 Aug 1997
Trang 12beginning of x matches the trailing portion of r For example, given the regular expression a*b/cc and the input aaabcc, yytext would contain the string aaab on this
match But given the regular expression x*/xy and the input xxxy, the token xxx, not
xx, is returned by some implementations because xxx matches x*
In the rule ab*/bc, the b* at the end of r will extend r’s match into the beginning of the
trailing context, so the result is unspecified If this rule were ab/bc, however, the rulematches the text ab when it is followed by the text bc In this latter case, the matching
of r cannot extend into the beginning of x, so the result is specified.
The action to be taken when an ERE is matched can be a C program fragment or thespecial actions described below; the program fragment can contain one or more Cstatements, and can also include special actions The empty C statement ; is a validaction; any string in the lex.yy.c input that matches the pattern portion of such arule is effectively ignored or skipped However, the absence of an action is not valid,and the action lex takes in such a condition is undefined
The specification for an action, including C statements and special actions, can extendacross several lines if enclosed in braces:
ERE <one or more blanks> { program statement program statement }
The default action when a string in the input to a lex.yy.c program is not matched
by any expression is to copy the string to the output Because the default behavior of aprogram generated by lex is to read the input and copy it to the output, a minimallexsource program that has just %% generates a C program that simply copies theinput to the output unchanged
Four special actions are available:
| ECHO; REJECT; BEGIN
| The action | means that the action for the next rule is the action for
this rule Unlike the other three actions, | cannot be enclosed inbraces or be semicolon-terminated; it must be specified alone, with
no other actions
ECHO; Write the contents of the string yytext on the output.
REJECT; Usually only a single expression is matched by a given string in
the input REJECT means "continue to the next expression thatmatches the current input," and causes whatever rule was thesecond choice after the current rule to be executed for the sameinput Thus, multiple rules can be matched and executed for oneinput string or overlapping input strings For example, given theregular expressions xyz and xy and the input xyz, usually onlythe regular expression xyz would match The next attempted
lex(1)
Actions in lex
Trang 13REJECT, both this rule and the xy rule would be executed TheREJECTaction may be implemented in such a fashion that flow ofcontrol does not continue after it, as if it were equivalent to a goto
to another part of yylex The use of REJECT may result insomewhat larger and slower scanners
BEGINnewstate;
switches the state (start condition) to newstate If the string newstate
has not been declared previously as a start condition in theDefinitions in lexsection, the results are unspecified Theinitial state is indicated by the digit 0 or the token INITIAL.The functions or macros described below are accessible to user code included in thelexinput It is unspecified whether they appear in the C code output of lex, or areaccessible only through the -l l operand to c89 or cc (the lex library)
int yylex(void) Performs lexical analysis on the input; this is the
primary function generated by the lex utility Thefunction returns zero when the end of input is reached;otherwise it returns non-zero values (tokens)
determined by the actions that are selected
int yymore(void) When called, indicates that when the next input string
is recognized, it is to be appended to the current value
of yytext rather than replacing it; the value in yyleng is
adjusted accordingly
intyyless(int n) Retains n initial characters in yytext, NUL-terminated,
and treats the remaining characters as if they had not
been read; the value in yyleng is adjusted accordingly.
int input(void) Returns the next character from the input, or zero on
end-of-file It obtains input from the stream pointer
yyin, although possibly via an intermediate buffer.
Thus, once scanning has begun, the effect of altering
the value of yyin is undefined The character read is
removed from the input stream of the scanner withoutany processing by the scanner
int unput(intc) Returns the character c to the input; yytext and yyleng
are undefined until the next expression is matched The
result of using unput for more characters than have
been input is unspecified
The following functions appear only in the lex library accessible through the -l loperand; they can therefore be redefined by a portable application:
lex(1)
694 man pages section 1: User Commands • Last Revised 22 Aug 1997
Trang 14int yywrap(void)
Called by yylex at end-of-file; the default yywrap always will return 1 If theapplication requires yylex to continue processing with another source of input,then the application can include a function yywrap, which associates another file
with the external variable FILE *yyin and will return a value of zero.
int main(intargc, char *argv[ ])
Calls yylex to perform lexical analysis, then exits The user code can contain main
to perform application-specific operations, calling yylex as applicable
The reason for breaking these functions into two lists is that only those functions inlibl.acan be reliably redefined by a portable application
Except for input, unput and main, all external and static names generated by lexbegin with the prefix yy or YY
Portable applications are warned that in the Rules in lex section, an ERE without anaction is not acceptable, but need not be detected as erroneous by lex This may result
in compilation or run-time errors
The purpose of input is to take characters off the input stream and discard them asfar as the lexical analysis is concerned A common use is to discard the body of acomment once the beginning of a comment is recognized
The lex utility is not fully internationalized in its treatment of regular expressions inthe lex source code or generated lexical analyzer It would seem desirable to have thelexical analyzer interpret the regular expressions given in the lex source according tothe environment specified when the lexical analyzer is executed, but this is not
possible with the current lex technology Furthermore, the very nature of the lexicalanalyzers produced by lex must be closely tied to the lexical requirements of theinput language being described, which will frequently be locale-specific anyway (Forexample, writing an analyzer that is used for French text will not automatically beuseful for processing other languages.)
EXAMPLE 1Using lex
The following is an example of a lex program that implements a rudimentary scannerfor a Pascal-like syntax:
Trang 15EXAMPLE 1Using lex (Continued)
} {DIGIT}+"."{DIGIT}* {
printf("A float: %s (%g)\n", yytext, atof(yytext));
} if|then|begin|end|procedure|function {
printf("A keyword: %s\n", yytext);
} {ID} printf("An identifier: %s\n", yytext);
"+"|"-"|"*"|"/" printf("An operator: %s\n", yytext);
"{"[^}\n]*"}" /* eat up one-line comments */
[ \t\n]+ /* eat up white space */
printf("Unrecognized character: %s\n", yytext);
else yyin = stdin;
See attributes(5) for descriptions of the following attributes:
Trang 16If routines such as yyback(), yywrap(), and yylock() in l (ell) files are to beexternal C functions, the command line to compile a C++ program must define the EXTERN_C macro For example:
example% CC –D EXTERN_C file
lex(1)
NOTES
Trang 17limit, ulimit, unlimit – set or get limitations on the system resources available to thecurrent shell and its descendents
ulimit [-HSacdfnstv] [limit]
The ulimit utility sets or reports the file-size writing limit imposed on files written
by the shell and its child processes (files of any size may be read) Only a process withappropriate privileges can increase the limit
The Bourne shell built-in function, ulimit, prints or sets hard or soft resource limits.These limits are described in getrlimit(2)
If limit is not present, ulimit prints the specified limits Any number of limits may be
printed at one time The -a option prints all limits
If limit is present, ulimit sets the specified limit to limit The string unlimited
requests the largest valid limit Limits may be set for only one resource at a time Anyuser may set a soft limit to any value below the hard limit Any user may lower a hardlimit Only a super-user may raise a hard limit; see su(1M)
The -H option specifies a hard limit The -S option specifies a soft limit If neitheroption is specified, ulimit will set both limits and print the soft limit
The following options specify the resource whose limits are to be printed or set If nooption is specified, the file size limit is printed or set
-c maximum core file size (in 512-byte blocks)-d maximum size of data segment or heap (in kbytes)-f maximum file size (in 512-byte blocks)
-n maximum file descriptor plus 1-s maximum size of stack segment (in kbytes)-t maximum CPU time (in seconds)
-v maximum size of virtual memory (in kbytes)
sh
698 man pages section 1: User Commands • Last Revised 26 Jun 1998
Trang 18The C-shell built-in function, limit, limits the consumption by the current process or
any process it spawns, each not to exceed limit on the specified resource If limit is omitted, print the current limit; if resource is omitted, display all limits (Run the
sysdef(1M) command to obtain the maximum possible limits for your system Thevalues reported are in hexadecimal, but can be translated into decimal numbers usingthe bc(1) command)
-h Use hard limits instead of the current limits Hard limits impose a ceiling
on the values of the current limits Only the privileged user may raise thehard limits
resource is one of:
cputime Maximum CPU seconds per process
filesize Largest single file allowed; limited to the size of the filesystem (see
df(1M))
datasize The maximum size of a process’s heap in kilobytes
stacksize Maximum stack size for the process (see swap(1M))
coredumpsize Maximum size of a core dump (file) This is limited to the size of
the filesystem
descriptors Maximum number of file descriptors (run sysdef( ))
memorysize Maximum size of virtual memory
limit is a number, with an optional scaling factor, as follows:
nk n kilobytes This is the default for all but cputime.
nm n megabytes or minutes (for cputime).
mm:ss Minutes and seconds (for cputime)
unlimitremoves a limitation on resource If no resource is specified, then all resource
limitations are removed See the description of the limit command for the list ofresource names
-h Remove corresponding hard limits Only the privileged user may
do this
The Korn shell built-in function, ulimit, sets or displays a resource limit The
available resources limits are listed below Many systems do not contain one or more
of these limits The limit for a specified resource is set when limit is specified The value of limit can be a number in the unit specified below with each resource, or the
value unlimited The -H and -S flags specify whether the hard limit or the soft limitfor the given resource is set A hard limit cannot be increased once it is set A soft limitcan be increased up to the value of the hard limit If neither the -H or -S options is
limit(1)
csh
ksh
Trang 19specified, the limit applies to both The current resource limit is printed when limit is
omitted In this case, the soft limit is printed unless -H is specified When more thanone resource is specified, then the limit name and unit is printed before the value.-a Lists all of the current resource limits
-c The number of 512-byte blocks on the size of core dumps
-d The number of K-bytes on the size of the data area
-f The number of 512-byte blocks on files written by child processes (files of
any size may be read)
-n The number of file descriptors plus 1
-s The number of K-bytes on the size of the stack area
-t The number of seconds (CPU time) to be used by each process
-v The number of K-bytes for virtual memory
If no option is given, -f is assumed
The following option is supported by ulimit:
-f Set (or report, if no blocks operand is present), the file size limit in blocks.
The -f option is also the default case
The following operand is supported by ulimit:
blocks The number of 512-byte blocks to use as the new file size limit
EXAMPLE 1Limiting the stack size
To limit the stack size to 512 kilobytes:
EXAMPLE 2Limiting the number of file descriptors
To limit the number of file descriptors to 12:
Trang 20EXAMPLE 2Limiting the number of file descriptors (Continued)
EXAMPLE 3Limiting the core dump file size
To limit the size of a core dump file size to 0 kilobytes:
EXAMPLE 4Removing the limitation for core file size
To remove the above limitation for the core file size:
>0 A request for a higher limit was rejected or an error occurred
See attributes(5) for descriptions of the following attributes:
Trang 21line – read one line
line
The line utility copies one line (up to and including a new-line) from the standardinput and writes it on the standard output It returns an exit status of 1 on EOF andalways prints at least a new-line It is often used within shell files to read from theuser’s terminal
Exit status is:
0 Successful completion
>0 End-of-file on input
See attributes(5) for descriptions of the following attributes:
Trang 22lint – C program verifier
/usr/ucb/lint [options]
/usr/ucb/lintis the interface to the BSD Compatibility Package C programverifier It is a script that looks for the link /usr/ccs/bin/ucblint to the Cprogram verifier /usr/ccs/bin/ucblint is available only with the SPROccpackage, whose default location is /opt/SUNWspro /usr/ucb/lint is identical to/usr/ccs/bin/ucblint, except that BSD headers are used and BSD libraries are
linked before base libraries The /opt/SUNWspro/man/man1/lint.1 man page is
available only with the SPROcc package
/usr/ucb/lintaccepts the same options as /usr/ccs/bin/ucblint, with thefollowing exceptions:
-Idir Search dir for included files whose names do not begin with a
slash ( / ) prior to searching the usual directories The directoriesfor multiple -I options are searched in the order specified Thepreprocessor first searches for #include files in the directory
containing sourcefile, and then in directories named with -I
options (if any), then /usr/ucbinclude, and finally, in/usr/include
-Ldir Add dir to the list of directories searched for libraries by
/usr/ccs/bin/ucblint This option is passed to/usr/ccs/bin/ld Directories specified with this option aresearched before /usr/ucblib and /usr/lib
-Y P, dir Change the default directory used for finding libraries
The following exit values are returned:
/usr/lib/libsocket library containing socket routines/usr/lib/libnsl library containing network functions/usr/lib/libelf library containing routines to process ELF object files/usr/lib/libaio library containing asynchronous I/O routines
Trang 23ATTRIBUTE TYPE ATTRIBUTE VALUE
Trang 24list_devices – list allocatable devices
list_devices [-s] [-U uid] -l [device]
list_devices [-s] [-U uid] -n [device]
list_devices [-s] [-U uid] -u [device]
The list_devices utility lists the allocatable devices in the system according tospecified qualifications
The device and all device special files associated with the device are listed The device
argument is optional and, if it is not present, all relevant devices are listed
The following options are supported:
-l[device] Lists the pathname(s) of the device special files associated with the
device that are allocatable to the current process If device is given,
lists only the files associated with the specified device
-n[device] Lists the pathname(s) of device special files associated with the
device that are allocatable to the current process but are not
currently allocated If device is given, lists only the files associated
with that device
-s Silent Suppresses any diagnostic output
-u[device] Lists the pathname(s) of device special files, associated with the
device that are allocated to the owner of the current process If
device is given, list only the files associated with that device.
-Uuid Uses the user ID uid instead of the real user ID of the current
process when performing the list_devices operation Only auser with the solaris.devices.revoke authorization can usethis option
The following exit values are returned:
non—zero An error occurred
/etc/security/device_allocate/etc/security/device_maps/etc/security/dev/*
Trang 25ATTRIBUTE TYPE ATTRIBUTE VALUE
Trang 26listusers – list user login information
listusers [-g groups] [-l logins]
Executed without any options, this command lists all user logins sorted by login Theoutput shows the login ID and the account field value from the system’s passworddatabase as specified by /etc/nsswitch.conf
The following options are supported:
-ggroups Lists all user logins belonging to group, sorted by login Multiple
groups can be specified as a comma-separated list
-llogins Lists the user login or logins specified by logins, sorted by login
Multiple logins can be specified as a comma-separated list
See attributes(5) for descriptions of the following attributes:
nsswitch.conf(4), attributes(5)
A user login is one that has a UID of 100 or greater
The -l and -g options can be combined User logins will only be listed once, even ifthey belong to more than one of the selected groups
Trang 27llc2_autoconfig – generate LLC2 configuration files
/usr/lib/llc2/llc2_autoconfig [-f]
The llc2_autoconfig utility is used to generate LLC2 configuration files(/etc/llc2/default/llc2.*) If there is no configuration file in/etc/llc2_default/, it detects all the available interfaces in the system andgenerates corresponding default configuration files
If there are existing configuration files in /etc/llc2_default/, it will check if thoseinterfaces defined in the files still exist If they do not exist in the system, it will setllc2_onin those files to 0 After this, it will detect if there are new interfaces in thesystem If there are, it will generate configuration files for them
The following option is supported:
-f Erases all configuration files in /etc/llc2/default/ Then detects all
the available interfaces in the system and generates corresponding defaultconfiguration files Use this option with caution
/etc/llc2/default/llc2.* LLC2 configuration filesSee attributes(5) for descriptions of the following attributes:
Trang 28llc2_config – configure LLC2 interface parameters
/usr/lib/llc2/llc2_config [-P | -U | -d | -q | -i ppa | -r ppa]
The llc2_config utility is used to start/stop the LLC2 subsystem and to configureLLC2 interface parameters
The following options are supported:
-d Turns on debug mode Extra debugging information will be printed out.-ippa Initializes the corresponding interface using the file
/etc/llc2/default/llc2.ppa.
-P Reads in all /etc/llc2/default/llc2.* configuration files, opens
those devices defined in the files, and sets up the streams needed for LLC2
to use those devices Before doing this, llc2_config -q will not showanything
-q Queries the LLC2 subsystem Information similar to the following example
will be printed out for all PPAs (Physical Point of Attachment) availableunder the LLC2 module:
The fields displayed are described below:
PPA The relative logical position of the interface
State The state of the interface:
up The interface is initialized and operational
down The interface was "discovered" by the LLC2
driver, has passed its bootup diagnostics,and is awaiting initialization
bad The interface is known to the LLC2 driver,
but failed one or more of the integritychecks performed at boot time This mightinclude detecting Interrupt Request andshared memory conflicts or failures detectedduring the execution of the level 0
diagnostics
MACAddr The MAC address currently in effect for the interface.Type The MAC type Current types supported include:
Trang 29csma/cd 10 Megabit Ethernetethernet Ethernet type devicetkn-ring 4/16 Megabit Token Ringfddi 100 Megabit Fiber Distributed Data InterfaceMaxSDU The Maximum Service Data Unit size transmitted on
this interface
Mode The Service Modes supported by this interface This
field consists of the bitwise logical-ORing of thesupported modes, also defined in
/usr/include/sys/dlpi.h.-rppa Uninitializes the corresponding interface By using this option, and then
using the -i option, the parameters associated with an interface can bechanged
-U Destroys all streams used by the LLC2 subsystem This is the reverse of the
-Poption After this is executed, llc2_config -q will not showanything
/etc/llc2/default/llc2.* LLC2 configuration filesSee attributes(5) for descriptions of the following attributes:
Trang 30llc2_stats – LLC2 Station, SAP, and Connection Statistics
llc2_stats ppa [-r] [-s sap] [-c connection]
The llc2_stats command is used to retrieve statistical information from theHost-based Logical Link Control Class 2 component of the LLC2 Driver Statistics arekept for the station, SAP (Service Access Point), and connection components
The following options are supported:
-cconnection Specifies the connection of interest Its value is entered
in hexadecimal notation with no leading 0x
-r Resets the specified counters to zero after reading
them This option is only valid if the root user is
executing the command
-ssap Specifies the SAP for this request It is a single-byte
value, expressed in hexadecimal notation with noleading 0x For example, the NetBIOS sap, 240 (0xf0)would be entered as: -s f0
The following operand is supported:
ppa The logical number used to address the adapter The PPA (Physical
Point of Attachment) must be the first argument
EXAMPLE 1Station StatisticsThe following command will display the station statistics for PPA 4 After theexample, a brief description of each field is presented
example% /usr/lib/llc2/llc2_stats 4
Station values received:
ppa = 0x00000004 clearFlag = 0x00
# of saps (hex) = 0x0002 saps (hex) = 02 aa
nullSapXidCmdRcvd = 0x00000000 nullSapXidRspSent = 0x00000000 nullSapTestCmdRcvd = 0x00000000 nullSapTestRspSent = 0x00000000 outOfState = 0x00000000 allocFail = 0x00000000 protocolError = 0x00000000The fields are described as follows:
ppa The logical number used to address the adapter.clearFlag This flag indicates if the statistics will be reset to zero
after reading (set to a 1) or if the statistics are read only
Trang 31EXAMPLE 1Station Statistics (Continued)
# of saps The number of SAPs currently bound on this station.saps The array of the station’s Service Access Point (SAP)
logical interface values between the LLC and itsadjacent layers
state A number indicating the current state of the station
component (0 = down, 1 = up)
nullSapXidCmdRcvd The number of XID command Protocol Data Units
(PDUs) received for the NULL SAP address (sap =0x00)
nullSapXidRspSent The number of XID response PDUs sent in response to
XID command PDUs received for the null SAP address.nullSapTestCmdRcvd The number of TEST command PDUs received for the
null SAP address
nullSapTestRspSent The number of TEST response PDUs sent in response
to TEST command PDUs received for the null SAPaddress
outOfState The number of events received in an invalid state.allocFail The number of buffer allocation failures
protocolError The number of LLC protocol errors, that is, the receipt
of malformed PDUs or the receipt of frame X whenframe Y was expected
EXAMPLE 2SAP Statistics
In the above display, there are two active SAPs, 0x02 and 0xaa The following is anexample of a command for retrieving the statistics for SAP 02 and a brief explanation
of each field presented
xidCmdRcvd = 0x00000000 xidRspSent = 0x00000000 xidRspRcvd = 0x00000000 testCmdSent = 0x00000000 testCmdRcvd = 0x00000000 testRspSent = 0x00000000llc2_stats(1)
712 man pages section 1: User Commands • Last Revised 18 May 1999
Trang 32EXAMPLE 2SAP Statistics (Continued)
The fields are described as follows:
ppa The logical number used to address the adapter.clearFlag This flag indicates if the statistics will be reset to zero
after reading (set to a 1) or if the statistics are read only(set to 0)
sap The specified Service Access Point (SAP) logical
interface value for the station
state A number indicating the current state of the SAP
component (0 = inactive, 1 = active)
# of cons The number of active connections on this SAP
connections The array of active connection indexes
xidCmdSent The number of XID command PDUs sent (Source SAP
= this sap)
xidCmdRcvd The number of XID command PDUs received
(Destination SAP = this sap)
xidRspSent The number of XID response PDUs sent (Source SAP =
this sap)
xidRspRcvd The number of XID response PDUs received (Source
SAP = this sap)
testCmdSent The number of TEST command PDUs sent (Source SAP
= this sap)
testCmdRcvd The number of TEST command PDUs received
(Destination SAP = this sap)
testRspSent The number of TEST response PDUs sent (Source SAP
= this sap)
testRspRcvd The number of TEST response PDUs received (Source
SAP = this sap)
uiSent The number of Unnumbered Information Frames sent
received
llc2_stats(1)
Trang 33EXAMPLE 2SAP Statistics (Continued)
outOfState The number of events received in an invalid state.allocFail The number of buffer allocation failures
protocolError The number of LLC protocol errors, that is, the receipt
of malformed PDUs or the receipt of frame X whenframe Y was expected
EXAMPLE 3Connection StatisticsTen established connections are associated with this SAP To retrieve the statistics forconnection 1, enter the following command:
example% /usr/lib/llc2/llc2_stats 4 -s 2 -c 1
Connection values received:
ppa = 0x0004 clearFlag = 0x00 sap = 0x02 con = 0x0001 sid = 0x0201 stateOldest = 0x00 stateOlder = 0x00 stateOld = 0x01 state = 0x08
dl_nodeaddr = 0x0080d84008c2 dl_sap = 0x04 flag = 0x50 dataFlag = 0x00 timerOn = 0x18
vs = 0x29 vr = 0x1e nrRcvd = 0x29 k = 0x14 retryCount = 0x0000 numToBeAcked = 0x0000 numToResend = 0x0000 macOutSave = 0x0000 macOutDump = 0x0000
iSent = 0x0ba9 iRcvd = 0x001e frmrSent = 0x0000 frmrRcvd = 0x0000 rrSent = 0x016a rrRcvd = 0x00c1 rnrSent = 0x0000 rnrRcvd = 0x06fb rejSent = 0x0000 rejRcvd = 0x0000 sabmeSent = 0x0000 sabmeRcvd = 0x0001 uaSent = 0x0001 uaRcvd = 0x0000 discSent = 0x0000 outOfState = 0x0000 allocFail = 0x0000 protocolError = 0x0000 localBusy = 0x0000 remoteBusy = 0x00b5 maxRetryFail = 0x0000 ackTimerExp = 0x0000 pollTimerExp = 0x0000 rejTimerExp = 0x0000 remBusyTimerExp = 0x0000
inactTimerExp = 0x0000 sendAckTimerExp = 0x0000ppa The logical number used to address the adapter.clearFlag This flag indicates if the statistics will be reset to zero
after reading (set to a 1) or if the statistics are read only(set to 0)
sap The specified Service Access Point (SAP) logical
interface value for the station
con The specified connection index value for the SAP.stateOldest A number representing the state of the connection
component prior to stateOlder
llc2_stats(1)
714 man pages section 1: User Commands • Last Revised 18 May 1999
Trang 34EXAMPLE 3Connection Statistics (Continued)
stateOlder A number representing the state of the connection
component prior to stateOld
stateOld A number representing the state of the connection
component prior to state
state A number representing the most current state of the
connection component See Table 1
sid The Station Identifier composed of the SAP (upper
byte) and connection index (lower byte)
dl_nodeaddr The Data Link Node Address This is the destination
node’s MAC address
flag The connection component processing flag See Table
3.dataFlag A number representing the status of the data units from
received I-frame PDUs (0 = not discarded, 1 =discarded, 2 = busy state entered with REJ PDUoutstanding)
timerOn A number representing the timer activity flag, with
each bit representing an active timer for thisconnection See Table 2 for timer definitions
vs The sequence number of the next I-frame PDU to send
PDU to be received
nrRcvd The sequence number plus 1 of the last sent I-frame
PDU acknowledged by the remote node
retryCount The retryCount is incremented whenever a timer
expiration occurs These timers protect outboundframes
numToBeAcked The number of outbound I-frames awaiting
acknowledgement
numToResend The number of outbound I-frames to be retransmitted
llc2_stats(1)
Trang 35EXAMPLE 3Connection Statistics (Continued)
frmrSent The number of Frame Reject PDUs (FRMR) sent.frmrRcvd The number of Frame Reject PDUs (FRMR) received.rrSent The number of Receiver Ready PDUs (RR) sent.rrRcvd The number of Receiver Ready PDUs (RR) received.rnrSent The number of Receiver Not Ready PDUs (RNR) sent.rnrRcvd The number of Receiver Not Ready PDUs (RNR)
received
rejSent The number of Reject PDUs (REJ) sent
rejRcvd The number of Reject PDUs (REJ) received
sabmeSent The number of Set Asynchronous Balanced Mode
Extended PDUs (SABME) sent
sabmeRcvd The number of Set Asynchronous Balanced Mode
Extended PDUs (SABME) received
(UA) sent
(UA) received
discSent The number of Disconnect PDUs (DISC) sent
outOfState The number of events received in an invalid state.allocFail The number of buffer allocation failures
protocolError The number of LLC protocol errors, that is, the receipt
of malformed PDUs or the receipt of frame X whenframe Y was expected
localBusy The number of times this component was in local busy
state and could not accept I-frames
remoteBusy The number of times the remote connection component
was busy and could not accept I-frames
maxRetryFail The number of failures that occurred because maxRetry
Trang 36EXAMPLE 3Connection Statistics (Continued)
rejTimerExp The number of expirations of the Reject timer
remBusyTimerExp The number of expirations of the Remote Busy timer.inactTimerExp The number of expirations of the Inactivity timer.sendAckTimerExp The number of expirations of the Send
Trang 37See attributes(5) for descriptions of the following attributes:
Trang 38ln – make hard or symbolic links to files
/usr/bin/ln [-fns] source_file [target]
/usr/bin/ln [-fns] source_file… target
/usr/xpg4/bin/ln [-fs] source_file [target]
/usr/xpg/bin/ln [-fs] source_file… target
In the first synopsis form, the ln utility creates a new directory entry (link) for the file
specified by source_file, at the destination path specified by target If target is not
specified, the link is made in the current directory This first synopsis form is assumedwhen the final operand does not name an existing directory; if more than two
operands are specified and the final is not an existing directory, an error will result
In the second synopsis form, the ln utility creates a new directory entry for each file
specified by a source_file operand, at a destination path in the existing directory named
by target.
The ln utility may be used to create both hard links and symbolic links A hard link is
a pointer to a file and is indistinguishable from the original directory entry Anychanges to a file are effective independent of the name used to reference the file Hardlinks may not span file systems and may not refer to directories
lnby default creates hard links source_file is linked to target If target is a directory, another file named source_file is created in target and linked to the original source_file.
If target is a file, its contents are overwritten If /usr/bin/ln determines that the mode of target forbids writing, it will print the mode (see chmod(1)), ask for a
response, and read the standard input for one line If the response is affirmative, thelink occurs, if permissible; otherwise, the command exits
If target is a file and the -f option is not specified, /usr/xpg4/bin/ln will write a diagnostic message to standard error, do nothing more with the current source_file, and
go on to any remaining source_files.
A symbolic link is an indirect pointer to a file; its directory entry contains the name ofthe file to which it is linked Symbolic links may span file systems and may refer todirectories
When creating a hard link, and the source file is itself a symbolic link, then the targetwill be a hard link to the file referenced by the symbolic link, not to the symbolic link
object itself (source_file).
File permissions for target may be different from those displayed with a -l listing of the ls(1) command To display the permissions of target use ls -lL See stat(2) for
Trang 39-f Link files without questioning the user, even if the mode of target forbids
writing This is the default if the standard input is not a terminal
-s Create a symbolic link
If the -s option is used with two arguments, target may be an existing directory or a non-existent file If target already exists and is not a directory,
an error is returned source_file may be any path name and need not exist If
it exists, it may be a file or directory and may reside on a different file
system from target If target is an existing directory, a file is created in directory target whose name is source_file or the last component of
source_file This file is a symbolic link that references source_file If target
does not exist, a file with name target is created and it is a symbolic link that references source_file.
If the -s option is used with more than two arguments, target must be an existing directory or an error will be returned For each source_file, a link is created in target whose name is the last component of source_file; each new
source_file is a symbolic link to the original source_file The files and target
may reside on different file systems
The following options are supported for /usr/bin/ln only:
-n If the link is an existing file, do not overwrite the contents of the file The
-foption overrides this option This is the default behavior for/usr/xpg4/bin/ln, and is silently ignored
The following operands are supported:
source_file A path name of a file to be linked This can be either a regular or
special file If the -s option is specified, source_file can also be a
directory
target The path name of the new directory entry to be created, or of an
existing directory in which the new directory entries are to becreated
See largefile(5) for the description of the behavior of ln when encountering filesgreater than or equal to 2 Gbyte ( 231bytes)
See environ(5) for descriptions of the following environment variables that affect theexecution of ln: LC_CTYPE, LC_MESSAGES, and NLSPATH
The following exit values are returned:
0 All the specified files were linked successfully
Trang 40ATTRIBUTE TYPE ATTRIBUTE VALUE
chmod(1), ls(1), stat(2), attributes(5), environ(5), largefile(5), XPG4(5)
A symbolic link to a directory behaves differently than you might expect in certaincases While an ls(1) on such a link displays the files in the pointed-to directory, an
‘ls -l’ displays information about the link itself:
example% ln -s dir link example% ls link
file1 file2 file3 file4
example% ls -l link
lrwxrwxrwx 1 user 7 Jan 11 23:27 link -> dir
When you cd(1) to a directory through a symbolic link, you wind up in the pointed-tolocation within the file system This means that the parent of the new working
directory is not the parent of the symbolic link, but rather, the parent of the pointed-todirectory For instance, in the following case the final working directory is /usr andnot /home/user/linktest