2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2018-10-24 13:43:52 +03:00
|
|
|
#pragma once
|
|
|
|
|
2021-08-14 19:52:14 +03:00
|
|
|
#include <Kernel/API/POSIX/dirent.h>
|
2022-08-15 18:57:43 +03:00
|
|
|
#include <sys/cdefs.h>
|
2018-10-24 13:43:52 +03:00
|
|
|
|
2018-10-31 04:09:11 +03:00
|
|
|
__BEGIN_DECLS
|
2018-10-24 13:43:52 +03: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 20:16:00 +03:00
|
|
|
struct __DIR {
|
2018-10-24 13:43:52 +03:00
|
|
|
int fd;
|
2018-11-05 20:16:00 +03:00
|
|
|
struct dirent cur_ent;
|
2018-10-24 13:43:52 +03:00
|
|
|
char* buffer;
|
|
|
|
size_t buffer_size;
|
|
|
|
char* nextptr;
|
|
|
|
};
|
2018-11-05 20:16:00 +03:00
|
|
|
typedef struct __DIR DIR;
|
2018-10-24 13:43:52 +03:00
|
|
|
|
2021-08-11 20:10:05 +03:00
|
|
|
DIR* fdopendir(int fd);
|
2022-04-01 20:58:27 +03:00
|
|
|
DIR* opendir(char const* name);
|
2018-11-05 21:01:22 +03:00
|
|
|
int closedir(DIR*);
|
2021-04-25 10:41:45 +03:00
|
|
|
void rewinddir(DIR*);
|
2018-11-05 21:01:22 +03:00
|
|
|
struct dirent* readdir(DIR*);
|
2019-10-12 23:35:23 +03:00
|
|
|
int readdir_r(DIR*, struct dirent*, struct dirent**);
|
2019-06-03 19:42:40 +03:00
|
|
|
int dirfd(DIR*);
|
2018-10-24 13:43:52 +03:00
|
|
|
|
2021-12-28 06:26:37 +03: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 12:36:59 +03:00
|
|
|
int (*filter)(const struct dirent*),
|
|
|
|
int (*compar)(const struct dirent**, const struct dirent**));
|
|
|
|
|
2018-10-31 04:09:11 +03:00
|
|
|
__END_DECLS
|