2 /* : : generated by proto : : */
3 /***********************************************************************
5 * This software is part of the ast package *
6 * Copyright (c) 1985-2010 AT&T Intellectual Property *
7 * and is licensed under the *
8 * Common Public License, Version 1.0 *
9 * by AT&T Intellectual Property *
11 * A copy of the License is available at *
12 * http://www.opensource.org/licenses/cpl1.0.txt *
13 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
15 * Information and Software Systems Research *
19 * Glenn Fowler <gsf@research.att.com> *
20 * David Korn <dgk@research.att.com> *
21 * Phong Vo <kpv@research.att.com> *
23 ***********************************************************************/
29 * common dirent maintenance interface
33 #if !defined(__PROTO__)
34 #include <prototyped.h>
36 #if !defined(__LINKAGE__)
37 #define __LINKAGE__ /* 2004-08-11 transition */
44 #if _mem_d_fileno_dirent || _mem_d_ino_dirent
45 #if !_mem_d_fileno_dirent
46 #undef _mem_d_fileno_dirent
47 #define _mem_d_fileno_dirent 1
48 #define d_fileno d_ino
58 #if _mem_d_fileno_dirent
59 #define D_FILENO(d) ((d)->d_fileno)
62 #if _mem_d_namlen_dirent
63 #define D_NAMLEN(d) ((d)->d_namlen)
65 #define D_NAMLEN(d) (strlen((d)->d_name))
68 #if _mem_d_reclen_dirent
69 #define D_RECLEN(d) ((d)->d_reclen)
71 #define D_RECLEN(d) D_RECSIZ(d,D_NAMLEN(d))
74 #define D_RECSIZ(d,n) (sizeof(*(d))-sizeof((d)->d_name)+((n)+sizeof(char*))&~(sizeof(char*)-1))
77 * NOTE: 2003-03-27 mac osx bug symlink==DT_REG bug discovered;
78 * the kernel *and* all directories must be fixed, so d_type
79 * is summarily disabled until we see that happen
82 #if _mem_d_type_dirent && defined(DT_UNKNOWN) && defined(DT_REG) && defined(DT_DIR) && defined(DT_LNK) && ! ( __APPLE__ || __MACH__ )
83 #define D_TYPE(d) ((d)->d_type)