xref: /titanic_50/usr/src/lib/libast/sparcv9/include/ast/fts.h (revision 29e83d4b25fd82feb8e0e0fbe89f7e2a8438533d)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *           Copyright (c) 1985-2007 AT&T Knowledge Ventures            *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                      by AT&T Knowledge Ventures                      *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 /*
26  * Glenn Fowler
27  * David Korn
28  * Phong Vo
29  * AT&T Research
30  *
31  * fts interface definitions
32  */
33 
34 #ifndef	_FTS_H
35 #if !defined(__PROTO__)
36 #include <prototyped.h>
37 #endif
38 #if !defined(__LINKAGE__)
39 #define __LINKAGE__		/* 2004-08-11 transition */
40 #endif
41 
42 #define _FTS_H
43 
44 #include <ls.h>
45 
46 /*
47  * fts_open flags
48  */
49 
50 #define FTS_LOGICAL	0	/* logical traversal, follow symlinks	*/
51 #define FTS_META	(1<<0)	/* follow top dir symlinks even if phys	*/
52 #define FTS_NOCHDIR	(1<<1)	/* don't chdir				*/
53 #define FTS_NOPOSTORDER	(1<<2)	/* no postorder visits			*/
54 #define FTS_NOPREORDER	(1<<3)	/* no preorder visits			*/
55 #define FTS_NOSEEDOTDIR	(1<<11)	/* never retain leading . dir		*/
56 #define FTS_NOSTAT	(1<<4)	/* don't stat children			*/
57 #define FTS_ONEPATH	(1<<5)	/* pathnames arg is one const char*	*/
58 #define FTS_PHYSICAL	(1<<6)	/* physical traversal, don't follow	*/
59 #define FTS_SEEDOT	(1<<7)	/* return . and ..			*/
60 #define FTS_SEEDOTDIR	(1<<10)	/* always retain leading . dir		*/
61 #define FTS_TOP		(1<<8)	/* don't traverse subdirectories	*/
62 #define FTS_XDEV	(1<<9)	/* don't cross mount points		*/
63 
64 #define FTS_USER	(1<<12)	/* first user flag bit			*/
65 
66 #define FTS_COMFOLLOW	FTS_META
67 
68 /*
69  * fts_info flags
70  */
71 
72 #define FTS_DEFAULT	0	/* ok, someone must have wanted this	*/
73 
74 #define FTS_NS		(1<<0)	/* stat failed				*/
75 #define FTS_F		(1<<1)	/* file - not directory or symbolic link*/
76 #define FTS_SL		(1<<2)	/* symbolic link			*/
77 #define FTS_D		(1<<3)	/* directory - pre-order visit		*/
78 
79 #define FTS_C		(1<<4)	/* causes cycle				*/
80 #define FTS_ERR		(1<<5)	/* some other error			*/
81 #define FTS_DD		(1<<6)	/* . or ..				*/
82 #define FTS_NR		(1<<7)	/* cannot read				*/
83 #define FTS_NX		(1<<8)	/* cannot search			*/
84 #define FTS_OK		(1<<9)	/* no info but otherwise ok		*/
85 #define FTS_P		(1<<10)	/* post-order visit			*/
86 
87 #define FTS_DC		(FTS_D|FTS_C)	/* dir - would cause cycle	*/
88 #define FTS_DNR		(FTS_D|FTS_NR)	/* dir - no read permission	*/
89 #define FTS_DNX		(FTS_D|FTS_NX)	/* dir - no search permission	*/
90 #define FTS_DOT		(FTS_D|FTS_DD)	/* . or ..			*/
91 #define FTS_DP		(FTS_D|FTS_P)	/* dir - post-order visit	*/
92 #define FTS_NSOK	(FTS_NS|FTS_OK)	/* no stat (because you asked)	*/
93 #define FTS_SLNONE	(FTS_SL|FTS_NS)	/* symlink - to nowhere		*/
94 
95 /*
96  * fts_set flags
97  */
98 
99 #define FTS_AGAIN	FTS_TOP		/* process entry again		*/
100 #define FTS_FOLLOW	FTS_META	/* follow FTS_SL symlink	*/
101 #define FTS_SKIP	FTS_NOSTAT	/* skip FTS_D directory		*/
102 #define FTS_STAT	FTS_PHYSICAL	/* stat() done by user		*/
103 
104 typedef struct Fts FTS;
105 typedef struct Ftsent FTSENT;
106 
107 struct Ftsent
108 {
109 	char*		fts_accpath;	/* path relative to .		*/
110 	char*		fts_name;	/* file name			*/
111 	char*		fts_path;	/* path relative to top dir	*/
112 	FTSENT*		fts_cycle;	/* offender if cycle		*/
113 	FTSENT*		fts_link;	/* next child			*/
114 	FTSENT*		fts_parent;	/* parent directory		*/
115 	struct stat*	fts_statp;	/* stat info			*/
116 #ifdef _FTSENT_LOCAL_PRIVATE_
117 	_FTSENT_LOCAL_PRIVATE_
118 #else
119 	__V_*		fts_pointer;	/* local pointer value		*/
120 #endif
121 	long		fts_number;	/* local numeric value		*/
122 	int		fts_errno;	/* errno for this entry		*/
123 	unsigned short	fts_info;	/* info flags			*/
124 	unsigned short	fts_namelen;	/* strlen(fts_name)		*/
125 	unsigned short	fts_pathlen;	/* strlen(fts_path)		*/
126 	short		fts_level;	/* file tree depth, 0 at top	*/
127 
128 #ifdef _FTSENT_PRIVATE_
129 	_FTSENT_PRIVATE_
130 #endif
131 
132 };
133 
134 struct Fts
135 {
136 	int		fts_errno;	/* last errno			*/
137 
138 #ifdef _FTS_PRIVATE_
139 	_FTS_PRIVATE_
140 #endif
141 
142 };
143 
144 #if _BLD_ast && defined(__EXPORT__)
145 #undef __MANGLE__
146 #define __MANGLE__ __LINKAGE__		__EXPORT__
147 #endif
148 
149 extern __MANGLE__ FTSENT*	fts_children __PROTO__((FTS*, int));
150 extern __MANGLE__ int	fts_close __PROTO__((FTS*));
151 extern __MANGLE__ int	fts_flags __PROTO__((void));
152 extern __MANGLE__ int	fts_notify __PROTO__((int(*)(FTS*, FTSENT*, __V_*), __V_*));
153 extern __MANGLE__ FTS*	fts_open __PROTO__((char* const*, int, int(*)(FTSENT* const*, FTSENT* const*)));
154 extern __MANGLE__ FTSENT*	fts_read __PROTO__((FTS*));
155 extern __MANGLE__ int	fts_set __PROTO__((FTS*, FTSENT*, int));
156 
157 #undef __MANGLE__
158 #define __MANGLE__ __LINKAGE__
159 
160 #endif
161