2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2018-10-24 12:43:52 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2021-08-14 18:52:14 +02:00
|
|
|
#include <Kernel/API/POSIX/dirent.h>
|
2022-08-16 01:57:43 +10:00
|
|
|
#include <sys/cdefs.h>
|
2018-10-24 12:43:52 +02:00
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
__BEGIN_DECLS
|
2018-10-24 12:43:52 +02:00
|
|
|
|
|
|
|
|
struct dirent {
|
|
|
|
|
ino_t d_ino;
|
|
|
|
|
off_t d_off;
|
|
|
|
|
unsigned short d_reclen;
|
|
|
|
|
unsigned char d_type;
|
|
|
|
|
char d_name[256];
|
|
|
|
|
};
|
|
|
|
|
|
2018-11-05 18:16:00 +01:00
|
|
|
struct __DIR {
|
2018-10-24 12:43:52 +02:00
|
|
|
int fd;
|
2018-11-05 18:16:00 +01:00
|
|
|
struct dirent cur_ent;
|
2018-10-24 12:43:52 +02:00
|
|
|
char* buffer;
|
|
|
|
|
size_t buffer_size;
|
|
|
|
|
char* nextptr;
|
|
|
|
|
};
|
2018-11-05 18:16:00 +01:00
|
|
|
typedef struct __DIR DIR;
|
2018-10-24 12:43:52 +02:00
|
|
|
|
2021-08-11 19:10:05 +02:00
|
|
|
DIR* fdopendir(int fd);
|
2022-04-01 20:58:27 +03:00
|
|
|
DIR* opendir(char const* name);
|
2018-11-05 19:01:22 +01:00
|
|
|
int closedir(DIR*);
|
2021-04-25 09:41:45 +02:00
|
|
|
void rewinddir(DIR*);
|
2018-11-05 19:01:22 +01:00
|
|
|
struct dirent* readdir(DIR*);
|
2019-10-12 17:35:23 -03:00
|
|
|
int readdir_r(DIR*, struct dirent*, struct dirent**);
|
2019-06-03 18:42:40 +02:00
|
|
|
int dirfd(DIR*);
|
2018-10-24 12:43:52 +02:00
|
|
|
|
2021-12-27 19:26:37 -08:00
|
|
|
int alphasort(const struct dirent** d1, const struct dirent** d2);
|
2022-04-01 20:58:27 +03:00
|
|
|
int scandir(char const* dirp, struct dirent*** namelist,
|
2021-05-02 02:36:59 -07:00
|
|
|
int (*filter)(const struct dirent*),
|
|
|
|
|
int (*compar)(const struct dirent**, const struct dirent**));
|
|
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
__END_DECLS
|