[PATCH] Don't try fcntl64 if not needed
Jakub Jelinek
jakub@redhat.com
Sat Sep 2 14:58:00 GMT 2000
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
More information about the Libc-hacker
mailing list