<HTML ><HEAD ><TITLE >dio_fcntl</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Direct IO functions" HREF="ref.dio.html"><LINK REL="PREVIOUS" TITLE="dio_close" HREF="function.dio-close.html"><LINK REL="NEXT" TITLE="dio_open" HREF="function.dio-open.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.dio-close.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.dio-open.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.dio-fcntl" ></A >dio_fcntl</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN19606" ></A ><P > (PHP 4 >= 4.2.0)</P >dio_fcntl -- Performs a c library fcntl on fd</DIV ><DIV CLASS="refsect1" ><A NAME="AEN19609" ></A ><H2 >Description</H2 >mixed <B CLASS="methodname" >dio_fcntl</B > ( resource fd, int cmd [, mixed arg])<BR ></BR ><P > The <B CLASS="function" >dio_fcntl()</B > function performs the operation specified by <TT CLASS="parameter" ><I >cmd</I ></TT > on the file descriptor <TT CLASS="parameter" ><I >fd</I ></TT >. Some commands require additional arguments <TT CLASS="parameter" ><I >args</I ></TT > to be supplied. </P ><P > <TT CLASS="parameter" ><I >arg</I ></TT > is an associative array, when <TT CLASS="parameter" ><I >cmd</I ></TT > is F_SETLK or F_SETLLW, with the following keys: <P ></P ><UL ><LI ><P > "start" - offset where lock begins </P ></LI ><LI ><P > "length" - size of locked area. zero means to end of file </P ></LI ><LI ><P > "wenth" - Where l_start is relative to: can be SEEK_SET, SEEK_END and SEEK_CUR </P ></LI ><LI ><P > "type" - type of lock: can be F_RDLCK (read lock), F_WRLCK (write lock) or F_UNLCK (unlock) </P ></LI ></UL > </P ><P > <TT CLASS="parameter" ><I >cmd</I ></TT > can be one of the following operations: <P ></P ><UL ><LI ><P > F_SETLK - Lock is set or cleared. If the lock is held by someone else <B CLASS="function" >dio_fcntl()</B > returns -1. </P ></LI ><LI ><P > F_SETLKW - like F_SETLK, but in case the lock is held by someone else, <B CLASS="function" >dio_fcntl()</B > waits until the lock is released. </P ></LI ><LI ><P > F_GETLK - <B CLASS="function" >dio_fcntl()</B > returns an associative array (as described above) if someone else prevents lock. If there is no obstruction key "type" will set to F_UNLCK. </P ></LI ><LI ><P > F_DUPFD - finds the lowest numbered available file descriptor greater or equal than <TT CLASS="parameter" ><I >arg</I ></TT > and returns them. </P ></LI ><LI ><P > F_SETFL - Sets the file descriptors flags to the value specified by <TT CLASS="parameter" ><I >arg</I ></TT >, Which can be O_APPEND,O_NONBLOCK or O_ASYNC . To use O_ASYNC you will need to use the pcntl extension. </P ></LI ></UL > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.dio-close.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.dio-open.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >dio_close</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.dio.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >dio_open</TD ></TR ></TABLE ></DIV ></BODY ></HTML >