mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-25 20:21:07 +00:00
498afc54df
This patch cleans up following the obsoletion of _BSD_SOURCE and _SVID_SOURCE by combining __USE_BSD and __USE_SVID into __USE_MISC. The only non-mechanical part of this patch is the changes to features.h; everything else is simple substitution of __USE_MISC for the old macros. Thus, this patch leaves obviously redundant conditionals such as "defined __USE_MISC || defined __USE_MISC", and does not update #endif comments where they referred to BSD or SVID in words instead of the literal macro name. This is intended to facilitate patch review by separating the less mechanical changes from these purely mechanical changes into a separate patch. (I do intend to integrate all the changes from <https://sourceware.org/ml/libc-alpha/2013-12/msg00226.html>, which I believe includes all the trailing comment updates, in subsequent patches.) Tested x86_64. * include/features.h (__USE_BSD): Remove macro definitions. (__USE_SVID): Likewise. (_BSD_SOURCE): Likewise. (_SVID_SOURCE): Likewise. [!defined _BSD_SOURCE && !defined _SVID_SOURCE]: Remove condition from definition of _DEFAULT_SOURCE. [_BSD_SOURCE || _SVID_SOURCE]: Change condition to [_DEFAULT_SOURCE]. * bits/fcntl.h [__USE_BSD]: Change condition to [__USE_MISC]. * bits/mman.h [__USE_BSD]: Likewise. * bits/termios.h [__USE_BSD]: Likewise. * bits/waitstatus.h [__USE_BSD]: Likewise. * ctype/ctype.h [__USE_SVID]: Likewise. * dirent/dirent.h [__USE_BSD]: Likewise. * grp/grp.h [__USE_SVID]: Likewise. [__USE_BSD]: Likewise. * inet/netinet/igmp.h [__USE_BSD]: Likewise. * io/fcntl.h [__USE_BSD]: Likewise. * io/ftw.h [__USE_BSD]: Likewise. * io/sys/stat.h [__USE_BSD]: Likewise. * libio/bits/stdio-ldbl.h [__USE_BSD]: Likewise. * libio/bits/stdio2.h [__USE_BSD]: Likewise. * libio/stdio.h [__USE_SVID]: Likewise. [__USE_BSD]: Likewise. * math/math.h [__USE_SVID]: Likewise. [__USE_BSD]: Likewise. * misc/bits/syslog-ldbl.h [__USE_BSD]: Likewise. * misc/bits/syslog.h [__USE_BSD]: Likewise. * misc/search.h [__USE_SVID]: Likewise. * misc/sys/mman.h [__USE_BSD]: Likewise. * misc/sys/syslog.h [__USE_BSD]: Likewise. * misc/sys/uio.h [__USE_BSD]: Likewise. * posix/bits/unistd.h [__USE_BSD]: Likewise. * posix/glob.h [__USE_BSD]: Likewise. * posix/regex.h [__USE_BSD]: Likewise. * posix/sys/types.h [__USE_BSD]: Likewise. [__USE_SVID]: Likewise. * posix/sys/utsname.h [__USE_SVID]: Likewise. * posix/sys/wait.h [__USE_BSD]: Likewise. [__USE_SVID]: Likewise. * posix/unistd.h [__USE_BSD]: Likewise. [__USE_SVID]: Likewise. * pwd/pwd.h [__USE_SVID]: Likewise. * resolv/netdb.h [__USE_BSD]: Likewise. * setjmp/setjmp.h [__USE_BSD]: Likewise. * signal/signal.h [__USE_BSD]: Likewise. [__USE_SVID]: Likewise. * socket/sys/socket.h [__USE_BSD]: Likewise. * stdlib/fmtmsg.h [__USE_SVID]: Likewise. * stdlib/stdlib.h [__USE_BSD]: Likewise. [__USE_SVID]: Likewise. * string/bits/string2.h [__USE_BSD]: Likewise. [__USE_SVID]: Likewise. * string/bits/string3.h [__USE_BSD]: Likewise. * string/endian.h [__USE_BSD]: Likewise. * string/string.h [__USE_SVID]: Likewise. [__USE_BSD]: Likewise. * string/strings.h [__USE_BSD]: Likewise. * sysdeps/generic/netinet/ip.h [__USE_BSD]: Likewise. * sysdeps/gnu/netinet/ip_icmp.h [__USE_BSD]: Likewise. * sysdeps/mach/hurd/bits/fcntl.h [__USE_BSD]: Likewise. * sysdeps/mach/hurd/bits/stat.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/mman.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/termios.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/bits/mman-linux.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/bits/sys_errlist.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/bits/termios.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/mips/bits/termios.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/netinet/if_ether.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/netinet/if_fddi.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/netinet/if_tr.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_BSD]: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_BSD]: Likewise. * sysdeps/x86/bits/string.h [__USE_BSD]: Likewise. * sysvipc/sys/ipc.h [__USE_SVID]: Likewise. * termios/termios.h [__USE_BSD]: Likewise. * time/sys/time.h [__USE_BSD]: Likewise. * time/time.h [__USE_BSD]: Likewise. [__USE_SVID]: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_BSD]: Change condition to [__USE_MISC].
178 lines
5.1 KiB
C
178 lines
5.1 KiB
C
/* Copyright (C) 1992-2014 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
/*
|
|
* X/Open Portability Guide 4.2: ftw.h
|
|
*/
|
|
|
|
#ifndef _FTW_H
|
|
#define _FTW_H 1
|
|
|
|
#include <features.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
/* Values for the FLAG argument to the user function passed to `ftw'
|
|
and 'nftw'. */
|
|
enum
|
|
{
|
|
FTW_F, /* Regular file. */
|
|
#define FTW_F FTW_F
|
|
FTW_D, /* Directory. */
|
|
#define FTW_D FTW_D
|
|
FTW_DNR, /* Unreadable directory. */
|
|
#define FTW_DNR FTW_DNR
|
|
FTW_NS, /* Unstatable file. */
|
|
#define FTW_NS FTW_NS
|
|
|
|
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
|
|
|
|
FTW_SL, /* Symbolic link. */
|
|
# define FTW_SL FTW_SL
|
|
#endif
|
|
|
|
#ifdef __USE_XOPEN_EXTENDED
|
|
/* These flags are only passed from the `nftw' function. */
|
|
FTW_DP, /* Directory, all subdirs have been visited. */
|
|
# define FTW_DP FTW_DP
|
|
FTW_SLN /* Symbolic link naming non-existing file. */
|
|
# define FTW_SLN FTW_SLN
|
|
|
|
#endif /* extended X/Open */
|
|
};
|
|
|
|
|
|
#ifdef __USE_XOPEN_EXTENDED
|
|
/* Flags for fourth argument of `nftw'. */
|
|
enum
|
|
{
|
|
FTW_PHYS = 1, /* Perform physical walk, ignore symlinks. */
|
|
# define FTW_PHYS FTW_PHYS
|
|
FTW_MOUNT = 2, /* Report only files on same file system as the
|
|
argument. */
|
|
# define FTW_MOUNT FTW_MOUNT
|
|
FTW_CHDIR = 4, /* Change to current directory while processing it. */
|
|
# define FTW_CHDIR FTW_CHDIR
|
|
FTW_DEPTH = 8 /* Report files in directory before directory itself.*/
|
|
# define FTW_DEPTH FTW_DEPTH
|
|
# ifdef __USE_GNU
|
|
,
|
|
FTW_ACTIONRETVAL = 16 /* Assume callback to return FTW_* values instead of
|
|
zero to continue and non-zero to terminate. */
|
|
# define FTW_ACTIONRETVAL FTW_ACTIONRETVAL
|
|
# endif
|
|
};
|
|
|
|
#ifdef __USE_GNU
|
|
/* Return values from callback functions. */
|
|
enum
|
|
{
|
|
FTW_CONTINUE = 0, /* Continue with next sibling or for FTW_D with the
|
|
first child. */
|
|
# define FTW_CONTINUE FTW_CONTINUE
|
|
FTW_STOP = 1, /* Return from `ftw' or `nftw' with FTW_STOP as return
|
|
value. */
|
|
# define FTW_STOP FTW_STOP
|
|
FTW_SKIP_SUBTREE = 2, /* Only meaningful for FTW_D: Don't walk through the
|
|
subtree, instead just continue with its next
|
|
sibling. */
|
|
# define FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE
|
|
FTW_SKIP_SIBLINGS = 3,/* Continue with FTW_DP callback for current directory
|
|
(if FTW_DEPTH) and then its siblings. */
|
|
# define FTW_SKIP_SIBLINGS FTW_SKIP_SIBLINGS
|
|
};
|
|
#endif
|
|
|
|
/* Structure used for fourth argument to callback function for `nftw'. */
|
|
struct FTW
|
|
{
|
|
int base;
|
|
int level;
|
|
};
|
|
#endif /* extended X/Open */
|
|
|
|
|
|
/* Convenient types for callback functions. */
|
|
typedef int (*__ftw_func_t) (const char *__filename,
|
|
const struct stat *__status, int __flag);
|
|
#ifdef __USE_LARGEFILE64
|
|
typedef int (*__ftw64_func_t) (const char *__filename,
|
|
const struct stat64 *__status, int __flag);
|
|
#endif
|
|
#ifdef __USE_XOPEN_EXTENDED
|
|
typedef int (*__nftw_func_t) (const char *__filename,
|
|
const struct stat *__status, int __flag,
|
|
struct FTW *__info);
|
|
# ifdef __USE_LARGEFILE64
|
|
typedef int (*__nftw64_func_t) (const char *__filename,
|
|
const struct stat64 *__status,
|
|
int __flag, struct FTW *__info);
|
|
# endif
|
|
#endif
|
|
|
|
/* Call a function on every element in a directory tree.
|
|
|
|
This function is a possible cancellation point and therefore not
|
|
marked with __THROW. */
|
|
#ifndef __USE_FILE_OFFSET64
|
|
extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors)
|
|
__nonnull ((1, 2));
|
|
#else
|
|
# ifdef __REDIRECT
|
|
extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func,
|
|
int __descriptors), ftw64) __nonnull ((1, 2));
|
|
# else
|
|
# define ftw ftw64
|
|
# endif
|
|
#endif
|
|
#ifdef __USE_LARGEFILE64
|
|
extern int ftw64 (const char *__dir, __ftw64_func_t __func,
|
|
int __descriptors) __nonnull ((1, 2));
|
|
#endif
|
|
|
|
#ifdef __USE_XOPEN_EXTENDED
|
|
/* Call a function on every element in a directory tree. FLAG allows
|
|
to specify the behaviour more detailed.
|
|
|
|
This function is a possible cancellation point and therefore not
|
|
marked with __THROW. */
|
|
# ifndef __USE_FILE_OFFSET64
|
|
extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors,
|
|
int __flag) __nonnull ((1, 2));
|
|
# else
|
|
# ifdef __REDIRECT
|
|
extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func,
|
|
int __descriptors, int __flag), nftw64)
|
|
__nonnull ((1, 2));
|
|
# else
|
|
# define nftw nftw64
|
|
# endif
|
|
# endif
|
|
# ifdef __USE_LARGEFILE64
|
|
extern int nftw64 (const char *__dir, __nftw64_func_t __func,
|
|
int __descriptors, int __flag) __nonnull ((1, 2));
|
|
# endif
|
|
#endif
|
|
|
|
__END_DECLS
|
|
|
|
#endif /* ftw.h */
|