summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-02-22 22:52:26 +0000
committerjbj <devnull@localhost>2002-02-22 22:52:26 +0000
commit4e34d9ebf749b0db380380b0de7b3f82b4c151bc (patch)
treeaec41c90b65d9577c42e12d496e9bce5060b6545
parent0108a7b8cbcfeb1ed6a97e8841d234616e91de5b (diff)
downloadlibrpm-tizen-4e34d9ebf749b0db380380b0de7b3f82b4c151bc.tar.gz
librpm-tizen-4e34d9ebf749b0db380380b0de7b3f82b4c151bc.tar.bz2
librpm-tizen-4e34d9ebf749b0db380380b0de7b3f82b4c151bc.zip
Make peace with lclint for fts.[ch].
CVS patchset: 5332 CVS date: 2002/02/22 22:52:26
-rw-r--r--rpmio/fts.c189
-rw-r--r--rpmio/fts.h188
2 files changed, 211 insertions, 166 deletions
diff --git a/rpmio/fts.c b/rpmio/fts.c
index a55b37bb7..eefc41486 100644
--- a/rpmio/fts.c
+++ b/rpmio/fts.c
@@ -1,3 +1,5 @@
+/*@-sysunrecog -noeffectuncon -nullpass -sizeoftype -unrecog -usereleased @*/
+/*@-compdef -compmempass -dependenttrans -retalias @*/
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -44,14 +46,12 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#else
#include "system.h"
#include "fts.h"
-# define internal_function
+#include "rpmio.h"
+#include "rpmurl.h"
# define __set_errno(val) (*__errno_location ()) = (val)
# define __open open
# define __close close
# define __fchdir fchdir
-# define __opendir opendir
-# define __closedir closedir
-# define __readdir readdir
#endif
@@ -66,17 +66,30 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#endif
-static FTSENT *fts_alloc __P((FTS *, const char *, int)) internal_function;
-static FTSENT *fts_build __P((FTS *, int)) internal_function;
-static void fts_lfree __P((FTSENT *)) internal_function;
-static void fts_load __P((FTS *, FTSENT *)) internal_function;
-static size_t fts_maxarglen __P((char * const *)) internal_function;
-static void fts_padjust __P((FTS *, FTSENT *)) internal_function;
-static int fts_palloc __P((FTS *, size_t)) internal_function;
-static FTSENT *fts_sort __P((FTS *, FTSENT *, int)) internal_function;
-static u_short fts_stat __P((FTS *, FTSENT *, int)) internal_function;
-static int fts_safe_changedir __P((FTS *, FTSENT *, int, const char *))
- internal_function;
+/*@only@*/
+static FTSENT * fts_alloc(FTS * sp, const char * name, int namelen)
+ /*@*/;
+static FTSENT * fts_build(FTS * sp, int type)
+ /*@globals fileSystem, internalState @*/
+ /*@modifies *sp, fileSystem, internalState @*/;
+static void fts_lfree(/*@only@*/ FTSENT * head)
+ /*@modifies head @*/;
+static void fts_load(FTS * sp, FTSENT * p)
+ /*@modifies *sp, *p @*/;
+static size_t fts_maxarglen(char * const * argv)
+ /*@*/;
+static void fts_padjust(FTS * sp, FTSENT * head)
+ /*@modifies *sp, *head @*/;
+static int fts_palloc(FTS * sp, size_t more)
+ /*@modifies *sp @*/;
+static FTSENT * fts_sort(FTS * sp, /*@returned@*/ FTSENT * head, int nitems)
+ /*@modifies *sp @*/;
+static u_short fts_stat(FTS * sp, FTSENT * p, int follow)
+ /*@modifies *p @*/;
+static int fts_safe_changedir(FTS * sp, FTSENT * p, int fd,
+ const char * path)
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/;
#ifndef MAX
#define MAX(a, b) ({ __typeof__ (a) _a = (a); \
@@ -98,10 +111,8 @@ static int fts_safe_changedir __P((FTS *, FTSENT *, int, const char *))
#define BREAD 3 /* fts_read */
FTS *
-Fts_open(argv, options, compar)
- char * const *argv;
- register int options;
- int (*compar) __P((const FTSENT **, const FTSENT **));
+Fts_open(char * const * argv, int options,
+ int (*compar) (const FTSENT **, const FTSENT **))
{
register FTS *sp;
register FTSENT *p, *root;
@@ -116,10 +127,15 @@ Fts_open(argv, options, compar)
}
/* Allocate/initialize the stream */
- if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
+ if ((sp = malloc((u_int)sizeof(*sp))) == NULL)
return (NULL);
- memset(sp, 0, sizeof(FTS));
- sp->fts_compar = (int (*) __P((const void *, const void *))) compar;
+ memset(sp, 0, sizeof(*sp));
+ sp->fts_compar = (int (*) (const void *, const void *)) compar;
+ sp->fts_opendir = Opendir;
+ sp->fts_readdir = Readdir;
+ sp->fts_closedir = Closedir;
+ sp->fts_stat = Stat;
+ sp->fts_lstat = Lstat;
sp->fts_options = options;
/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
@@ -149,6 +165,21 @@ Fts_open(argv, options, compar)
goto mem3;
}
+ /* Use fchdir(2) speedup only if local DASDI. */
+ switch (urlIsURL(*argv)) {
+ case URL_IS_DASH:
+ __set_errno (ENOENT);
+ goto mem3;
+ /*@notreached@*/ /*@switchbreak@*/ break;
+ case URL_IS_HTTP:
+ case URL_IS_FTP:
+ SET(FTS_NOCHDIR);
+ /*@switchbreak@*/ break;
+ case URL_IS_UNKNOWN:
+ case URL_IS_PATH:
+ /*@switchbreak@*/ break;
+ }
+
p = fts_alloc(sp, *argv, len);
p->fts_level = FTS_ROOTLEVEL;
p->fts_parent = parent;
@@ -176,8 +207,10 @@ Fts_open(argv, options, compar)
}
}
}
+ /*@-branchstate@*/
if (compar && nitems > 1)
root = fts_sort(sp, root, nitems);
+ /*@=branchstate@*/
/*
* Allocate a dummy pointer and make fts_read think that we've just
@@ -210,10 +243,7 @@ mem1: free(sp);
}
static void
-internal_function
-fts_load(sp, p)
- FTS *sp;
- register FTSENT *p;
+fts_load(FTS * sp, FTSENT * p)
{
register int len;
register char *cp;
@@ -237,8 +267,7 @@ fts_load(sp, p)
}
int
-Fts_close(sp)
- FTS *sp;
+Fts_close(FTS * sp)
{
register FTSENT *freep, *p;
int saved_errno;
@@ -248,6 +277,7 @@ Fts_close(sp)
* points to the root list, so we step through to the end of the root
* list which has a valid parent pointer.
*/
+ /*@-branchstate@*/
if (sp->fts_cur) {
for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
freep = p;
@@ -256,6 +286,7 @@ Fts_close(sp)
}
free(p);
}
+ /*@=branchstate@*/
/* Free up child linked list, sort array, path buffer. */
if (sp->fts_child)
@@ -292,10 +323,10 @@ Fts_close(sp)
? p->fts_pathlen - 1 : p->fts_pathlen)
FTSENT *
-Fts_read(sp)
- register FTS *sp;
+Fts_read(FTS * sp)
{
- register FTSENT *p, *tmp;
+ register FTSENT *p;
+ register FTSENT *tmp;
register int instr;
register char *t;
int saved_errno;
@@ -414,6 +445,7 @@ next: tmp = p;
*/
if (p->fts_instr == FTS_SKIP)
goto next;
+ /*@-branchstate@*/
if (p->fts_instr == FTS_FOLLOW) {
p->fts_info = fts_stat(sp, p, 1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
@@ -426,6 +458,7 @@ next: tmp = p;
}
p->fts_instr = FTS_NOINSTR;
}
+ /*@=branchstate@*/
name: t = sp->fts_path + NAPPEND(p->fts_parent);
*t++ = '/';
@@ -484,12 +517,8 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
* semantics to fts using fts_set. An error return is allowed for similar
* reasons.
*/
-/* ARGSUSED */
int
-Fts_set(sp, p, instr)
- FTS *sp;
- FTSENT *p;
- int instr;
+Fts_set(/*@unused@*/ FTS * sp, FTSENT * p, int instr)
{
if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
instr != FTS_NOINSTR && instr != FTS_SKIP) {
@@ -501,9 +530,7 @@ Fts_set(sp, p, instr)
}
FTSENT *
-Fts_children(sp, instr)
- register FTS *sp;
- int instr;
+Fts_children(FTS * sp, int instr)
{
register FTSENT *p;
int fd;
@@ -583,10 +610,7 @@ Fts_children(sp, instr)
* been found, cutting the stat calls by about 2/3.
*/
static FTSENT *
-internal_function
-fts_build(sp, type)
- register FTS *sp;
- int type;
+fts_build(FTS * sp, int type)
{
register struct dirent *dp;
register FTSENT *p, *head;
@@ -611,7 +635,7 @@ fts_build(sp, type)
else
oflag = DTF_HIDEW|DTF_NODUP|DTF_REWIND;
#else
-# define __opendir2(path, flag) __opendir(path)
+# define __opendir2(path, flag) (*sp->fts_opendir) (path)
#endif
if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) {
if (type == BREAD) {
@@ -666,7 +690,7 @@ fts_build(sp, type)
cur->fts_flags |= FTS_DONTCHDIR;
descend = 0;
cderrno = errno;
- (void)__closedir(dirp);
+ (void) (*sp->fts_closedir) (dirp);
dirp = NULL;
} else
descend = 1;
@@ -698,7 +722,9 @@ fts_build(sp, type)
/* Read the directory, attaching each entry to the `link' pointer. */
doadjust = 0;
- for (head = tail = NULL, nitems = 0; dirp && (dp = __readdir(dirp));) {
+ for (head = tail = NULL, nitems = 0;
+ dirp && (dp = (*sp->fts_readdir) (dirp));)
+ {
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
@@ -716,7 +742,7 @@ mem1: saved_errno = errno;
if (p)
free(p);
fts_lfree(head);
- (void)__closedir(dirp);
+ (void) (*sp->fts_closedir) (dirp);
cur->fts_info = FTS_ERR;
SET(FTS_STOP);
__set_errno (saved_errno);
@@ -740,7 +766,7 @@ mem1: saved_errno = errno;
*/
free(p);
fts_lfree(head);
- (void)__closedir(dirp);
+ (void) (*sp->fts_closedir) (dirp);
cur->fts_info = FTS_ERR;
SET(FTS_STOP);
__set_errno (ENAMETOOLONG);
@@ -798,7 +824,7 @@ mem1: saved_errno = errno;
++nitems;
}
if (dirp)
- (void)__closedir(dirp);
+ (void) (*sp->fts_closedir) (dirp);
/*
* If realloc() changed the address of the path, adjust the
@@ -847,11 +873,7 @@ mem1: saved_errno = errno;
}
static u_short
-internal_function
-fts_stat(sp, p, follow)
- FTS *sp;
- register FTSENT *p;
- int follow;
+fts_stat(FTS * sp, FTSENT * p, int follow)
{
register FTSENT *t;
register dev_t dev;
@@ -879,18 +901,18 @@ fts_stat(sp, p, follow)
* fail, set the errno from the stat call.
*/
if (ISSET(FTS_LOGICAL) || follow) {
- if (stat(p->fts_accpath, sbp)) {
+ if ((*sp->fts_stat) (p->fts_accpath, sbp)) {
saved_errno = errno;
- if (!lstat(p->fts_accpath, sbp)) {
+ if (!(*sp->fts_lstat) (p->fts_accpath, sbp)) {
__set_errno (0);
return (FTS_SLNONE);
}
p->fts_errno = saved_errno;
goto err;
}
- } else if (lstat(p->fts_accpath, sbp)) {
+ } else if ((*sp->fts_lstat) (p->fts_accpath, sbp)) {
p->fts_errno = errno;
-err: memset(sbp, 0, sizeof(struct stat));
+err: memset(sbp, 0, sizeof(*sbp));
return (FTS_NS);
}
@@ -931,11 +953,7 @@ err: memset(sbp, 0, sizeof(struct stat));
}
static FTSENT *
-internal_function
-fts_sort(sp, head, nitems)
- FTS *sp;
- FTSENT *head;
- register int nitems;
+fts_sort(FTS * sp, FTSENT * head, int nitems)
{
register FTSENT **ap, *p;
@@ -951,7 +969,8 @@ fts_sort(sp, head, nitems)
sp->fts_nitems = nitems + 40;
if ((a = realloc(sp->fts_array,
- (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
+ (size_t)(sp->fts_nitems * sizeof(*sp->fts_array)))) == NULL)
+ {
free(sp->fts_array);
sp->fts_array = NULL;
sp->fts_nitems = 0;
@@ -961,7 +980,8 @@ fts_sort(sp, head, nitems)
}
for (ap = sp->fts_array, p = head; p; p = p->fts_link)
*ap++ = p;
- qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
+ qsort((void *)sp->fts_array, nitems, sizeof(*sp->fts_array),
+ sp->fts_compar);
for (head = *(ap = sp->fts_array); --nitems; ++ap)
ap[0]->fts_link = ap[1];
ap[0]->fts_link = NULL;
@@ -969,11 +989,7 @@ fts_sort(sp, head, nitems)
}
static FTSENT *
-internal_function
-fts_alloc(sp, name, namelen)
- FTS *sp;
- const char *name;
- register int namelen;
+fts_alloc(FTS * sp, const char * name, int namelen)
{
register FTSENT *p;
size_t len;
@@ -986,9 +1002,9 @@ fts_alloc(sp, name, namelen)
* fts_name field is declared to be of size 1, the fts_name pointer is
* namelen + 2 before the first possible address of the stat structure.
*/
- len = sizeof(FTSENT) + namelen;
+ len = sizeof(*p) + namelen;
if (!ISSET(FTS_NOSTAT))
- len += sizeof(struct stat) + ALIGNBYTES;
+ len += sizeof(*p->fts_statp) + ALIGNBYTES;
if ((p = malloc(len)) == NULL)
return (NULL);
@@ -1009,17 +1025,17 @@ fts_alloc(sp, name, namelen)
}
static void
-internal_function
-fts_lfree(head)
- register FTSENT *head;
+fts_lfree(FTSENT * head)
{
register FTSENT *p;
/* Free a linked list of structures. */
+ /*@-branchstate@*/
while ((p = head)) {
head = head->fts_link;
free(p);
}
+ /*@=branchstate@*/
}
/*
@@ -1029,10 +1045,7 @@ fts_lfree(head)
* plus 256 bytes so don't realloc the path 2 bytes at a time.
*/
static int
-internal_function
-fts_palloc(sp, more)
- FTS *sp;
- size_t more;
+fts_palloc(FTS * sp, size_t more)
{
char *p;
@@ -1066,10 +1079,7 @@ fts_palloc(sp, more)
* already returned.
*/
static void
-internal_function
-fts_padjust(sp, head)
- FTS *sp;
- FTSENT *head;
+fts_padjust(FTS * sp, FTSENT * head)
{
FTSENT *p;
char *addr = sp->fts_path;
@@ -1093,9 +1103,7 @@ fts_padjust(sp, head)
}
static size_t
-internal_function
-fts_maxarglen(argv)
- char * const *argv;
+fts_maxarglen(char * const * argv)
{
size_t len, max;
@@ -1111,12 +1119,7 @@ fts_maxarglen(argv)
* Assumes p->fts_dev and p->fts_ino are filled in.
*/
static int
-internal_function
-fts_safe_changedir(sp, p, fd, path)
- FTS *sp;
- FTSENT *p;
- int fd;
- const char *path;
+fts_safe_changedir(FTS * sp, FTSENT * p, int fd, const char * path)
{
int ret, oerrno, newfd;
struct stat64 sb;
@@ -1143,3 +1146,5 @@ bail:
__set_errno (oerrno);
return (ret);
}
+/*@=compdef =compmempass =dependenttrans =retalias @*/
+/*@=sysunrecog =noeffectuncon =nullpass =sizeoftype =unrecog =usereleased @*/
diff --git a/rpmio/fts.h b/rpmio/fts.h
index aca829cc5..ff97f5443 100644
--- a/rpmio/fts.h
+++ b/rpmio/fts.h
@@ -34,6 +34,8 @@
#include <features.h>
#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
/* The fts interface is incompatible with the LFS interface which
transparently uses the 64-bit file access functions. */
@@ -43,89 +45,127 @@
typedef struct {
- struct _ftsent *fts_cur; /* current node */
- struct _ftsent *fts_child; /* linked list of children */
- struct _ftsent **fts_array; /* sort array */
- dev_t fts_dev; /* starting device # */
- char *fts_path; /* path for this descent */
- int fts_rfd; /* fd for root */
- int fts_pathlen; /* sizeof(path) */
- int fts_nitems; /* elements in the sort array */
- int (*fts_compar) (const void *, const void *); /* compare fn */
-
-#define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */
-#define FTS_LOGICAL 0x0002 /* logical walk */
-#define FTS_NOCHDIR 0x0004 /* don't change directories */
-#define FTS_NOSTAT 0x0008 /* don't get stat info */
-#define FTS_PHYSICAL 0x0010 /* physical walk */
-#define FTS_SEEDOT 0x0020 /* return dot and dot-dot */
-#define FTS_XDEV 0x0040 /* don't cross devices */
-#define FTS_WHITEOUT 0x0080 /* return whiteout information */
-#define FTS_OPTIONMASK 0x00ff /* valid user option mask */
-
-#define FTS_NAMEONLY 0x0100 /* (private) child names only */
-#define FTS_STOP 0x0200 /* (private) unrecoverable error */
- int fts_options; /* fts_open options, global flags */
+/*@owned@*/
+ struct _ftsent *fts_cur; /*!< current node */
+/*@owned@*/ /*@null@*/
+ struct _ftsent *fts_child; /*!< linked list of children */
+/*@owned@*/ /*@null@*/
+ struct _ftsent **fts_array; /*!< sort array */
+ dev_t fts_dev; /*!< starting device # */
+/*@owned@*/
+ char *fts_path; /*!< path for this descent */
+ int fts_rfd; /*!< fd for root */
+ int fts_pathlen; /*!< sizeof(path) */
+ int fts_nitems; /*!< elements in the sort array */
+ int (*fts_compar) (const void *, const void *)
+ /*@*/; /*!< compare fn */
+
+ DIR * (*fts_opendir) (const char * path)
+ /*@globals fileSystem @*/
+ /*@modifies fileSystem @*/;
+ struct dirent * (*fts_readdir) (DIR * dir)
+ /*@globals fileSystem @*/
+ /*@modifies *dir, fileSystem @*/;
+ int (*fts_closedir) (/*@only@*/ DIR * dir)
+ /*@globals fileSystem @*/
+ /*@modifies *dir, fileSystem @*/;
+ int (*fts_stat) (const char * path, /*@out@*/ struct stat * st)
+ /*@globals fileSystem @*/
+ /*@modifies *st, fileSystem @*/;
+ int (*fts_lstat) (const char * path, /*@out@*/ struct stat * st)
+ /*@globals fileSystem @*/
+ /*@modifies *st, fileSystem @*/;
+
+#define FTS_COMFOLLOW 0x0001 /*!< follow command line symlinks */
+#define FTS_LOGICAL 0x0002 /*!< logical walk */
+#define FTS_NOCHDIR 0x0004 /*!< don't change directories */
+#define FTS_NOSTAT 0x0008 /*!< don't get stat info */
+#define FTS_PHYSICAL 0x0010 /*!< physical walk */
+#define FTS_SEEDOT 0x0020 /*!< return dot and dot-dot */
+#define FTS_XDEV 0x0040 /*!< don't cross devices */
+#define FTS_WHITEOUT 0x0080 /*!< return whiteout information */
+#define FTS_OPTIONMASK 0x00ff /*!< valid user option mask */
+
+#define FTS_NAMEONLY 0x0100 /*!< (private) child names only */
+#define FTS_STOP 0x0200 /*!< (private) unrecoverable error */
+ int fts_options; /*!< fts_open options, global flags */
} FTS;
typedef struct _ftsent {
- struct _ftsent *fts_cycle; /* cycle node */
- struct _ftsent *fts_parent; /* parent directory */
- struct _ftsent *fts_link; /* next file in directory */
- long fts_number; /* local numeric value */
- void *fts_pointer; /* local address value */
- char *fts_accpath; /* access path */
- char *fts_path; /* root path */
- int fts_errno; /* errno for this node */
- int fts_symfd; /* fd for symlink */
- u_short fts_pathlen; /* strlen(fts_path) */
- u_short fts_namelen; /* strlen(fts_name) */
-
- ino_t fts_ino; /* inode */
- dev_t fts_dev; /* device */
- nlink_t fts_nlink; /* link count */
+/*@dependent@*/
+ struct _ftsent *fts_cycle; /*!< cycle node */
+/*@dependent@*/
+ struct _ftsent *fts_parent; /*!< parent directory */
+/*@dependent@*/
+ struct _ftsent *fts_link; /*!< next file in directory */
+ long fts_number; /*!< local numeric value */
+ void *fts_pointer; /*!< local address value */
+/*@dependent@*/
+ char *fts_accpath; /*!< access path */
+/*@dependent@*/
+ char *fts_path; /*!< root path */
+ int fts_errno; /*!< errno for this node */
+ int fts_symfd; /*!< fd for symlink */
+ u_short fts_pathlen; /*!< strlen(fts_path) */
+ u_short fts_namelen; /*!< strlen(fts_name) */
+
+ ino_t fts_ino; /*!< inode */
+ dev_t fts_dev; /*!< device */
+ nlink_t fts_nlink; /*!< link count */
#define FTS_ROOTPARENTLEVEL -1
#define FTS_ROOTLEVEL 0
- short fts_level; /* depth (-1 to N) */
-
-#define FTS_D 1 /* preorder directory */
-#define FTS_DC 2 /* directory that causes cycles */
-#define FTS_DEFAULT 3 /* none of the above */
-#define FTS_DNR 4 /* unreadable directory */
-#define FTS_DOT 5 /* dot or dot-dot */
-#define FTS_DP 6 /* postorder directory */
-#define FTS_ERR 7 /* error; errno is set */
-#define FTS_F 8 /* regular file */
-#define FTS_INIT 9 /* initialized only */
-#define FTS_NS 10 /* stat(2) failed */
-#define FTS_NSOK 11 /* no stat(2) requested */
-#define FTS_SL 12 /* symbolic link */
-#define FTS_SLNONE 13 /* symbolic link without target */
-#define FTS_W 14 /* whiteout object */
- u_short fts_info; /* user flags for FTSENT structure */
-
-#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
-#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
- u_short fts_flags; /* private flags for FTSENT structure */
-
-#define FTS_AGAIN 1 /* read node again */
-#define FTS_FOLLOW 2 /* follow symbolic link */
-#define FTS_NOINSTR 3 /* no instructions */
-#define FTS_SKIP 4 /* discard node */
- u_short fts_instr; /* fts_set() instructions */
-
- struct stat *fts_statp; /* stat(2) information */
- char fts_name[1]; /* file name */
+ short fts_level; /*!< depth (-1 to N) */
+
+#define FTS_D 1 /*!< preorder directory */
+#define FTS_DC 2 /*!< directory that causes cycles */
+#define FTS_DEFAULT 3 /*!< none of the above */
+#define FTS_DNR 4 /*!< unreadable directory */
+#define FTS_DOT 5 /*!< dot or dot-dot */
+#define FTS_DP 6 /*!< postorder directory */
+#define FTS_ERR 7 /*!< error; errno is set */
+#define FTS_F 8 /*!< regular file */
+#define FTS_INIT 9 /*!< initialized only */
+#define FTS_NS 10 /*!< stat(2) failed */
+#define FTS_NSOK 11 /*!< no stat(2) requested */
+#define FTS_SL 12 /*!< symbolic link */
+#define FTS_SLNONE 13 /*!< symbolic link without target */
+#define FTS_W 14 /*!< whiteout object */
+ u_short fts_info; /*!< user flags for FTSENT structure */
+
+#define FTS_DONTCHDIR 0x01 /*!< don't chdir .. to the parent */
+#define FTS_SYMFOLLOW 0x02 /*!< followed a symlink to get here */
+ u_short fts_flags; /*!< private flags for FTSENT structure */
+
+#define FTS_AGAIN 1 /*!< read node again */
+#define FTS_FOLLOW 2 /*!< follow symbolic link */
+#define FTS_NOINSTR 3 /*!< no instructions */
+#define FTS_SKIP 4 /*!< discard node */
+ u_short fts_instr; /*!< fts_set() instructions */
+
+/*@dependent@*/
+ struct stat *fts_statp; /*!< stat(2) information */
+ char fts_name[1]; /*!< file name */
} FTSENT;
__BEGIN_DECLS
-FTSENT *Fts_children (FTS *, int) __THROW;
-int Fts_close (FTS *) __THROW;
-FTS *Fts_open (char * const *, int,
- int (*)(const FTSENT **, const FTSENT **)) __THROW;
-FTSENT *Fts_read (FTS *) __THROW;
-int Fts_set (FTS *, FTSENT *, int) __THROW;
+/*@dependent@*/
+FTSENT *Fts_children (FTS * sp, int instr) __THROW
+ /*@globals fileSystem, internalState @*/
+ /*@modifies *sp, fileSystem, internalState @*/;
+int Fts_close (/*@only@*/ FTS * sp) __THROW
+ /*@globals fileSystem, internalState @*/
+ /*@modifies *sp, fileSystem, internalState @*/;
+/*@only@*/
+FTS *Fts_open (char * const * argv, int options,
+ int (*compar) (const FTSENT **, const FTSENT **)) __THROW
+ /*@*/;
+/*@null@*/
+FTSENT *Fts_read (FTS * sp) __THROW
+ /*@globals fileSystem, internalState @*/
+ /*@modifies *sp, fileSystem, internalState @*/;
+int Fts_set (FTS * sp, FTSENT * p, int instr) __THROW
+ /*@modifies *p @*/;
__END_DECLS
#endif /* fts.h */