-------- Original-Nachricht --------
> Datum: Tue, 08 May 2012 16:48:12 -0400
> Von: Mark Salter <[email protected]>
> An: Peter Mazinger <[email protected]>
> CC: [email protected]
> Betreff: Re: [PATCH] fcntl cleanup

> On Tue, 2012-05-08 at 21:18 +0200, Peter Mazinger wrote:
> > Hi,
> 
> Hi. Thanks for looking at this.
> 
> > 
> > > The code in the future branch is much better organized but it
> > > still relies on the fcntl syscall which may not exist. It also
> > > tests for the fctnl64 locking commands unnecessarily for some
> > > configurations.
> > 
> > I can't see, what should happen, when fcntl[64] are not available. Are
> > you thinking of some fallback function to implement it?
> 
> No. I don't think there is a fallback. If fcntl64 is not available on
> a 32-bit system, I don't think you can do locking with 64-bit offsets.
> 
> > 
> > Which configurations do not have the above named lockings? I have
> > looked at them and the only thing I know might be, that the naming is
> > different, but the "numbering" can be used for 32/64 bit cases.
> 
> The special 64-bit lockings are only on 32-bit kernels or 64-bit kernels
> with compat_fcntl64 syscall.
> 
> > 
> > Since I (re)wrote that part, I am interested in implementing it better
> 
> I would suggest the following. It eliminates an unnecessary check for
> the ENOSYS error when we have LFS and __NR_fcntl64. It also works for
> newer 32-bit kernel ports which don't have __NR_fcntl.
> 
> 
> diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c
> b/libc/sysdeps/linux/common/__syscall_fcntl.c
> index 77a2c37..80bc8ce 100644
> --- a/libc/sysdeps/linux/common/__syscall_fcntl.c
> +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c
> @@ -16,17 +16,17 @@
>  
>  int __NC(fcntl)(int fd, int cmd, long arg)
>  {
> -#if __WORDSIZE == 32
> +#if __WORDSIZE == 32 && !(defined __UCLIBC_HAS_LFS__ && defined
> __NR_fcntl64)
>       if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
> -# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
> -             return __NC(fcntl64)(fd, cmd, arg);
> -# else
>               __set_errno(ENOSYS);
>               return -1;
> -# endif
>       }
>  #endif
> +#if __WORDSIZE == 32 && defined __NR_fcntl64
> +     return INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg);
> +#else
>       return INLINE_SYSCALL(fcntl, 3, fd, cmd, arg);
> +#endif
>  }
>  
>  int fcntl(int fd, int cmd, ...)
> 
> 

-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                          
        
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to