- Unison Kernel
- Pthread Cancellation
- Message Queues
- Conditional Variables
- Memory Allocation
- Directory Services
- Unison I/O Library
- Unison STDIO Library
- STDIO Library Calls
- Do-nothing Stubs
- STDIO Library Calls
- Unison LIBC Library
- Unison I/O Servers
- Graphics, Camera, Video, Audio
- Network Protocols
- TCP and UDP Server - tcpd
- DHCP Client Service - dhcp client
- DHCP Server - dhcpd
- Telnet Server - telnetd
- Tiny FTP Server - tftpd
- Point to Point - pppd
- Network Translation - NAT with PAT
- Tiny HTTP Server - thttpd
- Tiny HTTP Server with TLS
- POP3 Server
- Simple Mail Transfer Protocol Services (SMTP)
- Bootp Protocol
- File Transfer Protocol Server (FTP)
- File Transfer Client Services
- RPC / XDR
- DNS Client
- HTTP/HTTPS Client
- REST Client
- AutoIP Service - autoip client
- mDNS server - mdnsd
- SNTP Client
- SNMP Agent - Snmpd server
- SSL/TLS library
- SSH server
- IP security
- Power Control
- Serial I/O
- System Services
- Universal Serial Bus (USB)
- Remedy Tools for Unison
lseek – move read/write file pointer
- off_t lseek(int fildes , off_t offset , int whence );
lseek() sets the file pointer associated with the open file descriptor specified by fildes as follows: If whence is
- The pointer is set to offset bytes.
- The pointer is set to its current location plus offset.
- The pointer is set to the size of the file plus offset.
On success, lseek() returns the resulting pointer location, as measured in bytes from the beginning of the file. Note that if fildes is a remote file descriptor and offset is negative, lseek() returns the file pointer even if it is negative.
lseek() allows the file pointer to be set beyond the existing data in the file. If data are later written at this point, subsequent reads in the gap between the previous end of data and the newly written data will return bytes of value 0 until data are written into the gap.
Upon successful completion, the resulting file pointer is returned. Remote file descriptors are the only ones that allow negative file pointers. Otherwise, a value of -1 is returned and errno is set to indicate the error.
This function is a member of Unison’s IOLIB family of functions. IOLIB is implemented as a message passing and generalized interface layer. Each Unison I/O server is responsible for its own error reporting.
For an exact list of error codes returned by a particular server, refer to that server’s documentation in the Unison Programmer’s Guide for each specific platform.
Servers may implement these errors codes in response to this function.
lseek() fails and the file pointer remains unchanged if one or more of the following are true:
- fildes is not an open file descriptor.
- Operation is not permitted on fildes.
- whence is not SEEK_SET, SEEK_CUR, or SEEK_END. Or, the resulting file pointer would be negative.
- fildes is associated with a socket.
Some devices are incapable of seeking. The value of the file pointer associated with such a device is undefined.