This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Don't try fcntl64 if not needed


Hi!

fcntl on i386 and sparc32 currently if not build with --enable-kernel=2.4.1
and above is trying fcntl64 first and falls back to fcntl syscalls for all
cmd values, which is IMHO overkill. The following patch makes it to try
fcntl64 only if F_GETLK64 and above commands are requested, thus saving one
fcntl64 -ENOSYS call on earlier kernels in the common case (non-LFS compiled
application).

2000-09-02  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/i386/fcntl.c (__libc_fcntl): Only try
	fcntl64 for commands F_GETLK64 and above.

--- libc/sysdeps/unix/sysv/linux/i386/fcntl.c.jj	Sat Aug 12 12:00:35 2000
+++ libc/sysdeps/unix/sysv/linux/i386/fcntl.c	Sat Sep  2 22:21:33 2000
@@ -44,7 +44,7 @@ __libc_fcntl (int fd, int cmd, ...)
   return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
 #else
 # ifdef __NR_fcntl64
-  if (! __have_no_fcntl64)
+  if (cmd >= F_GETLK64 && ! __have_no_fcntl64)
     {
       int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
       if (result >= 0 || errno != ENOSYS)

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]