Fwd: Re: [PATCH] fcntl cleanup

Peter Mazinger ps.m at gmx.net
Tue May 8 22:09:18 UTC 2012


Sorry for the earlier empty mail, here it comes ...

-------- Original-Nachricht --------
Datum: Wed, 09 May 2012 00:07:46 +0200
Von: "Peter Mazinger" <ps.m at gmx.net>
An: Mark Salter <msalter at redhat.com>
Betreff: Re: [PATCH] fcntl cleanup

Hi,

finally, it goes into the "right" direction (at least for me)
My target is to get rid of the *LFS* config option and all the *64* functions. Your proposal is OK, we need to handle as it seems the case __NR_fcntl (and __NR_fcntl64 not) defined and getting one of F_GETLK64 || F_SETLK64 || F_SETLKW64

What about saying (I know it is to early for this ;-)
fdef __NR_fcntl64
 __NR_fcntl = __NR_fcntl64
endif

-------- Original-Nachricht --------
> Datum: Tue, 08 May 2012 16:48:12 -0400
> Von: Mark Salter <msalter at redhat.com>
> An: Peter Mazinger <ps.m at gmx.net>
> CC: uclibc at uclibc.org
> 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


-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a


More information about the uClibc mailing list