📄 conf.texi
字号:
@node File Minimums@section Minimum Values for File System LimitsHere are the names for the POSIX minimum upper bounds for some of theabove parameters. The significance of these values is that you cansafely push to these limits without checking whether the particularsystem you are using can go that far.@table @code@comment limits.h@comment POSIX.1@item _POSIX_LINK_MAXThe most restrictive limit permitted by POSIX for the maximum value of afile's link count. The value of this constant is @code{8}; thus, youcan always make up to eight names for a file without running into asystem limit.@comment limits.h@comment POSIX.1@item _POSIX_MAX_CANONThe most restrictive limit permitted by POSIX for the maximum number ofbytes in a canonical input line from a terminal device. The value ofthis constant is @code{255}.@comment limits.h@comment POSIX.1@item _POSIX_MAX_INPUTThe most restrictive limit permitted by POSIX for the maximum number ofbytes in a terminal device input queue (or typeahead buffer).@xref{Input Modes}. The value of this constant is @code{255}.@comment limits.h@comment POSIX.1@item _POSIX_NAME_MAXThe most restrictive limit permitted by POSIX for the maximum number ofbytes in a file name component. The value of this constant is@code{14}.@comment limits.h@comment POSIX.1@item _POSIX_PATH_MAXThe most restrictive limit permitted by POSIX for the maximum number ofbytes in a file name. The value of this constant is @code{255}.@comment limits.h@comment POSIX.1@item _POSIX_PIPE_BUFThe most restrictive limit permitted by POSIX for the maximum number ofbytes that can be written atomically to a pipe. The value of thisconstant is @code{512}.@end table@node Pathconf@section Using @code{pathconf}When your machine allows different files to have different values for afile system parameter, you can use the functions in this section to findout the value that applies to any particular file.These functions and the associated constants for the @var{parameter}argument are declared in the header file @file{unistd.h}.@comment unistd.h@comment POSIX.1@deftypefun {long int} pathconf (const char *@var{filename}, int @var{parameter})This function is used to inquire about the limits that apply tothe file named @var{filename}.The @var{parameter} argument should be one of the @samp{_PC_} constantslisted below.The normal return value from @code{pathconf} is the value you requested.A value of @code{-1} is returned both if the implementation does notimpose a limit, and in case of an error. In the former case,@code{errno} is not set, while in the latter case, @code{errno} is setto indicate the cause of the problem. So the only way to use thisfunction robustly is to store @code{0} into @code{errno} just beforecalling it.Besides the usual file name syntax errors (@pxref{File Name Errors}),the following error condition is defined for this function:@table @code@item EINVALThe value of @var{parameter} is invalid, or the implementation doesn'tsupport the @var{parameter} for the specific file.@end table@end deftypefun@comment unistd.h@comment POSIX.1@deftypefun {long int} fpathconf (int @var{filedes}, int @var{parameter})This is just like @code{pathconf} except that an open file descriptoris used to specify the file for which information is requested, insteadof a file name.The following @code{errno} error conditions are defined for this function:@table @code@item EBADFThe @var{filedes} argument is not a valid file descriptor.@item EINVALThe value of @var{parameter} is invalid, or the implementation doesn'tsupport the @var{parameter} for the specific file.@end table@end deftypefunHere are the symbolic constants that you can use as the @var{parameter}argument to @code{pathconf} and @code{fpathconf}. The values are allinteger constants.@table @code@comment unistd.h@comment POSIX.1@item _PC_LINK_MAXInquire about the value of @code{LINK_MAX}.@comment unistd.h@comment POSIX.1@item _PC_MAX_CANONInquire about the value of @code{MAX_CANON}.@comment unistd.h@comment POSIX.1@item _PC_MAX_INPUTInquire about the value of @code{MAX_INPUT}.@comment unistd.h@comment POSIX.1@item _PC_NAME_MAXInquire about the value of @code{NAME_MAX}.@comment unistd.h@comment POSIX.1@item _PC_PATH_MAXInquire about the value of @code{PATH_MAX}.@comment unistd.h@comment POSIX.1@item _PC_PIPE_BUFInquire about the value of @code{PIPE_BUF}.@comment unistd.h@comment POSIX.1@item _PC_CHOWN_RESTRICTEDInquire about the value of @code{_POSIX_CHOWN_RESTRICTED}.@comment unistd.h@comment POSIX.1@item _PC_NO_TRUNCInquire about the value of @code{_POSIX_NO_TRUNC}.@comment unistd.h@comment POSIX.1@item _PC_VDISABLEInquire about the value of @code{_POSIX_VDISABLE}.@end table@node Utility Limits@section Utility Program Capacity LimitsThe POSIX.2 standard specifies certain system limits that you can accessthrough @code{sysconf} that apply to utility behavior rather than thebehavior of the library or the operating system.The GNU C library defines macros for these limits, and @code{sysconf}returns values for them if you ask; but these values convey nomeaningful information. They are simply the smallest values thatPOSIX.2 permits.@comment limits.h@comment POSIX.2@deftypevr Macro int BC_BASE_MAXThe largest value of @code{obase} that the @code{bc} utility isguaranteed to support.@end deftypevr@comment limits.h@comment POSIX.2@deftypevr Macro int BC_SCALE_MAXThe largest value of @code{scale} that the @code{bc} utility isguaranteed to support.@end deftypevr@comment limits.h@comment POSIX.2@deftypevr Macro int BC_DIM_MAXThe largest number of elements in one array that the @code{bc} utilityis guaranteed to support.@end deftypevr@comment limits.h@comment POSIX.2@deftypevr Macro int BC_STRING_MAXThe largest number of characters in one string constant that the@code{bc} utility is guaranteed to support.@end deftypevr@comment limits.h@comment POSIX.2@deftypevr Macro int BC_DIM_MAXThe largest number of elements in one array that the @code{bc} utilityis guaranteed to support.@end deftypevr@comment limits.h@comment POSIX.2@deftypevr Macro int COLL_WEIGHTS_MAXThe largest number of weights that can necessarily be used in definingthe collating sequence for a locale.@end deftypevr@comment limits.h@comment POSIX.2@deftypevr Macro int EXPR_NEST_MAXThe maximum number of expressions that can be nested within parenthesisby the @code{expr} utility.@end deftypevr@comment limits.h@comment POSIX.2@deftypevr Macro int LINE_MAXThe largest text line that the text-oriented POSIX.2 utilities cansupport. (If you are using the GNU versions of these utilities, thenthere is no actual limit except that imposed by the available virtualmemory, but there is no way that the library can tell you this.)@end deftypevr@comment limits.h@comment POSIX.2@deftypevr Macro int EQUIV_CLASS_MAXThe maximum number of weights that can be assigned to an entry of the@code{LC_COLLATE} category @samp{order} keyword in a locale definition.The GNU C library does not presently support locale definitions.@end deftypevr@node Utility Minimums@section Minimum Values for Utility Limits@table @code@comment limits.h@comment POSIX.2@item _POSIX2_BC_BASE_MAXThe most restrictive limit permitted by POSIX.2 for the maximum value of@code{obase} in the @code{bc} utility. Its value is @code{99}.@comment limits.h@comment POSIX.2@item _POSIX2_BC_DIM_MAXThe most restrictive limit permitted by POSIX.2 for the maximum size ofan array in the @code{bc} utility. Its value is @code{2048}.@comment limits.h@comment POSIX.2@item _POSIX2_BC_SCALE_MAXThe most restrictive limit permitted by POSIX.2 for the maximum value of@code{scale} in the @code{bc} utility. Its value is @code{99}.@comment limits.h@comment POSIX.2@item _POSIX2_BC_STRING_MAXThe most restrictive limit permitted by POSIX.2 for the maximum size ofa string constant in the @code{bc} utility. Its value is @code{1000}.@comment limits.h@comment POSIX.2@item _POSIX2_COLL_WEIGHTS_MAXThe most restrictive limit permitted by POSIX.2 for the maximum numberof weights that can necessarily be used in defining the collatingsequence for a locale. Its value is @code{2}.@comment limits.h@comment POSIX.2@item _POSIX2_EXPR_NEST_MAXThe most restrictive limit permitted by POSIX.2 for the maximum numberof expressions nested within parenthesis when using the @code{expr} utility.Its value is @code{32}.@comment limits.h@comment POSIX.2@item _POSIX2_LINE_MAXThe most restrictive limit permitted by POSIX.2 for the maximum size ofa text line that the text utilities can handle. Its value is@code{2048}.@comment limits.h@comment POSIX.2@item _POSIX2_EQUIV_CLASS_MAXThe most restrictive limit permitted by POSIX.2 for the maximum numberof weights that can be assigned to an entry of the @code{LC_COLLATE}category @samp{order} keyword in a locale definition. Its value is@code{2}. The GNU C library does not presently support localedefinitions.@end table@node String Parameters@section String-Valued ParametersPOSIX.2 defines a way to get string-valued parameters from the operatingsystem with the function @code{confstr}:@comment unistd.h@comment POSIX.2@deftypefun size_t confstr (int @var{parameter}, char *@var{buf}, size_t @var{len})This function reads the value of a string-valued system parameter,storing the string into @var{len} bytes of memory space starting at@var{buf}. The @var{parameter} argument should be one of the@samp{_CS_} symbols listed below.The normal return value from @code{confstr} is the length of the stringvalue that you asked for. If you supply a null pointer for @var{buf},then @code{confstr} does not try to store the string; it just returnsits length. A value of @code{0} indicates an error.If the string you asked for is too long for the buffer (that is, longerthan @code{@var{len} - 1}), then @code{confstr} stores just that much(leaving room for the terminating null character). You can tell thatthis has happened because @code{confstr} returns a value greater than orequal to @var{len}.The following @code{errno} error conditions are defined for this function:@table @code@item EINVALThe value of the @var{parameter} is invalid.@end table@end deftypefunCurrently there is just one parameter you can read with @code{confstr}:@table @code@comment unistd.h@comment POSIX.2@item _CS_PATHThis parameter's value is the recommended default path for searching forexecutable files. This is the path that a user has by default justafter logging in.@end tableThe way to use @code{confstr} without any arbitrary limit on string sizeis to call it twice: first call it to get the length, allocate thebuffer accordingly, and then call @code{confstr} again to fill thebuffer, like this:@smallexample@groupchar *get_default_path (void)@{ size_t len = confstr (_CS_PATH, NULL, 0); char *buffer = (char *) xmalloc (len); if (confstr (_CS_PATH, buf, len + 1) == 0) @{ free (buffer); return NULL; @} return buffer;@}@end group@end smallexample
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -