POSIX posix_mknod

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

posix_mknod — 특수 또는 일반 파일 생성(POSIX.1)


설명

posix_mknod(
    string $filename,
    int $flags,
    int $major = 0,
    int $minor = 0
): bool
                

특수 또는 일반 파일을 만듭니다.


매개변수

filename
생성할 파일
flags
이 매개변수는 파일 유형(다음 상수 중 하나: POSIX_S_IFREG, POSIX_S_IFCHR, POSIX_S_IFBLK, POSIX_S_IFIFO 또는 POSIX_S_IFSOCK)과 권한 간의 비트 OR로 구성됩니다.
major
주요 장치 커널 식별자(S_IFCHR 또는 S_IFBLK를 사용할 때 전달해야 함).
minor
부 장치 커널 식별자입니다.

반환 값

성공하면 true를, 실패하면 false를 반환합니다.


Examples

예제 #1 posix_mknod() 예제

                  
<?php

$file = '/tmp/tmpfile';  // file name
$type = POSIX_S_IFBLK;   // file type
$permissions = 0777;     // octal
$major = 1;
$minor = 8;              // /dev/random

if (!posix_mknod($file, $type | $permissions, $major, $minor)) {
    die('Error ' . posix_get_last_error() . ': ' . posix_strerror(posix_get_last_error()));
}

?>
                  
                

기타