@@ -43,6 +43,16 @@ pub type id_t = ::c_int;
43
43
pub type idtype_t = :: c_uint ;
44
44
pub type shmatt_t = :: c_ulong ;
45
45
46
+ pub type lgrp_rsrc_t = :: c_int ;
47
+ pub type lgrp_affinity_t = :: c_int ;
48
+ pub type lgrp_id_t = :: id_t ;
49
+ pub type lgrp_mem_size_t = :: c_longlong ;
50
+ pub type lgrp_cookie_t = :: uintptr_t ;
51
+ pub type lgrp_content_t = :: c_uint ;
52
+ pub type lgrp_lat_between_t = :: c_uint ;
53
+ pub type lgrp_mem_size_flag_t = :: c_uint ;
54
+ pub type lgrp_view_t = :: c_uint ;
55
+
46
56
#[ cfg_attr( feature = "extra_traits" , derive( Debug ) ) ]
47
57
pub enum timezone { }
48
58
impl :: Copy for timezone { }
@@ -434,6 +444,13 @@ s! {
434
444
pub mr_prot: :: c_uint,
435
445
pub mr_flags: :: c_uint,
436
446
}
447
+
448
+ pub struct lgrp_affinity_args {
449
+ pub idtype: :: idtype_t,
450
+ pub id: :: id_t,
451
+ pub lgrp: :: lgrp_id_t,
452
+ pub aff: :: lgrp_affinity_t,
453
+ }
437
454
}
438
455
439
456
s_no_extra_traits ! {
@@ -2309,6 +2326,23 @@ pub const SI_ARCHITECTURE_64: ::c_int = 517;
2309
2326
pub const SI_ARCHITECTURE_K : :: c_int = 518 ;
2310
2327
pub const SI_ARCHITECTURE_NATIVE : :: c_int = 519 ;
2311
2328
2329
+ // sys/lgrp_user.h
2330
+ pub const LGRP_COOKIE_NONE : :: lgrp_cookie_t = 0 ;
2331
+ pub const LGRP_AFF_NONE : :: lgrp_affinity_t = 0x0 ;
2332
+ pub const LGRP_AFF_WEAK : :: lgrp_affinity_t = 0x10 ;
2333
+ pub const LGRP_AFF_STRONG : :: lgrp_affinity_t = 0x100 ;
2334
+ pub const LGRP_RSRC_COUNT : :: lgrp_rsrc_t = 2 ;
2335
+ pub const LGRP_RSRC_CPU : :: lgrp_rsrc_t = 0 ;
2336
+ pub const LGRP_RSRC_MEM : :: lgrp_rsrc_t = 1 ;
2337
+ pub const LGRP_CONTENT_ALL : :: lgrp_content_t = 0 ;
2338
+ pub const LGRP_CONTENT_HIERARCHY : :: lgrp_content_t = LGRP_CONTENT_ALL ;
2339
+ pub const LGRP_CONTENT_DIRECT : :: lgrp_content_t = 1 ;
2340
+ pub const LGRP_LAT_CPU_TO_MEM : :: lgrp_lat_between_t = 0 ;
2341
+ pub const LGRP_MEM_SZ_FREE : :: lgrp_mem_size_flag_t = 0 ;
2342
+ pub const LGRP_MEM_SZ_INSTALLED : :: lgrp_mem_size_flag_t = 1 ;
2343
+ pub const LGRP_VIEW_CALLER : :: lgrp_view_t = 0 ;
2344
+ pub const LGRP_VIEW_OS : :: lgrp_view_t = 1 ;
2345
+
2312
2346
// As per sys/socket.h, header alignment must be 8 bytes on SPARC
2313
2347
// and 4 bytes everywhere else:
2314
2348
#[ cfg( target_arch = "sparc64" ) ]
@@ -2925,6 +2959,38 @@ extern "C" {
2925
2959
pub fn strsep ( string : * mut * mut :: c_char , delim : * const :: c_char ) -> * mut :: c_char ;
2926
2960
}
2927
2961
2962
+ #[ link( name = "lgrp" ) ]
2963
+ extern "C" {
2964
+ pub fn lgrp_init ( view : lgrp_view_t ) -> lgrp_cookie_t ;
2965
+ pub fn lgrp_fini ( cookie : lgrp_cookie_t ) -> :: c_int ;
2966
+ pub fn lgrp_affinity_get (
2967
+ idtype : :: idtype_t ,
2968
+ id : :: id_t ,
2969
+ lgrp : :: lgrp_id_t ,
2970
+ ) -> :: lgrp_affinity_t ;
2971
+ pub fn lgrp_affinity_set (
2972
+ idtype : :: idtype_t ,
2973
+ id : :: id_t ,
2974
+ lgrp : :: lgrp_id_t ,
2975
+ aff : lgrp_affinity_t ,
2976
+ ) -> :: lgrp_affinity_t ;
2977
+ pub fn lgrp_cpus (
2978
+ cookie : :: lgrp_cookie_t ,
2979
+ lgrp : :: lgrp_id_t ,
2980
+ cpuids : * mut :: processorid_t ,
2981
+ count : :: c_uint ,
2982
+ content : :: lgrp_content_t ,
2983
+ ) -> :: c_int ;
2984
+ pub fn lgrp_mem_size (
2985
+ cookie : :: lgrp_cookie_t ,
2986
+ lgrp : :: lgrp_id_t ,
2987
+ tpe : :: lgrp_mem_size_flag_t ,
2988
+ content : :: lgrp_content_t ,
2989
+ ) -> :: lgrp_mem_size_t ;
2990
+ pub fn lgrp_nlgrps ( cookie : :: lgrp_cookie_t ) -> :: c_int ;
2991
+ pub fn lgrp_view ( cookie : :: lgrp_cookie_t ) -> :: lgrp_view_t ;
2992
+ }
2993
+
2928
2994
mod compat;
2929
2995
pub use self :: compat:: * ;
2930
2996
0 commit comments