[Glibc-bsd-commits] r2526 - trunk/glibc-ports/kfreebsd

Aurelien Jarno aurel32 at alioth.debian.org
Sat May 23 20:28:58 UTC 2009


Author: aurel32
Date: 2009-05-23 20:28:58 +0000 (Sat, 23 May 2009)
New Revision: 2526

Modified:
   trunk/glibc-ports/kfreebsd/lseek.c
Log:
POSIX behaviour in lseek() has been introduced in version 5.0. As we only
support version >= 6.0, remove the compat code.


Modified: trunk/glibc-ports/kfreebsd/lseek.c
===================================================================
--- trunk/glibc-ports/kfreebsd/lseek.c	2009-05-23 18:46:53 UTC (rev 2525)
+++ trunk/glibc-ports/kfreebsd/lseek.c	2009-05-23 20:28:58 UTC (rev 2526)
@@ -31,45 +31,8 @@
 __off_t
 __libc_lseek (int fd, __off_t offset, int whence)
 {
-#if 0 /* If the kernel would work right... */
   /* We pass 3 arguments in 5 words.  */
   return INLINE_SYSCALL (freebsd6_lseek, 3, fd, 0, offset, whence);
-#else
-  /* According to POSIX:2001, if the resulting file offset would become
-     negative, this function has to return an EINVAL error and leave the
-     file offset unchanged.  But the FreeBSD 4.0 kernel doesn't do this,
-     so we emulate it.  */
-  if (offset >= 0)
-    /* No risk that the file offset could become negative.  */
-    return INLINE_SYSCALL (freebsd6_lseek, 3, fd, 0, offset, whence);
-  else
-    {
-      /* Test whether the file offset becomes negative.  */
-      __off_t old_position;
-      __off_t new_position;
-      int saved_errno;
-
-      saved_errno = errno;
-      old_position = INLINE_SYSCALL (freebsd6_lseek, 3, fd, 0, 0, SEEK_CUR);
-      errno = 0;
-      new_position = INLINE_SYSCALL (freebsd6_lseek, 3, fd, 0, offset, whence);
-      if (new_position < 0)
-	{
-	  if (errno == 0)
-	    {
-	      /* The file offset became negative, and the kernel didn't
-		 notice it.  */
-	      if (old_position >= 0)
-		INLINE_SYSCALL (freebsd6_lseek, 3, fd, 0, old_position, SEEK_SET);
-	      new_position = -1;
-	      errno = EINVAL;
-	    }
-	}
-      else
-	errno = saved_errno;
-      return new_position;
-    }
-#endif
 }
 
 weak_alias (__libc_lseek, __lseek)




More information about the Glibc-bsd-commits mailing list