Subject: lseek
To: None <>
From: Lennart Augustsson <>
List: current-users
Date: 03/31/1994 15:01:16
As far as I can tell the new lseek system call (#199) is broken.

Try the following:
#include <sys/types.h>

extern off_t lseek(int, off_t, int);

extern int errno;

	union {
	off_t x;
	long l[2];
	} u;

	u.x = lseek(0, (off_t)0, 0);
	printf("%x %x %d errno=%d\n", u.l[0], u.l[1], u.x == (off_t)-1, errno);

and pipe something into it.  errno is set correctlty, but the
return value from lseek is not -1.

After digging a few minutes in the kernel I think the problem is
that when lseek does an error return it does not set both eax/edx,
but just eax to -1.

This bug breaks gawk, and maybe more programs.  BTW, gawk also
needs a gid_t (as does several other programs, like sh and id).

	-- Lennart