modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/fts.h (about)

     1  /* File tree traversal functions declarations.
     2     Copyright (C) 1994-2016 Free Software Foundation, Inc.
     3     This file is part of the GNU C Library.
     4  
     5     The GNU C Library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9  
    10     The GNU C Library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14  
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with the GNU C Library; if not, see
    17     <http://www.gnu.org/licenses/>.  */
    18  
    19  /*
    20   * Copyright (c) 1989, 1993
    21   *	The Regents of the University of California.  All rights reserved.
    22   *
    23   * Redistribution and use in source and binary forms, with or without
    24   * modification, are permitted provided that the following conditions
    25   * are met:
    26   * 1. Redistributions of source code must retain the above copyright
    27   *    notice, this list of conditions and the following disclaimer.
    28   * 2. Redistributions in binary form must reproduce the above copyright
    29   *    notice, this list of conditions and the following disclaimer in the
    30   *    documentation and/or other materials provided with the distribution.
    31   * 4. Neither the name of the University nor the names of its contributors
    32   *    may be used to endorse or promote products derived from this software
    33   *    without specific prior written permission.
    34   *
    35   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    36   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    37   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    38   * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    39   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    40   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    41   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    42   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    43   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    44   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    45   * SUCH DAMAGE.
    46   *
    47   *	@(#)fts.h	8.3 (Berkeley) 8/14/94
    48   */
    49  
    50  #ifndef	_FTS_H
    51  #define	_FTS_H 1
    52  
    53  #include <features.h>
    54  #include <sys/types.h>
    55  
    56  typedef struct {
    57  	struct _ftsent *fts_cur;	/* current node */
    58  	struct _ftsent *fts_child;	/* linked list of children */
    59  	struct _ftsent **fts_array;	/* sort array */
    60  	dev_t fts_dev;		/* starting device # */
    61  	char *fts_path;		/* path for this descent */
    62  	int fts_rfd;		/* fd for root */
    63  	int fts_pathlen;	/* sizeof(path) */
    64  	int fts_nitems;		/* elements in the sort array */
    65  	int (*fts_compar) (const void *, const void *);	/* compare fn */
    66  
    67  #define	FTS_COMFOLLOW	0x0001	/* follow command line symlinks */
    68  #define	FTS_LOGICAL	0x0002	/* logical walk */
    69  #define	FTS_NOCHDIR	0x0004	/* don't change directories */
    70  #define	FTS_NOSTAT	0x0008	/* don't get stat info */
    71  #define	FTS_PHYSICAL	0x0010	/* physical walk */
    72  #define	FTS_SEEDOT	0x0020	/* return dot and dot-dot */
    73  #define	FTS_XDEV	0x0040	/* don't cross devices */
    74  #define FTS_WHITEOUT	0x0080	/* return whiteout information */
    75  #define	FTS_OPTIONMASK	0x00ff	/* valid user option mask */
    76  
    77  #define	FTS_NAMEONLY	0x0100	/* (private) child names only */
    78  #define	FTS_STOP	0x0200	/* (private) unrecoverable error */
    79  	int fts_options;	/* fts_open options, global flags */
    80  } FTS;
    81  
    82  #ifdef __USE_LARGEFILE64
    83  typedef struct {
    84  	struct _ftsent64 *fts_cur;	/* current node */
    85  	struct _ftsent64 *fts_child;	/* linked list of children */
    86  	struct _ftsent64 **fts_array;	/* sort array */
    87  	dev_t fts_dev;		/* starting device # */
    88  	char *fts_path;		/* path for this descent */
    89  	int fts_rfd;		/* fd for root */
    90  	int fts_pathlen;	/* sizeof(path) */
    91  	int fts_nitems;		/* elements in the sort array */
    92  	int (*fts_compar) (const void *, const void *);	/* compare fn */
    93  	int fts_options;	/* fts_open options, global flags */
    94  } FTS64;
    95  #endif
    96  
    97  typedef struct _ftsent {
    98  	struct _ftsent *fts_cycle;	/* cycle node */
    99  	struct _ftsent *fts_parent;	/* parent directory */
   100  	struct _ftsent *fts_link;	/* next file in directory */
   101  	long fts_number;	/* local numeric value */
   102  	void *fts_pointer;	/* local address value */
   103  	char *fts_accpath;	/* access path */
   104  	char *fts_path;		/* root path */
   105  	int fts_errno;		/* errno for this node */
   106  	int fts_symfd;		/* fd for symlink */
   107  	u_short fts_pathlen;	/* strlen(fts_path) */
   108  	u_short fts_namelen;	/* strlen(fts_name) */
   109  
   110  	ino_t fts_ino;		/* inode */
   111  	dev_t fts_dev;		/* device */
   112  	nlink_t fts_nlink;	/* link count */
   113  
   114  #define	FTS_ROOTPARENTLEVEL	-1
   115  #define	FTS_ROOTLEVEL		 0
   116  	short fts_level;	/* depth (-1 to N) */
   117  
   118  #define	FTS_D		 1	/* preorder directory */
   119  #define	FTS_DC		 2	/* directory that causes cycles */
   120  #define	FTS_DEFAULT	 3	/* none of the above */
   121  #define	FTS_DNR		 4	/* unreadable directory */
   122  #define	FTS_DOT		 5	/* dot or dot-dot */
   123  #define	FTS_DP		 6	/* postorder directory */
   124  #define	FTS_ERR		 7	/* error; errno is set */
   125  #define	FTS_F		 8	/* regular file */
   126  #define	FTS_INIT	 9	/* initialized only */
   127  #define	FTS_NS		10	/* stat(2) failed */
   128  #define	FTS_NSOK	11	/* no stat(2) requested */
   129  #define	FTS_SL		12	/* symbolic link */
   130  #define	FTS_SLNONE	13	/* symbolic link without target */
   131  #define FTS_W		14	/* whiteout object */
   132  	u_short fts_info;	/* user flags for FTSENT structure */
   133  
   134  #define	FTS_DONTCHDIR	 0x01	/* don't chdir .. to the parent */
   135  #define	FTS_SYMFOLLOW	 0x02	/* followed a symlink to get here */
   136  	u_short fts_flags;	/* private flags for FTSENT structure */
   137  
   138  #define	FTS_AGAIN	 1	/* read node again */
   139  #define	FTS_FOLLOW	 2	/* follow symbolic link */
   140  #define	FTS_NOINSTR	 3	/* no instructions */
   141  #define	FTS_SKIP	 4	/* discard node */
   142  	u_short fts_instr;	/* fts_set() instructions */
   143  
   144  	struct stat *fts_statp;	/* stat(2) information */
   145  	char fts_name[1];	/* file name */
   146  } FTSENT;
   147  
   148  #ifdef __USE_LARGEFILE64
   149  typedef struct _ftsent64 {
   150  	struct _ftsent64 *fts_cycle;	/* cycle node */
   151  	struct _ftsent64 *fts_parent;	/* parent directory */
   152  	struct _ftsent64 *fts_link;	/* next file in directory */
   153  	long fts_number;	/* local numeric value */
   154  	void *fts_pointer;	/* local address value */
   155  	char *fts_accpath;	/* access path */
   156  	char *fts_path;		/* root path */
   157  	int fts_errno;		/* errno for this node */
   158  	int fts_symfd;		/* fd for symlink */
   159  	u_short fts_pathlen;	/* strlen(fts_path) */
   160  	u_short fts_namelen;	/* strlen(fts_name) */
   161  
   162  	ino64_t fts_ino;	/* inode */
   163  	dev_t fts_dev;		/* device */
   164  	nlink_t fts_nlink;	/* link count */
   165  
   166  	short fts_level;	/* depth (-1 to N) */
   167  
   168  	u_short fts_info;	/* user flags for FTSENT structure */
   169  
   170  	u_short fts_flags;	/* private flags for FTSENT structure */
   171  
   172  	u_short fts_instr;	/* fts_set() instructions */
   173  
   174  	struct stat64 *fts_statp;	/* stat(2) information */
   175  	char fts_name[1];	/* file name */
   176  } FTSENT64;
   177  #endif
   178  
   179  __BEGIN_DECLS
   180  #ifndef __USE_FILE_OFFSET64
   181      FTSENT * fts_children(FTS *, int);
   182  int fts_close(FTS *);
   183  FTS *fts_open(char *const *, int, int (*)(const FTSENT **, const FTSENT **));
   184  FTSENT *fts_read(FTS *);
   185  int fts_set(FTS *, FTSENT *, int) __THROW;
   186  #else
   187  #ifdef __REDIRECT
   188      FTSENT * __REDIRECT(fts_children, (FTS *, int), fts64_children);
   189  int __REDIRECT(fts_close, (FTS *), fts64_close);
   190  FTS *__REDIRECT(fts_open, (char *const *, int, int (*)(const FTSENT **, const FTSENT **)), fts64_open);
   191  FTSENT *__REDIRECT(fts_read, (FTS *), fts64_read);
   192  int __REDIRECT_NTH(fts_set, (FTS *, FTSENT *, int), fts64_set);
   193  #else
   194  #define fts_children fts64_children
   195  #define fts_close fts64_close
   196  #define fts_open fts64_open
   197  #define fts_read fts64_read
   198  #define fts_set fts64_set
   199  #endif
   200  #endif
   201  #ifdef __USE_LARGEFILE64
   202      FTSENT64 * fts64_children(FTS64 *, int);
   203  int fts64_close(FTS64 *);
   204  FTS64 *fts64_open(char *const *, int, int (*)(const FTSENT64 **, const FTSENT64 **));
   205  FTSENT64 *fts64_read(FTS64 *);
   206  int fts64_set(FTS64 *, FTSENT64 *, int) __THROW;
   207  #endif
   208  __END_DECLS
   209  #endif				/* fts.h */