This wiki is being migrated to http://www.github.com/z88dk/z88dk/wiki

 

Differences

This shows you the differences between two versions of the page.

libnew:unistd [2015/09/01 05:23]
aralbrec
libnew:unistd [2015/09/01 18:59] (current)
aralbrec
Line 4: Line 4:
^ Header    | [[http://z88dk.cvs.sourceforge.net/viewvc/z88dk/z88dk/include/_DEVELOPMENT/sccz80/unistd.h?content-type=text%2Fplain|{z88dk}/include/_DEVELOPMENT/sccz80/unistd.h]] | ^ Header    | [[http://z88dk.cvs.sourceforge.net/viewvc/z88dk/z88dk/include/_DEVELOPMENT/sccz80/unistd.h?content-type=text%2Fplain|{z88dk}/include/_DEVELOPMENT/sccz80/unistd.h]] |
^            | [[http://z88dk.cvs.sourceforge.net/viewvc/z88dk/z88dk/include/_DEVELOPMENT/sdcc/unistd.h?content-type=text%2Fplain|{z88dk}/include/_DEVELOPMENT/sdcc/unistd.h]] | ^            | [[http://z88dk.cvs.sourceforge.net/viewvc/z88dk/z88dk/include/_DEVELOPMENT/sdcc/unistd.h?content-type=text%2Fplain|{z88dk}/include/_DEVELOPMENT/sdcc/unistd.h]] |
-^ Source    | [[http://z88dk.cvs.sourceforge.net/viewvc/z88dk/z88dk/libsrc/_DEVELOPMENT/fcntl/z80/|{z88dk}/libsrc/_DEVELOPMENT/fcntl]]                    | 
Other References: Other References:
Line 32: Line 31:
-===== int close(int fd) =====+===== FUNCTIONS =====
-===== int dup(int fd) =====+==== int close(int fd) ====
-===== int dup2(int fd, int fd2) =====+Clear the file descriptor //fd// in the file table making the file descriptor available for a newly opened file.  Decrease the file's reference count and if it reaches zero, flush and close the file.  Return 0 on success and -1 on failure.
-===== void _exit(int status) =====+If an error occurs, carry flag is set and errno is set to:
-===== off_t lseek(int fd, off_t offset, int whence) =====+  * [EBDFD] if //fd// is not an open file
-===== ssize_t read(int fd, void *buf, size_t nbyte) =====+==== int dup(int fd) ====
-===== ssize_t write(int fd,const void *buf,size_t nbyte) =====+Duplicate the file descriptor //fd// into the first available slot in the file table in numerical order.  Returns the duplicate fd on success and -1 on failure.
 +If an error occurs, carry flag is set and errno is set to:
 +
 +  * [EBDFD] if //fd// is not an open file
 +  * [ENFILE] if the file table is full
 +
 +==== int dup2(int fd, int fd2) ====
 +
 +Duplicate the file descriptor //fd// into //fd2//.  If //fd2// is associated with an open file, close it first.  Returns //fd2// on success or -1 on failure.
 +
 +If an error occurs, carry flag is set and errno is set to:
 +
 +  * [EBDFD] if //fd// is not an open file
 +  * [EBDFD] if //fd2// is out of range
 +
 +==== void _exit(int status) ====
 +
 +Same as _Exit(status)
 +
 +==== off_t lseek(int fd, off_t offset, int whence) ====
 +
 +Adjust the file pointer by amount //offset// according to //whence//:
 +
 +^ whence    | |
 +| SEEK_SET  | Set the file pointer to //offset//  |
 +| SEEK_CUR  | Adjust the current file pointer by signed //offset//  |
 +| SEEK_END  | Set the file pointer to the EOF position plus signed //offset//  |
 +
 +Return the new file pointer position on success or -1 on error.
 +
 +If an error occurs, carry flag is set and errno is set to:
 +
 +  * [EBDFD] if //fd// is not an open file
 +  * [EINVAL] if //whence// is invalid
 +
 +The driver may return other errors.
 +
 +==== ssize_t read(int fd, void *buf, size_t nbyte) ====
 +
 +Read a maximum of //nbyte// bytes from the stream and write them into buffer //buf//.  Returns the number of bytes actually read or -1 on error.
 +
 +If an error occurs, carry flag is set and errno is set to:
 +
 +  * [EACCES] if //fd// is not open for reading
 +  * [EBDFD] if //fd// is not an open file
 +
 +The driver may return other errors.
 +
 +==== ssize_t write(int fd, const void *buf, size_t nbyte) ====
 +
 +Attempt to write //nbyte// bytes from buffer //buf// to the stream.  Return the number of bytes actually written or -1 on error.
 +
 +If an error occurs, carry flag is set and errno is set to:
 +
 +  * [EACCES] if //fd// is not open for writing
 +  * [EBDFD] if //fd// is not an open file
 +
 +The driver may return other errors.
 
libnew/unistd.txt · Last modified: 2015/09/01 18:59 by aralbrec
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki