what does `l` in `lseek` of unistd.h mean?

610 Views Asked by At

I am reading APUE to explore the details of C and Unix, and encounter lseek

NAME
lseek - move the read/write file offset
SYNOPSIS
#include <unistd.h>

off_t lseek(int fildes, off_t offset, int whence);

What does l mean, is it length?

1

There are 1 best solutions below

0
On

l is for long integer.

It is named like that to differentiate from the old seek() in version 2 of AT&T Unix. This is an anachronism before the off_t type was introduced.


References:

Infohost indicates:

The character l in the name lseek means "long integer". Before the introduction of the off_t data type, the offset argument and the return value were long integers. lseek was introduced with Version 7 when long integers were added to C. (Similar functionality was provided in Version 6 by the functions seek and tell.)

As noted at the foot of lseek.html:

 A seek() function appeared in Version 2 AT&T UNIX, later renamed into
 lseek() for ``long seek'' due to a larger offset argument type.

Note: Paraphrased from Why is the function called lseek(), not seek()?