Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

posix_pathconf

Description

The posix_pathconf of POSIX for PHP returns the value of a configurable limit.

Syntax

posix_pathconf(
    string $path,
    int $name
): int|false

Parameters

path

The name of the file whose limit you want to get.

name

The name of the configurable limit, one of the following:

ConstantDescription
POSIX_PC_LINK_MAXThe maximum number of links a given file or directory can have.
POSIX_PC_MAX_CANONThe maximum number of bytes in a terminal canonical input buffer (pathname being then a character special file).
POSIX_PC_MAX_INPUTThe maximum number of bytes of a terminal input queue (pathname being then a character special file).
POSIX_PC_NAME_MAXThe maximum number of characters for a file name alone, not its path.
POSIX_PC_PATH_MAXThe maximum number of characters for a full path name.
POSIX_PC_PIPE_BUFThe maximum number of bytes that can be written to a pipe in one operation.
POSIX_PC_CHOWN_RESTRICTEDIf privileges are required to be allow chown() to work.
POSIX_PC_NO_TRUNCIf a file name (or files under a directory) is longer than POSIX_PC_NAME_MAX.
POSIX_PC_ALLOC_SIZE_MINThe minimum number of bytes of storage allocated for any portion of a file.
POSIX_PC_SYMLINK_MAXThe maximum number of symbolic links a given file or directory can have.

Return

Returns the configurable limit or false.

Examples

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_LINK_MAX;

$return = posix_pathconf($path, $name);

echo $return;
65000

2 · path name · POSIX_PC_MAX_CANON

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_MAX_CANON;

$return = posix_pathconf($path, $name);

echo $return;
255

3 · path name · POSIX_PC_MAX_INPUT

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_MAX_INPUT;

$return = posix_pathconf($path, $name);

echo $return;
255

4 · path name · POSIX_PC_NAME_MAX

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_NAME_MAX;

$return = posix_pathconf($path, $name);

echo $return;
255

5 · path name · POSIX_PC_PATH_MAX

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_PATH_MAX;

$return = posix_pathconf($path, $name);

echo $return;
4096

6 · path name · POSIX_PC_PIPE_BUF

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_PIPE_BUF;

$return = posix_pathconf($path, $name);

echo $return;
4096

7 · path name · POSIX_PC_CHOWN_RESTRICTED

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_CHOWN_RESTRICTED;

$return = posix_pathconf($path, $name);

echo $return;
1

8 · path name · POSIX_PC_NO_TRUNC

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_NO_TRUNC;

$return = posix_pathconf($path, $name);

echo $return;
1

9 · path name · POSIX_PC_ALLOC_SIZE_MIN

<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_ALLOC_SIZE_MIN;

$return = posix_pathconf($path, $name);

echo $return;
4096
<?

$path = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$name = POSIX_PC_SYMLINK_MAX;

$return = posix_pathconf($path, $name);

echo $return;
HomeMenu