Blame

e4528f Bob Green 2026-08-26 12:19:20
1
% dirfd(3) Version 1.0 | Library Functions Manual
2
***
3
4
## NAME
5
6
**dirfd** — get directory stream file descriptor
7
8
### LIBRARY
9
10
libmega C library (-lmega)
11
12
### SYNOPSIS
13
14
```
15
#include <dirent.h>
16
17
int dirfd(DIR *dirp);
18
```
19
20
### DESCRIPTION
21
The function **dirfd()** returns the file descriptor associated with the directory stream **_dirp_**.
22
23
Not really sure why you'd want this as messing with the fd directly will cause all sorts of bad thimgs to happen, but the function is in the standard librarry, so here it is. You have been warned.
24
25
### RETURN VALUE
26
Never succeeds as this implementation doesn't work that way, so -1 is always returned, and **_errno_** is set to indicate the error.
27
28
### ERRORS
29
**==NAME==()** can fail with the following errors:
30
31
* ENOTSUP - this implementation does not associate a file descriptor with the directory stream.
32
33
### NOTES
34
35
None.
36
37
### BUGS
38
39
See GitHub Issues: <https://github.com/znac049/mega-micros-sbc3/issues>
40
41
### AUTHOR
42
43
Bob Green <bob@chippers.org.uk>
44
45
### SEE ALSO
46
**open(2)**, **closedir(3)**, **opendir(3)**, **readdir(3)**, **rewinddir(3)**, **seekdir(3)**, **telldir(3)**