1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Remove __ASSUME_GETDENTS64_SYSCALL.

This patch removes the __ASSUME_GETDENTS64_SYSCALL macro, as its
definition is constant given the new kernel version requirements (and
was constant anyway before those requirements except for MIPS n32).

Note that the "#ifdef __NR_getdents64" conditional *is* still needed,
because MIPS n64 only has the getdents syscall (being a 64-bit ABI,
that syscall is 64-bit; the difference between the two on 64-bit
architectures is where d_type goes).  If MIPS n64 were to gain the
getdents64 syscall and we wanted to use it conditionally on the kernel
version at runtime we'd have to revert this patch, but I think that's
unlikely (and in any case, we could follow the simpler approach of
undefining __NR_getdents64 if the syscall can't be assumed, just like
we do for accept4 / recvmmsg / sendmmsg syscalls on architectures
where socketcall support came first).

Most of the getdents.c changes are reindentation.

Tested for x86_64 and x86 that installed stripped shared libraries are
unchanged by the patch.

	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_GETDENTS64_SYSCALL): Remove macro.
	* sysdeps/unix/sysv/linux/getdents.c
	[!__ASSUME_GETDENTS64_SYSCALL]: Remove conditional code.
	[!have_no_getdents64_defined]: Likewise.
	(__GETDENTS): Remove __have_no_getdents64 conditional.
This commit is contained in:
Joseph Myers
2016-03-22 00:32:20 +00:00
parent 238d60ac9b
commit 37ad347359
3 changed files with 90 additions and 114 deletions

View File

@ -1,3 +1,12 @@
2016-03-22 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_GETDENTS64_SYSCALL): Remove macro.
* sysdeps/unix/sysv/linux/getdents.c
[!__ASSUME_GETDENTS64_SYSCALL]: Remove conditional code.
[!have_no_getdents64_defined]: Likewise.
(__GETDENTS): Remove __have_no_getdents64 conditional.
2016-03-21 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SIGNALFD4):

View File

@ -33,21 +33,6 @@
#include <kernel-features.h>
#ifdef __NR_getdents64
# ifndef __ASSUME_GETDENTS64_SYSCALL
# ifndef __GETDENTS
/* The variable is shared between all *getdents* calls. */
int __have_no_getdents64 attribute_hidden;
# else
extern int __have_no_getdents64 attribute_hidden;
# endif
# define have_no_getdents64_defined 1
# endif
#endif
#ifndef have_no_getdents64_defined
# define __have_no_getdents64 0
#endif
/* For Linux we need a special version of this file since the
definition of `struct dirent' is not the same for the kernel and
the libc. There is one additional field which might be introduced
@ -137,11 +122,7 @@ __GETDENTS (int fd, char *buf, size_t nbytes)
off64_t last_offset = -1;
#ifdef __NR_getdents64
if (!__have_no_getdents64)
{
# ifndef __ASSUME_GETDENTS64_SYSCALL
int saved_errno = errno;
# endif
union
{
struct kernel_dirent64 k;
@ -153,15 +134,11 @@ __GETDENTS (int fd, char *buf, size_t nbytes)
< offsetof (struct kernel_dirent64, d_name)
&& nbytes <= sizeof (DIRENT_TYPE))
{
kbytes = nbytes + offsetof (struct kernel_dirent64, d_name)
- offsetof (DIRENT_TYPE, d_name);
kbytes = (nbytes + offsetof (struct kernel_dirent64, d_name)
- offsetof (DIRENT_TYPE, d_name));
kbuf = __alloca(kbytes);
}
retval = INLINE_SYSCALL (getdents64, 3, fd, kbuf, kbytes);
# ifndef __ASSUME_GETDENTS64_SYSCALL
if (retval != -1 || (errno != EINVAL && errno != ENOSYS))
# endif
{
const size_t size_diff = (offsetof (struct kernel_dirent64, d_name)
- offsetof (DIRENT_TYPE, d_name));
@ -233,12 +210,6 @@ __GETDENTS (int fd, char *buf, size_t nbytes)
return outp->b - buf;
}
# ifndef __ASSUME_GETDENTS64_SYSCALL
__set_errno (saved_errno);
__have_no_getdents64 = 1;
# endif
}
#endif
{
size_t red_nbytes;

View File

@ -48,10 +48,6 @@
and still does not have a 64-bit inode field. */
#define __ASSUME_ST_INO_64_BIT 1
/* The getdents64 syscall was introduced in 2.4.0-test7 (but later for
MIPS n32). */
#define __ASSUME_GETDENTS64_SYSCALL 1
/* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */
#define __ASSUME_STATFS64 1