Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Apr 1998 13:00:06 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-lib@FreeBSD.ORG, cvs-sys@FreeBSD.ORG, des@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/sys lseek.2 src/sys/kern vfs_syscalls.c
Message-ID:  <199804190300.NAA15945@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>des         1998/04/18 12:24:45 PDT
>
>  Modified files:
>    lib/libc/sys         lseek.2 
>  Log:
>  Return EINVAL and do not changefile pointer if resulting offset is negative.
>  PR:		kern/6184
>  
>  Revision  Changes    Path
>  1.7       +2 -2      src/lib/libc/sys/lseek.2
>
>  Modified files:
>    sys/kern             vfs_syscalls.c 
>  Log:
>  Return EINVAL and do not change file pointer if resulting offset is negative.
>  PR:		kern/6184

This is wrong.  Please back it out.  It breaks at least the ability to
seek to high addresses in /dev/[k]mem on 64 bit systems.  Not long ago
when off_t was 32 bits, it was normal to seek to "negative" addresses in
/dev/kmem, so portable programs should be able to handle such addresses
at least if they actually request them.  libkvm/kvm_proc.c:kvm_uread()
shows how to handle them:

	errno = 0;
	if (lseek(fd, (off_t)uva, 0) == -1 && errno != 0) {
		/* Error. */
		...
	}
	/* No error. */
	...

This allows seeking to (off_t)-1 provided the system supports it.

I replied to the PR, but for some reason the followup didn't get attached
to the PR.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804190300.NAA15945>