4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
21 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
22 /* All Rights Reserved */
26 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
35 #include <sys/feature_tests.h>
42 * File-system independent directory entry.
44 typedef struct dirent
{
45 ino_t d_ino
; /* "inode number" of entry */
46 off_t d_off
; /* offset of disk directory entry */
47 unsigned short d_reclen
; /* length of this record */
48 char d_name
[1]; /* name of file */
51 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
53 #define DIRENT_RECLEN(namelen) \
54 ((offsetof(dirent_t, d_name[0]) + 1 + (namelen) + 7) & ~ 7)
55 #define DIRENT_NAMELEN(reclen) \
56 ((reclen) - (offsetof(dirent_t, d_name[0])))
60 * This is the maximum number of bytes that getdents(2) will store in
61 * user-supplied dirent buffers.
63 #define MAXGETDENTS_SIZE (64 * 1024)
67 extern int getdents(int, struct dirent
*, size_t);
69 #endif /* !defined(_KERNEL) */
70 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
76 #endif /* _SYS_DIRENT_H */