dio_fcntl

(PHP 4 >= 4.2.0, PHP 5)

dio_fcntl -- Performs a c library fcntl on fd

Description

mixed dio_fcntl ( resource fd, int cmd [, mixed args])

The dio_fcntl() function performs the operation specified by cmd on the file descriptor fd. Some commands require additional arguments args to be supplied.

args is an associative array, when cmd is F_SETLK or F_SETLLW, with the following keys:

cmd can be one of the following operations:

Example 1. Setting and clearing a lock

<?php

$fd
= dio_open('/dev/ttyS0', O_RDWR);

if (
dio_fcntl($fd, F_SETLK) == -1) {
   
// the file descriptor appears locked
   
echo "The lock can not be cleared. It is held by someone else.";
} else {
   echo
"Lock succesfully set/cleared";
}

dio_close($fd);
?>

Note: This function is not implemented on Windows platforms.