From b69062733646e4f15b4fb0577c7e074d7626acd6 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Tue, 5 Apr 2005 12:50:53 +0000 Subject: [PATCH] Switch ref.dio to the new structure git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183658 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/dio/functions/dio-close.xml | 48 ++++-- reference/dio/functions/dio-fcntl.xml | 188 +++++++++++++--------- reference/dio/functions/dio-open.xml | 161 +++++++++++------- reference/dio/functions/dio-read.xml | 57 +++++-- reference/dio/functions/dio-seek.xml | 111 ++++++++----- reference/dio/functions/dio-stat.xml | 106 +++++++++--- reference/dio/functions/dio-tcsetattr.xml | 100 ++++++++---- reference/dio/functions/dio-truncate.xml | 51 ++++-- reference/dio/functions/dio-write.xml | 58 +++++-- 9 files changed, 606 insertions(+), 274 deletions(-) diff --git a/reference/dio/functions/dio-close.xml b/reference/dio/functions/dio-close.xml index cf99ef8157..f1c5d85e7d 100644 --- a/reference/dio/functions/dio-close.xml +++ b/reference/dio/functions/dio-close.xml @@ -1,30 +1,48 @@ - - + dio_close Closes the file descriptor given by fd - - Description + + &reftitle.description; voiddio_close resourcefd - The function dio_close closes the - file descriptor fd. + The function dio_close closes the file descriptor + fd. + + + &reftitle.parameters; - See also dio_open. + + + fd + + + The file descriptor returned by dio_open. + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + &reftitle.examples; - - Closing an open file descriptor - - + Closing an open file descriptor + + + &reftitle.seealso; + + + dio_open + + + - + dio_fcntl Performs a c library fcntl on fd - - Description + + &reftitle.description; mixeddio_fcntl resourcefd @@ -20,81 +19,117 @@ descriptor fd. Some commands require additional arguments args to be supplied. + ¬e.no-windows; + + + &reftitle.parameters; - args is an associative array, when - cmd is F_SETLK or F_SETLLW, with the - following keys: - - - - "start" - offset where lock begins - - - - - "length" - size of locked area. zero means to end of file - - - - - "wenth" - Where l_start is relative to: can be SEEK_SET, - SEEK_END and SEEK_CUR - - - - - "type" - type of lock: can be F_RDLCK (read lock), F_WRLCK - (write lock) or F_UNLCK (unlock) - - - + + + fd + + + The file descriptor returned by dio_open. + + + + + cmd + + + Can be one of the following operations: + + + + F_SETLK - Lock is set or cleared. If the lock + is held by someone else dio_fcntl returns + -1. + + + + + F_SETLKW - like F_SETLK, but in case the lock + is held by someone else, dio_fcntl waits + until the lock is released. + + + + + F_GETLK - dio_fcntl returns an + associative array (as described above) if someone else + prevents lock. If there is no obstruction key "type" will set + to F_UNLCK. + + + + + F_DUPFD - finds the lowest numbered available file descriptor + greater than or equal to args and returns + them. + + + + + F_SETFL - Sets the file descriptors flags to the value specified by + args, which can be O_APPEND, + O_NONBLOCK or O_ASYNC. To use + O_ASYNC you will need to use the + PCNTL extension. + + + + + + + + args + + + args is an associative array, when + cmd is F_SETLK or + F_SETLLW, with the following keys: + + + + "start" - offset where lock begins + + + + + "length" - size of locked area. zero means to end of file + + + + + "wenth" - Where l_start is relative to: can be SEEK_SET, + SEEK_END and SEEK_CUR + + + + + "type" - type of lock: can be F_RDLCK (read + lock), F_WRLCK (write lock) or + F_UNLCK (unlock) + + + + + + + + + + &reftitle.returnvalues; - cmd can be one of the following - operations: - - - - F_SETLK - Lock is set or cleared. If the lock - is held by someone else dio_fcntl returns - -1. - - - - - F_SETLKW - like F_SETLK, but in case the lock - is held by someone else, dio_fcntl waits - until the lock is released. - - - - - F_GETLK - dio_fcntl returns an - associative array (as described above) if someone else - prevents lock. If there is no obstruction key "type" will set - to F_UNLCK. - - - - - F_DUPFD - finds the lowest numbered available file descriptor - greater than or equal to args and returns - them. - - - - - F_SETFL - Sets the file descriptors flags to the value specified by - args, which can be O_APPEND,O_NONBLOCK or - O_ASYNC. To use O_ASYNC you will need to use the - PCNTL extension. - - - - - - Setting and clearing a lock - + Returns the result of the C call. + + + + &reftitle.examples; + + + Setting and clearing a lock - ¬e.no-windows; diff --git a/reference/dio/functions/dio-open.xml b/reference/dio/functions/dio-open.xml index 9511683ac1..9bbf70bbe4 100644 --- a/reference/dio/functions/dio-open.xml +++ b/reference/dio/functions/dio-open.xml @@ -1,6 +1,5 @@ - - + dio_open @@ -9,8 +8,8 @@ creation permissions of mode - - Description + + &reftitle.description; resourcedio_open stringfilename @@ -19,64 +18,102 @@ dio_open opens a file and returns a new file - descriptor for it, or &false; if any error occurred. If - flags is O_CREAT, the optional third parameter - mode will set the mode of the file - (creation permissions). The flags - parameter can be one of the following options: - - - O_RDONLY - opens the file for read access. - - - O_WRONLY - opens the file for write access. - - - - O_RDWR - opens the file for both reading and - writing. - - - - The flags parameter can also include any - combination of the following flags: - - - - O_CREAT - creates the file, if it doesn't already exist. - - - - - O_EXCL - if both, O_CREAT and O_EXCL are set, - dio_open fails, if the file already exists. - - - - - O_TRUNC - if the file exists, and its opened for write access, - the file will be truncated to zero length. - - - - - O_APPEND - write operations write data at the - end of the file. - - - - O_NONBLOCK - sets non blocking mode. - - - + descriptor for it. + + + &reftitle.parameters; - See also: dio_close. + + + filename + + + The opened file. + + + + + flags + + + The flags parameter can also include any + combination of the following flags: + + + + O_CREAT - creates the file, if it doesn't already exist. + + + + + O_EXCL - if both, O_CREAT + and O_EXCL are set, dio_open + fails, if the file already exists. + + + + + O_TRUNC - if the file exists, and its opened for write access, + the file will be truncated to zero length. + + + + + O_APPEND - write operations write data at the + end of the file. + + + + + O_NONBLOCK - sets non blocking mode. + + + + + + + + mode + + + If flags is O_CREAT, + mode will set the mode of the file + (creation permissions). + + + + O_RDONLY - opens the file for read access. + + + + + O_WRONLY - opens the file for write access. + + + + + O_RDWR - opens the file for both reading and + writing. + + + + + + + + + + &reftitle.returnvalues; + + A file descriptor or &false; on error. + + + + &reftitle.examples; - - Setting the baud rate on a serial port - + Setting the baud rate on a serial port + + &reftitle.seealso; + + + dio_close + + + - + dio_read - - Reads n bytes from fd and returns them, if n is not specified, - reads 1k block - + Reads bytes from a file descriptor - - Description + + &reftitle.description; stringdio_read resourcefd - intn + intlen The function dio_read reads and returns - n bytes from file with descriptor - fd. If n is - not specified, dio_read reads 1K sized block - and returns them. + len bytes from file with descriptor + fd. + + + &reftitle.parameters; - See also: dio_write. + + + fd + + + The file descriptor returned by dio_open. + + + + + len + + + The number of bytes to read. If not specified, + dio_read reads 1K sized block. + + + + + + + + &reftitle.returnvalues; + + The bytes readed from fd. + + + + &reftitle.seealso; + + + dio_write + diff --git a/reference/dio/functions/dio-seek.xml b/reference/dio/functions/dio-seek.xml index 785b8afb80..dbb800206c 100644 --- a/reference/dio/functions/dio-seek.xml +++ b/reference/dio/functions/dio-seek.xml @@ -1,13 +1,12 @@ - - + dio_seek Seeks to pos on fd from whence - - Description + + &reftitle.description; intdio_seek resourcefd @@ -16,40 +15,76 @@ The function dio_seek is used to change the - file position of the file with descriptor - fd. The parameter - whence specifies how the position - pos should be interpreted: - - - - SEEK_SET (default) - specifies that pos is - specified from the beginning of the file. - - - - - SEEK_CUR - Specifies that pos is a - count of characters from the current file position. This count - may be positive or negative. - - - - - SEEK_END - Specifies that pos is a - count of characters from the end of the file. A negative count - specifies a position within the current extent of the file; a - positive count specifies a position past the current end. If - you set the position past the current end, and actually write - data, you will extend the file with zeros up to that - position. - - - - - - Setting the baud rate on a serial port - + file position of the given file descriptor. + + + + &reftitle.parameters; + + + + fd + + + The file descriptor returned by dio_open. + + + + + pos + + + The new position. + + + + + whence + + + Specifies how the position pos should be interpreted: + + + + SEEK_SET (default) - specifies that pos is + specified from the beginning of the file. + + + + + SEEK_CUR - Specifies that pos is a + count of characters from the current file position. This count + may be positive or negative. + + + + + SEEK_END - Specifies that pos is a + count of characters from the end of the file. A negative count + specifies a position within the current extent of the file; a + positive count specifies a position past the current end. If + you set the position past the current end, and actually write + data, you will extend the file with zeros up to that + position. + + + + + + + + + + + &reftitle.returnvalues; + + + + + &reftitle.examples; + + + Setting the baud rate on a serial port - - + dio_stat @@ -8,35 +7,102 @@ Gets stat information about the file descriptor fd - - Description + + &reftitle.description; arraydio_stat resourcefd - Function dio_stat returns information about - the file with file descriptor - fd. dio_stat returns - an associative array with the following keys: + dio_stat returns information about the given file + descriptor. + + + + &reftitle.parameters; + + + + fd + + + The file descriptor returned by dio_open. + + + + + + + + &reftitle.returnvalues; + + Returns an associative array with the following keys: - "device" - device - "inode" - inode - "mode" - mode - "nlink" - number of hard links - "uid" - user id - "gid" - group id + + + "device" - device + + + + + "inode" - inode + + + + + "mode" - mode + + + + + "nlink" - number of hard links + + + + + "uid" - user id + + + + + "gid" - group id + + "device_type" - device type (if inode device) - "size" - total size in bytes - "blocksize" - blocksize - "blocks" - number of blocks allocated - "atime" - time of last access - "mtime" - time of last modification - "ctime" - time of last change + + + "size" - total size in bytes + + + + + "blocksize" - blocksize + + + + + "blocks" - number of blocks allocated + + + + + "atime" - time of last access + + + + + "mtime" - time of last modification + + + + + "ctime" - time of last change + + On error dio_stat returns &null;. diff --git a/reference/dio/functions/dio-tcsetattr.xml b/reference/dio/functions/dio-tcsetattr.xml index ec68a8d585..b2e0b1ce14 100644 --- a/reference/dio/functions/dio-tcsetattr.xml +++ b/reference/dio/functions/dio-tcsetattr.xml @@ -1,6 +1,5 @@ - - + dio_tcsetattr @@ -8,44 +7,76 @@ Sets terminal attributes and baud rate for a serial port - - Description + + &reftitle.description; voiddio_tcsetattr resourcefd arrayoptions - The function dio_tcsetattr sets - the terminal attributes and baud rate of the open - resource. The currently available options are - - - - 'baud' - baud rate of the port - can be 38400,19200,9600,4800,2400,1800, - 1200,600,300,200,150,134,110,75 or 50, default value is 9600. - - - - - 'bits' - data bits - can be 8,7,6 or 5. Default value is 8. - - - - - 'stop' - stop bits - can be 1 or 2. Default value is 1. - - - - - 'parity' - can be 0,1 or 2. Default value is 0. - - - - - - Setting the baud rate on a serial port - + dio_tcsetattr sets the terminal attributes and baud + rate of the open resource. + + ¬e.no-windows; + + + &reftitle.parameters; + + + + fd + + + The file descriptor returned by dio_open. + + + + + options + + + The currently available options are + + + + 'baud' - baud rate of the port - can be 38400,19200,9600,4800,2400,1800, + 1200,600,300,200,150,134,110,75 or 50, default value is 9600. + + + + + 'bits' - data bits - can be 8,7,6 or 5. Default value is 8. + + + + + 'stop' - stop bits - can be 1 or 2. Default value is 1. + + + + + 'parity' - can be 0,1 or 2. Default value is 0. + + + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + &reftitle.examples; + + + Setting the baud rate on a serial port - ¬e.no-windows; diff --git a/reference/dio/functions/dio-truncate.xml b/reference/dio/functions/dio-truncate.xml index 2eaac4d682..19afed8fcb 100644 --- a/reference/dio/functions/dio-truncate.xml +++ b/reference/dio/functions/dio-truncate.xml @@ -1,6 +1,5 @@ - - + dio_truncate @@ -8,24 +7,54 @@ Truncates file descriptor fd to offset bytes - - Description + + &reftitle.description; booldio_truncate resourcefd intoffset - Function dio_truncate causes the file - referenced by fd to be truncated to at - most offset bytes in size. If the file - previously was larger than this size, the extra data is lost. If - the file previously was shorter, it is unspecified whether the - file is left unchanged or is extended. In the latter case the - extended part reads as zero bytes. &return.success;. + dio_truncate truncates a file to at most + offset bytes in size. + + + If the file previously was larger than this size, the extra data is + lost. If the file previously was shorter, it is unspecified whether the + file is left unchanged or is extended. In the latter case the extended + part reads as zero bytes. ¬e.no-windows; + + &reftitle.parameters; + + + + fd + + + The file descriptor returned by dio_open. + + + + + offset + + + The offset in bytes. + + + + + + + + &reftitle.returnvalues; + + &return.success; + + - + dio_write @@ -8,8 +7,8 @@ Writes data to fd with optional truncation at length - - Description + + &reftitle.description; intdio_write resourcefd @@ -19,14 +18,53 @@ The function dio_write writes up to len bytes from data - to file fd. If len - is not specified, dio_write writes all - data to the specified - file. dio_write returns the number of bytes - written to fd. + to file fd. + + + &reftitle.parameters; - See also dio_read. + + + fd + + + The file descriptor returned by dio_open. + + + + + data + + + The written data. + + + + + len + + + The length of data to write in bytes. If not specified, the + function writes all the data to the specified file. + + + + + + + + &reftitle.returnvalues; + + Returns the number of bytes written to fd. + + + + &reftitle.seealso; + + + dio_read +