8.104 Fonctions POSIX
8 Référence des fonctions
Manuel PHP
. Introduction . Installation . Constantes pré-définies . Voir aussi . posix_access . posix_ctermid . posix_get_last_error . posix_getcwd . posix_getegid . posix_geteuid . posix_getgid . posix_getgrgid . posix_getgrnam . posix_getgroups . posix_getlogin . posix_getpgid . posix_getpgrp . posix_getpid . posix_getppid . posix_getpwnam . posix_getpwuid . posix_getrlimit . posix_getsid . posix_getuid . posix_isatty . posix_kill . posix_mkfifo ->posix_mknod . posix_setegid . posix_seteuid . posix_setgid . posix_setpgid . posix_setsid . posix_setuid . posix_strerror . posix_times . posix_ttyname . posix_uname
|
8.104.28 posix_mknod()
Crée un fichier spécial ou ordinaire (POSIX.1)
[ Exemples avec posix_mknod ] PHP 5 >= 5.1.0RC1
bool
posix_mknod (
string
pathname
,
int
mode
,
int
major
,
int
minor
)
posix_mknod
crée un fichier spécial ou ordinaire.
-
pathname
-
Le fichier à créer.
-
mode
-
Ce paramètre est construit par une manipulation de bits ou par des types
de fichier (une des constantes suivantes :
POSIX_S_IFREG
,
POSIX_S_IFCHR
,
POSIX_S_IFBLK
,
POSIX_S_IFIFO
ou
POSIX_S_IFSOCK
) et des permissions.
-
major
-
L'identifiant majeur du dispositif du noyau (requis lorsque vous utilisez
S_IFCHR
ou
S_IFBLK
).
-
minor
-
L'identifiant mineur du dispositif du noyau (par défaut, 0).
Cette fonction retourne
TRUE
en cas de
succès,
FALSE
en cas d'échec.
| Exemple avec posix_mknod |
<?php
$file = '/tmp/tmpfile'; // nom du fichier $type = POSIX_S_IFBLK; // type du fichier $permissions = 0777; // octal $major = 1; $minor = 8; // /dev/random
if (!posix_mknod($file, $type | $permissions, $major, $minor)) { die('Erreur : ' . posix_get_last_error() . ': ' . posix_strerror(posix_get_last_error())); }
?>
|
|