-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add musl and glibc bindings for getdents{,64} #4522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
423017b
5bd1a65
e0d0894
cc648b3
87ca6bc
ee6b7ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1348,6 +1348,7 @@ freezero | |
| fsid_t | ||
| fstatfs | ||
| futimes | ||
| getdents | ||
| getdomainname | ||
| getdtablesize | ||
| getentropy | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1984,6 +1984,7 @@ fsid_t | |
| fstatfs | ||
| ftok | ||
| futimes | ||
| getdents | ||
| getdomainname | ||
| getdtablesize | ||
| getgrent | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| getdents64 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -604,6 +604,7 @@ fgetpwent_r | |
| fgetspent_r | ||
| futimes | ||
| getauxval | ||
| getdents64 | ||
| getentropy | ||
| getgrent_r | ||
| getloadavg | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,8 @@ euidaccess | |
| explicit_bzero | ||
| futimes | ||
| getauxval | ||
| getdents | ||
| getdents64 | ||
| getloadavg | ||
| getutxent | ||
| getutxid | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1340,6 +1340,7 @@ ftok | |
| futimes | ||
| getbootfile | ||
| getbyteorder | ||
| getdents | ||
| getdiskrawname | ||
| getdistcookedname | ||
| getdomainname | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1113,6 +1113,7 @@ ftok | |
| fusefs_args | ||
| futex | ||
| futimes | ||
| getdents | ||
| getdomainname | ||
| getdtablesize | ||
| getentropy | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4818,6 +4818,10 @@ cfg_if! { | |
| } | ||
| } | ||
|
|
||
| extern "C" { | ||
| pub fn getdents(fd: c_int, buf: *mut c_char, nbytes: usize) -> isize; | ||
| } | ||
|
Comment on lines
+4821
to
+4823
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this move into an existing |
||
|
|
||
| extern "C" { | ||
| #[cfg_attr(doc, doc(alias = "__errno_location"))] | ||
| #[cfg_attr(doc, doc(alias = "errno"))] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2957,6 +2957,8 @@ extern "C" { | |
| pub fn flags_to_string(flags: c_ulong, def: *const c_char) -> c_int; | ||
|
|
||
| pub fn kinfo_getvmmap(pid: crate::pid_t, cntp: *mut size_t) -> *mut kinfo_vmentry; | ||
|
|
||
| pub fn getdents(fd: c_int, buf: *mut c_char, nbytes: usize) -> c_int; | ||
|
Comment on lines
+2960
to
+2961
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one needs a |
||
| } | ||
|
|
||
| #[link(name = "execinfo")] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1346,6 +1346,13 @@ extern "C" { | |
| pub fn mempcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; | ||
| } | ||
|
|
||
| extern "C" { | ||
| // There is no glibc wrapper for the getdents system call, and getdents64() is only available | ||
| // from 2.30 onwards. | ||
| /// `buffer` points to a buffer of [`crate::dirent64`] structs. | ||
| pub fn getdents64(fd: c_int, buffer: *mut c_void, nbytes: usize) -> isize; | ||
| } | ||
|
Comment on lines
+1349
to
+1354
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you merge this with the Also no doc comments please, for this crate we defer to the platform manpages. |
||
|
|
||
| cfg_if! { | ||
| if #[cfg(any( | ||
| target_arch = "x86", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -971,6 +971,10 @@ extern "C" { | |
| pub fn utmpxname(file: *const c_char) -> c_int; | ||
| } | ||
|
|
||
| extern "C" { | ||
| pub fn getdents(fd: c_int, buf: *mut crate::dirent, len: usize) -> c_int; | ||
| } | ||
|
Comment on lines
+974
to
+976
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you combine this with the |
||
|
|
||
| // Alias <foo> to <foo>64 to mimic glibc's LFS64 support | ||
| mod lfs64; | ||
| pub use self::lfs64::*; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the file doesn't exist yet and Hurd is T3, it's not being checked. So this can just be dropped