Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (k - m) lseek(2)
NOTES
To use the lseek() functionality in a threaded application that uses the Standard POSIX Threads
library, see spt_lseekz(2).
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks to make the function thread-aware in a multi-threaded application:
Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
Link the application to the zputdll library (/G/system/zdllnnn/zputdll).
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit OSS applications.
To use this function in a 32-bit threaded application on systems running H06.24 or later RVUs or
J06.13 or later RVUs, perform the same tasks (described above) used to make the function
thread-aware in a multi-threaded application on systems running H06.21/J06.10 or later RVUs.
To use this function in a 64-bit threaded application on systems running H06.24 or later RVUs or
J06.13 or later RVUs, you must perform all of the following tasks to make the function thread-
aware in a multi-threaded application:
Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
Compile the application using the -Wlp64 compiler command option.
Link the application to the yputdll library (/G/system/zdllnnn/yputdll).
For detailed information about writing multi-threaded and 64-bit applications for the Open Sys-
tem Services environment, see the Open System Services Programmers Guide.
RETURN VALUES
Upon successful completion, the resulting pointer location, measured in bytes from the beginning
of the file, is returned. For First-in, First-out (FIFO) files, pipes, and character special files, the
value 0 (zero) is returned. For character special files, errno is not set.
If the lseek() function fails, the file offset remains unchanged, the value -1 cast to the type off_t
is returned, and errno is set to indicate the error.
ERRORS
If any of these conditions occurs, the file offset remains unchanged, and the lseek() function sets
errno to the corresponding value:
[EBADF] The filedes parameter is not an open file descriptor.
[EINVAL] One of these conditions exists:
The whence parameter is an invalid value, or the resulting file offset
would be an invalid value (that is, a value less than 0 [zero]).
The filedes parameter refers to a file (other than a pipe, FIFO, or direc-
tory) on which seeking cannot be performed.
527186-023 Hewlett-Packard Company 423