[PATCH] support kernels without __ARCH_WANT_SYSCALL_OFF_T

Mike Frysinger vapier at gentoo.org
Fri Apr 27 03:53:14 UTC 2012


On Thursday 26 April 2012 10:17:38 Mark Salter wrote:
> --- a/ldso/include/dl-syscall.h
> +++ b/ldso/include/dl-syscall.h
>
> +#elif defined(__NR_fstatat64)
> +#define __NR__dl_fstatat64 __NR_fstatat64
> +static __always_inline _syscall4(int, _dl_fstatat64, int, dirfd, const char *, fn,
> +			struct stat *, stat, int, flags)
> +static __always_inline int
> +_dl_stat(const char *fn, struct stat *stat)
> +{
> +	return _dl_fstatat64(AT_FDCWD, fn, stat, 0);
> +}
> +#endif

use INLINE_SYSCALL()

> --- a/libc/sysdeps/linux/common/__syscall_fcntl.c
> +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c
> @@ -38,7 +38,11 @@ int __fcntl_nocancel (int fd, int cmd, ...)
>  #  endif
>  	}
>  # endif
> +# if defined __NR_fcntl
>  	return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
> +# elif defined __NR_fcntl64
> +	return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
> +# endif
>  }
>  libc_hidden_def(__fcntl_nocancel)
> 
> @@ -81,7 +85,11 @@ int __libc_fcntl (int fd, int cmd, ...)
>  #  endif
>  	}
>  # endif
> +# if defined __NR_fcntl
>  	return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
> +# elif defined __NR_fcntl64
> +	return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
> +# endif
>  #endif
>  }

this file is getting worse and worse.  looking at the LFS logic, i don't see
the point in protecting most of that.  when it comes to LFS support on 32bit
targets, we provide the knob to save size.  but in this file, there's no
savings -- we just pick between two different numbers.

further, i'm not quite sure why there is NPTL-specific logic.  seems like the
cancellation stuff should be there for any pthread implementation.

> --- a/libc/sysdeps/linux/common/fstatfs.c
> +++ b/libc/sysdeps/linux/common/fstatfs.c
> 
> +#ifdef __NR_fstatfs
>  extern __typeof(fstatfs) __libc_fstatfs attribute_hidden;
>  #define __NR___libc_fstatfs __NR_fstatfs
>  _syscall2(int, __libc_fstatfs, int, fd, struct statfs *, buf)
> +#elif defined __NR_fstatfs64
> +#define __NR___syscall_fstatfs64 __NR_fstatfs64
> +_syscall3(int, __syscall_fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 *, buf)
> +int __libc_fstatfs(int fd, struct statfs *buf)
> +{
> +	struct statfs64 st;
> +	int err;
> +
> +	err = __syscall_fstatfs64(fd, sizeof(st), &st);

use INLINE_SYSCALL()

> --- a/libc/sysdeps/linux/common/ftruncate.c
> +++ b/libc/sysdeps/linux/common/ftruncate.c
> 
> +#ifdef __NR_ftruncate
>  _syscall2(int, ftruncate, int, fd, __off_t, length)
> +#elif defined __NR_truncate64
> +int ftruncate(int fd, __off_t length)
> +{
> +	return ftruncate64(fd, length);
> +}
> +#endif

this would be a candidate for merging into existing ftruncate64.c so we can
make them aliases to each other i think ...

> --- a/libc/sysdeps/linux/common/statfs.c
> +++ b/libc/sysdeps/linux/common/statfs.c
> 
> +#elif defined __NR_statfs64
> +#define __NR___syscall_statfs64 __NR_statfs64
> +_syscall2(int, __syscall_statfs64, const char *, path, struct statfs64 *, buf)
> +
> +int __libc_statfs(const char *path, struct statfs *buf)
> +{
> +	struct statfs64 st;
> +	int err;
> +
> +	err = __syscall_statfs64(path, &st);

use INLINE_SYSCALL()

> --- a/libc/sysdeps/linux/common/truncate.c
> +++ b/libc/sysdeps/linux/common/truncate.c
> 
> +#ifdef __NR_truncate
>  _syscall2(int, truncate, const char *, path, __off_t, length)
> +#elif defined(__NR_truncate64)
> +int truncate(const char *path, __off_t length)
> +{
> +	return truncate64(path, length);
> +}
> +#endif
>  libc_hidden_def(truncate)

same feedback as ftruncate.c
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20120426/fded9342/attachment-0001.asc>


More information about the uClibc mailing list