Skip to content

Commit 925eb0c

Browse files
Xing Xuetgross35
authored andcommitted
Add 'struct ld_info' and friends.
1 parent 38bb46e commit 925eb0c

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

libc-test/build.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5625,6 +5625,18 @@ fn test_aix(target: &str) {
56255625
// allow type 'double' to be used in signal contexts.
56265626
"fpreg_t" => true,
56275627

5628+
// This type is defined for a union used within `struct ld_info`.
5629+
// The AIX header does not declare a separate standalone union
5630+
// type for it.
5631+
"__ld_info_file" => true,
5632+
5633+
// This is a simplified version of the AIX union `_simple_lock`.
5634+
"_kernel_simple_lock" => true,
5635+
5636+
// These structures are guarded by the `_KERNEL` macro in the AIX
5637+
// header.
5638+
"fileops_t" | "file" => true,
5639+
56285640
_ => false,
56295641
}
56305642
});
@@ -5642,6 +5654,11 @@ fn test_aix(target: &str) {
56425654
// The _ALL_SOURCE type of 'f_fsid' differs from POSIX's on AIX.
56435655
("statvfs", "f_fsid") => true,
56445656

5657+
// The type of `_file` is `__ld_info_file`, which is defined
5658+
// specifically for the union inside `struct ld_info`. The AIX
5659+
// header does not define a separate standalone union type for it.
5660+
("ld_info", "_file") => true,
5661+
56455662
_ => false,
56465663
}
56475664
});

libc-test/semver/aix.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,12 +1791,14 @@ _W_STOPPED
17911791
_W_STRC
17921792
__context64
17931793
__extctx_t
1794+
__ld_info_file
17941795
__pollfd_ext_u
17951796
__tm_context_t
17961797
__vmx_context_t
17971798
__vmxreg_t
17981799
__vsx_context_t
17991800
_exit
1801+
_kernel_simple_lock
18001802
abort
18011803
accept
18021804
access
@@ -1915,7 +1917,9 @@ fgetpos
19151917
fgetpos64
19161918
fgetpwent
19171919
fgets
1920+
file
19181921
fileno
1922+
fileops_t
19191923
flock
19201924
flock64
19211925
fnmatch
@@ -2079,6 +2083,7 @@ kill
20792083
lchown
20802084
lcong48
20812085
lconv
2086+
ld_info
20822087
lfind
20832088
linger
20842089
link
@@ -2090,6 +2095,7 @@ locale_t
20902095
localeconv
20912096
localtime
20922097
localtime_r
2098+
lock_data_instrumented
20932099
lpar_get_info
20942100
lpar_set_resources
20952101
lrand48

src/unix/aix/powerpc64.rs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
use crate::off_t;
22
use crate::prelude::*;
33

4+
// Define lock_data_instrumented as an empty enum
5+
missing! {
6+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
7+
pub enum lock_data_instrumented {}
8+
}
9+
410
s! {
511
pub struct sigset_t {
612
pub ss_set: [c_ulong; 4],
@@ -256,6 +262,74 @@ s_no_extra_traits! {
256262
pub __pad: [c_int; 3],
257263
}
258264

265+
pub union _kernel_simple_lock {
266+
pub _slock: c_long,
267+
pub _slockp: *mut lock_data_instrumented,
268+
}
269+
270+
pub struct fileops_t {
271+
pub fo_rw: Option<
272+
extern "C" fn(
273+
file: *mut file,
274+
rw: crate::uio_rw,
275+
io: *mut c_void,
276+
ext: c_long,
277+
secattr: *mut c_void,
278+
) -> c_int,
279+
>,
280+
pub fo_ioctl: Option<
281+
extern "C" fn(
282+
file: *mut file,
283+
a: c_long,
284+
b: crate::caddr_t,
285+
c: c_long,
286+
d: c_long,
287+
) -> c_int,
288+
>,
289+
pub fo_select: Option<
290+
extern "C" fn(file: *mut file, a: c_int, b: *mut c_ushort, c: extern "C" fn()) -> c_int,
291+
>,
292+
pub fo_close: Option<extern "C" fn(file: *mut file) -> c_int>,
293+
pub fo_fstat: Option<extern "C" fn(file: *mut file, sstat: *mut crate::stat) -> c_int>,
294+
}
295+
296+
pub struct file {
297+
pub f_flag: c_long,
298+
pub f_count: c_int,
299+
pub f_options: c_short,
300+
pub f_type: c_short,
301+
// Should be pointer to 'vnode'
302+
pub f_data: *mut c_void,
303+
pub f_offset: c_longlong,
304+
pub f_dir_off: c_long,
305+
// Should be pointer to 'cred'
306+
pub f_cred: *mut c_void,
307+
pub f_lock: _kernel_simple_lock,
308+
pub f_offset_lock: _kernel_simple_lock,
309+
pub f_vinfo: crate::caddr_t,
310+
pub f_ops: *mut fileops_t,
311+
pub f_parentp: crate::caddr_t,
312+
pub f_fnamep: crate::caddr_t,
313+
pub f_fdata: [c_char; 160],
314+
}
315+
316+
pub union __ld_info_file {
317+
pub _ldinfo_fd: c_int,
318+
pub _ldinfo_fp: *mut file,
319+
pub _core_offset: c_long,
320+
}
321+
322+
pub struct ld_info {
323+
pub ldinfo_next: c_uint,
324+
pub ldinfo_flags: c_uint,
325+
pub _file: __ld_info_file,
326+
pub ldinfo_textorg: *mut c_void,
327+
pub ldinfo_textsize: c_ulong,
328+
pub ldinfo_dataorg: *mut c_void,
329+
pub ldinfo_datasize: c_ulong,
330+
pub ldinfo_filename: [c_char; 2],
331+
}
332+
259333
pub union __pollfd_ext_u {
260334
pub addr: *mut c_void,
261335
pub data32: u32,
@@ -327,6 +401,7 @@ cfg_if! {
327401
self.__si_flags.hash(state);
328402
}
329403
}
404+
330405
impl PartialEq for __pollfd_ext_u {
331406
fn eq(&self, other: &__pollfd_ext_u) -> bool {
332407
unsafe {

0 commit comments

Comments
 (0)