2024-04-15 08:47:58 -07:00
|
|
|
/* $OpenBSD: dirent.h,v 1.35 2024/04/15 15:47:58 florian Exp $ */
|
1995-10-18 01:37:01 -07:00
|
|
|
/* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */
|
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1989, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-06-02 12:34:12 -07:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1995-10-18 01:37:01 -07:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)dirent.h 8.2 (Berkeley) 7/28/94
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DIRENT_H_
|
|
|
|
#define _DIRENT_H_
|
|
|
|
|
2005-12-12 16:35:22 -08:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
1995-11-23 09:12:11 -08:00
|
|
|
/*
|
|
|
|
* POSIX doesn't mandate this, but X/Open XPG 4.2 does.
|
|
|
|
*/
|
2013-06-02 09:14:59 -07:00
|
|
|
#if __BSD_VISIBLE || __XPG_VISIBLE >= 400
|
1995-11-23 09:12:11 -08:00
|
|
|
#include <sys/types.h>
|
2013-06-02 09:14:59 -07:00
|
|
|
#else
|
|
|
|
#include <sys/_types.h>
|
1995-11-23 09:12:11 -08:00
|
|
|
#endif
|
|
|
|
|
1995-10-18 01:37:01 -07:00
|
|
|
/*
|
|
|
|
* The kernel defines the format of directory entries returned by
|
2013-08-16 01:33:20 -07:00
|
|
|
* the getdents(2) system call.
|
1995-10-18 01:37:01 -07:00
|
|
|
*/
|
|
|
|
#include <sys/dirent.h>
|
|
|
|
|
2005-12-12 16:35:22 -08:00
|
|
|
#if __BSD_VISIBLE || __XPG_VISIBLE
|
1995-10-18 01:37:01 -07:00
|
|
|
#define d_ino d_fileno /* backward compatibility */
|
2005-12-12 16:35:22 -08:00
|
|
|
#endif
|
|
|
|
|
2012-03-21 21:11:53 -07:00
|
|
|
typedef struct _dirdesc DIR;
|
2010-12-31 11:54:05 -08:00
|
|
|
|
2005-12-12 16:35:22 -08:00
|
|
|
#if __BSD_VISIBLE
|
1995-10-18 01:37:01 -07:00
|
|
|
|
|
|
|
/* definitions for library routines operating on directories. */
|
|
|
|
#define DIRBLKSIZ 1024
|
|
|
|
|
2016-09-09 11:12:37 -07:00
|
|
|
#include <sys/_null.h>
|
1995-10-18 01:37:01 -07:00
|
|
|
|
2012-03-21 21:11:53 -07:00
|
|
|
#endif /* __BSD_VISIBLE */
|
1995-10-18 01:37:01 -07:00
|
|
|
|
|
|
|
__BEGIN_DECLS
|
2002-02-16 13:27:05 -08:00
|
|
|
DIR *opendir(const char *);
|
Expose a bunch of new functionality from POSIX 2008: openat(2),
fchmodat(2), fstatat(2), mkdirat(2), mkfifoat(2), mknodat(2),
faccessat(2), fchownat(2), linkat(2), readlinkat(2), renameat(2),
symlinkat(2), unlinkat(2), utimensat(2), futimens(2), and
fdopendir(3).
"Minor" libc bump.
Tested in a bulk build by naddy@
Much help from guenther@, thib@, tedu@, oga@, and others.
ok deraadt@, naddy@
2011-07-18 10:29:49 -07:00
|
|
|
#if __POSIX_VISIBLE >= 200809
|
|
|
|
DIR *fdopendir(int);
|
|
|
|
#endif
|
2002-02-16 13:27:05 -08:00
|
|
|
struct dirent *readdir(DIR *);
|
|
|
|
void rewinddir(DIR *);
|
|
|
|
int closedir(DIR *);
|
2005-12-12 16:35:22 -08:00
|
|
|
#if __BSD_VISIBLE
|
2013-08-16 01:33:20 -07:00
|
|
|
int getdents(int, void *, size_t)
|
|
|
|
__attribute__ ((__bounded__(__string__,2,3)));
|
2005-12-12 16:35:22 -08:00
|
|
|
#endif /* __BSD_VISIBLE */
|
|
|
|
#if __XPG_VISIBLE
|
2006-04-01 10:06:59 -08:00
|
|
|
long telldir(DIR *);
|
2005-12-12 16:35:22 -08:00
|
|
|
void seekdir(DIR *, long);
|
|
|
|
#endif
|
|
|
|
#if __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE >= 500
|
2012-03-21 18:44:19 -07:00
|
|
|
int readdir_r(DIR *__restrict, struct dirent *__restrict,
|
|
|
|
struct dirent **__restrict);
|
2005-12-12 16:35:22 -08:00
|
|
|
#endif
|
2012-03-21 18:44:19 -07:00
|
|
|
#if __POSIX_VISIBLE >= 200809
|
2012-11-28 18:15:44 -08:00
|
|
|
int scandir(const char *, struct dirent ***, int (*)(const struct dirent *),
|
2012-03-21 18:44:19 -07:00
|
|
|
int (*)(const struct dirent **, const struct dirent **));
|
2024-04-15 08:47:58 -07:00
|
|
|
int scandirat(int, const char *, struct dirent ***,
|
|
|
|
int (*)(const struct dirent *),
|
|
|
|
int (*)(const struct dirent **, const struct dirent **));
|
2012-03-21 18:44:19 -07:00
|
|
|
int alphasort(const struct dirent **, const struct dirent **);
|
2012-03-23 18:53:51 -07:00
|
|
|
#elif __BSD_VISIBLE
|
|
|
|
int scandir(const char *, struct dirent ***, int (*)(struct dirent *),
|
|
|
|
int (*)(const void *, const void *));
|
|
|
|
int alphasort(const void *, const void *);
|
2010-12-31 11:54:05 -08:00
|
|
|
#endif
|
2012-03-21 18:13:40 -07:00
|
|
|
#if __POSIX_VISIBLE >= 200809 || __XPG_VISIBLE > 600
|
2012-03-21 21:11:53 -07:00
|
|
|
int dirfd(DIR *);
|
2012-03-21 18:13:40 -07:00
|
|
|
#endif
|
1995-10-18 01:37:01 -07:00
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* !_DIRENT_H_ */
|