Advanced Programming in the UNIX® Environment

(lily) #1
ptg10805159

44 UNIX Standardization and Implementations Chapter 2


Name of limit Description nameargument
FILESIZEBITS minimum number of bits needed to _PC_FILESIZEBITS
represent, as a signed integer value, the
maximum size of a regular file allowed
in the specified directory
LINK_MAX maximum value of a file’s link count _PC_LINK_MAX
MAX_CANON maximum number of bytes on a terminal’s _PC_MAX_CANON
canonical input queue
MAX_INPUT number of bytes for which space is available_PC_MAX_INPUT
on terminal’s input queue
NAME_MAX maximum number of bytes in a filename _PC_NAME_MAX
(does not include a null at end)
PATH_MAX maximum number of bytes in a relative _PC_PATH_MAX
pathname, including the terminating
null
PIPE_BUF maximum number of bytes that can be _PC_PIPE_BUF
written atomically to a pipe
_POSIX_TIMESTAMP_RESOLUTION resolution in nanoseconds for file _PC_TIMESTAMP_RESOLUTION
timestamps
SYMLINK_MAX number of bytes in a symbolic link _PC_SYMLINK_MAX

Figure 2.12 Limits andnamearguments topathconfandfpathconf


  1. Thereferenced file for_PC_PIPE_BUFmust be a pipe, FIFO, or directory.Inthe
    first two cases (pipe or FIFO), the return value is the limit for the referenced
    pipe or FIFO. For the other case (a directory), the return value is the limit for
    any FIFO created in that directory.

  2. Thereferenced file for _PC_SYMLINK_MAXmust be a directory.The value
    returned is the maximum length of the string that a symbolic link in that
    directory can contain.


Example


Theawk( 1 )program shown in Figure2.13 builds a C program that prints the value of
eachpathconfandsysconfsymbol.
#!/usr/bin/awk -f
BEGIN {
printf("#include \"apue.h\"\n")
printf("#include <errno.h>\n")
printf("#include <limits.h>\n")
printf("\n")
printf("static void pr_sysconf(char *, int);\n")
printf("static void pr_pathconf(char *, char *, int);\n")
printf("\n")
printf("int\n")
printf("main(int argc, char *argv[])\n")
Free download pdf