@@ -21,6 +21,16 @@ pub type msglen_t = ::c_ulong;
21
21
pub type nfds_t = :: c_ulong ;
22
22
pub type nl_item = :: c_int ;
23
23
pub type idtype_t = :: c_uint ;
24
+ pub type Elf32_Half = u16 ;
25
+ pub type Elf32_Word = u32 ;
26
+ pub type Elf32_Off = u32 ;
27
+ pub type Elf32_Addr = u32 ;
28
+ pub type Elf64_Half = u16 ;
29
+ pub type Elf64_Word = u32 ;
30
+ pub type Elf64_Off = u64 ;
31
+ pub type Elf64_Addr = u64 ;
32
+ pub type Elf64_Xword = u64 ;
33
+ pub type Elf64_Sxword = i64 ;
24
34
25
35
#[ cfg_attr( feature = "extra_traits" , derive( Debug ) ) ]
26
36
pub enum fpos64_t { } // FIXME: fill this out with a struct
@@ -289,6 +299,54 @@ s! {
289
299
pub msgseg: :: c_ushort,
290
300
}
291
301
302
+ pub struct Elf32_Phdr {
303
+ pub p_type: Elf32_Word ,
304
+ pub p_offset: Elf32_Off ,
305
+ pub p_vaddr: Elf32_Addr ,
306
+ pub p_paddr: Elf32_Addr ,
307
+ pub p_filesz: Elf32_Word ,
308
+ pub p_memsz: Elf32_Word ,
309
+ pub p_flags: Elf32_Word ,
310
+ pub p_align: Elf32_Word ,
311
+ }
312
+
313
+ pub struct Elf64_Phdr {
314
+ pub p_type: Elf64_Word ,
315
+ pub p_flags: Elf64_Word ,
316
+ pub p_offset: Elf64_Off ,
317
+ pub p_vaddr: Elf64_Addr ,
318
+ pub p_paddr: Elf64_Addr ,
319
+ pub p_filesz: Elf64_Xword ,
320
+ pub p_memsz: Elf64_Xword ,
321
+ pub p_align: Elf64_Xword ,
322
+ }
323
+
324
+ pub struct dl_phdr_info {
325
+ #[ cfg( target_pointer_width = "64" ) ]
326
+ pub dlpi_addr: Elf64_Addr ,
327
+ #[ cfg( target_pointer_width = "32" ) ]
328
+ pub dlpi_addr: Elf32_Addr ,
329
+ pub dlpi_name: * const :: c_char,
330
+ #[ cfg( target_pointer_width = "64" ) ]
331
+ pub dlpi_phdr: * const Elf64_Phdr ,
332
+ #[ cfg( target_pointer_width = "32" ) ]
333
+ pub dlpi_phdr: * const Elf32_Phdr ,
334
+ #[ cfg( target_pointer_width = "64" ) ]
335
+ pub dlpi_phnum: Elf64_Half ,
336
+ #[ cfg( target_pointer_width = "32" ) ]
337
+ pub dlpi_phnum: Elf32_Half ,
338
+ // As of uClibc 1.0.36, the following fields are
339
+ // gated behind a "#if 0" block which always evaluates
340
+ // to false. So I'm just commenting these out and if uClibc changes
341
+ // the #if block in the future to include the following fields, these
342
+ // will probably need including here. tsidea
343
+ //
344
+ // pub dlpi_adds: ::c_ulonglong,
345
+ // pub dlpi_subs: ::c_ulonglong,
346
+ // pub dlpi_tls_modid: ::size_t,
347
+ // pub dlpi_tls_data: *mut ::c_void,
348
+ }
349
+
292
350
pub struct ucred {
293
351
pub pid: :: pid_t,
294
352
pub uid: :: uid_t,
@@ -2247,6 +2305,16 @@ extern "C" {
2247
2305
f : extern "C" fn ( * mut :: c_void ) -> * mut :: c_void ,
2248
2306
value : * mut :: c_void ,
2249
2307
) -> :: c_int ;
2308
+ pub fn dl_iterate_phdr (
2309
+ callback : :: Option <
2310
+ unsafe extern "C" fn (
2311
+ info : * mut :: dl_phdr_info ,
2312
+ size : :: size_t ,
2313
+ data : * mut :: c_void ,
2314
+ ) -> :: c_int ,
2315
+ > ,
2316
+ data : * mut :: c_void ,
2317
+ ) -> :: c_int ;
2250
2318
pub fn getgrgid ( gid : :: gid_t ) -> * mut :: group ;
2251
2319
pub fn popen ( command : * const c_char , mode : * const c_char ) -> * mut :: FILE ;
2252
2320
pub fn uname ( buf : * mut :: utsname ) -> :: c_int ;
0 commit comments