64 static int_fnP_cond_tP _cond_destroy; |
64 static int_fnP_cond_tP _cond_destroy; |
65 static int _cond_scope; |
65 static int _cond_scope; |
66 |
66 |
67 typedef uintptr_t lgrp_cookie_t; |
67 typedef uintptr_t lgrp_cookie_t; |
68 typedef id_t lgrp_id_t; |
68 typedef id_t lgrp_id_t; |
|
69 typedef int lgrp_rsrc_t; |
69 typedef enum lgrp_view { |
70 typedef enum lgrp_view { |
70 LGRP_VIEW_CALLER, /* what's available to the caller */ |
71 LGRP_VIEW_CALLER, /* what's available to the caller */ |
71 LGRP_VIEW_OS /* what's available to operating system */ |
72 LGRP_VIEW_OS /* what's available to operating system */ |
72 } lgrp_view_t; |
73 } lgrp_view_t; |
73 |
74 |
75 typedef lgrp_cookie_t (*lgrp_init_func_t)(lgrp_view_t view); |
76 typedef lgrp_cookie_t (*lgrp_init_func_t)(lgrp_view_t view); |
76 typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie); |
77 typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie); |
77 typedef lgrp_id_t (*lgrp_root_func_t)(lgrp_cookie_t cookie); |
78 typedef lgrp_id_t (*lgrp_root_func_t)(lgrp_cookie_t cookie); |
78 typedef int (*lgrp_children_func_t)(lgrp_cookie_t cookie, lgrp_id_t parent, |
79 typedef int (*lgrp_children_func_t)(lgrp_cookie_t cookie, lgrp_id_t parent, |
79 lgrp_id_t *lgrp_array, uint_t lgrp_array_size); |
80 lgrp_id_t *lgrp_array, uint_t lgrp_array_size); |
|
81 typedef int (*lgrp_resources_func_t)(lgrp_cookie_t cookie, lgrp_id_t lgrp, |
|
82 lgrp_id_t *lgrp_array, uint_t lgrp_array_size, |
|
83 lgrp_rsrc_t type); |
80 typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie); |
84 typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie); |
81 typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie); |
85 typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie); |
82 typedef int (*meminfo_func_t)(const uint64_t inaddr[], int addr_count, |
86 typedef int (*meminfo_func_t)(const uint64_t inaddr[], int addr_count, |
83 const uint_t info_req[], int info_count, |
87 const uint_t info_req[], int info_count, |
84 uint64_t outdata[], uint_t validity[]); |
88 uint64_t outdata[], uint_t validity[]); |
86 static lgrp_home_func_t _lgrp_home; |
90 static lgrp_home_func_t _lgrp_home; |
87 static lgrp_init_func_t _lgrp_init; |
91 static lgrp_init_func_t _lgrp_init; |
88 static lgrp_fini_func_t _lgrp_fini; |
92 static lgrp_fini_func_t _lgrp_fini; |
89 static lgrp_root_func_t _lgrp_root; |
93 static lgrp_root_func_t _lgrp_root; |
90 static lgrp_children_func_t _lgrp_children; |
94 static lgrp_children_func_t _lgrp_children; |
|
95 static lgrp_resources_func_t _lgrp_resources; |
91 static lgrp_nlgrps_func_t _lgrp_nlgrps; |
96 static lgrp_nlgrps_func_t _lgrp_nlgrps; |
92 static lgrp_cookie_stale_func_t _lgrp_cookie_stale; |
97 static lgrp_cookie_stale_func_t _lgrp_cookie_stale; |
93 static lgrp_cookie_t _lgrp_cookie; |
98 static lgrp_cookie_t _lgrp_cookie; |
94 |
99 |
95 static meminfo_func_t _meminfo; |
100 static meminfo_func_t _meminfo; |
107 static struct sigaction *(*get_signal_action)(int); |
112 static struct sigaction *(*get_signal_action)(int); |
108 static struct sigaction *get_preinstalled_handler(int); |
113 static struct sigaction *get_preinstalled_handler(int); |
109 static int (*get_libjsig_version)(); |
114 static int (*get_libjsig_version)(); |
110 static void save_preinstalled_handler(int, struct sigaction&); |
115 static void save_preinstalled_handler(int, struct sigaction&); |
111 static void check_signal_handler(int sig); |
116 static void check_signal_handler(int sig); |
112 |
|
113 // For overridable signals |
117 // For overridable signals |
114 static int _SIGinterrupt; // user-overridable INTERRUPT_SIGNAL |
118 static int _SIGinterrupt; // user-overridable INTERRUPT_SIGNAL |
115 static int _SIGasync; // user-overridable ASYNC_SIGNAL |
119 static int _SIGasync; // user-overridable ASYNC_SIGNAL |
116 static void set_SIGinterrupt(int newsig) { _SIGinterrupt = newsig; } |
120 static void set_SIGinterrupt(int newsig) { _SIGinterrupt = newsig; } |
117 static void set_SIGasync(int newsig) { _SIGasync = newsig; } |
121 static void set_SIGasync(int newsig) { _SIGasync = newsig; } |
251 |
255 |
252 static void set_lgrp_home(lgrp_home_func_t func) { _lgrp_home = func; } |
256 static void set_lgrp_home(lgrp_home_func_t func) { _lgrp_home = func; } |
253 static void set_lgrp_init(lgrp_init_func_t func) { _lgrp_init = func; } |
257 static void set_lgrp_init(lgrp_init_func_t func) { _lgrp_init = func; } |
254 static void set_lgrp_fini(lgrp_fini_func_t func) { _lgrp_fini = func; } |
258 static void set_lgrp_fini(lgrp_fini_func_t func) { _lgrp_fini = func; } |
255 static void set_lgrp_root(lgrp_root_func_t func) { _lgrp_root = func; } |
259 static void set_lgrp_root(lgrp_root_func_t func) { _lgrp_root = func; } |
256 static void set_lgrp_children(lgrp_children_func_t func) { _lgrp_children = func; } |
260 static void set_lgrp_children(lgrp_children_func_t func) { _lgrp_children = func; } |
257 static void set_lgrp_nlgrps(lgrp_nlgrps_func_t func) { _lgrp_nlgrps = func; } |
261 static void set_lgrp_resources(lgrp_resources_func_t func) { _lgrp_resources = func; } |
|
262 static void set_lgrp_nlgrps(lgrp_nlgrps_func_t func) { _lgrp_nlgrps = func; } |
258 static void set_lgrp_cookie_stale(lgrp_cookie_stale_func_t func) { _lgrp_cookie_stale = func; } |
263 static void set_lgrp_cookie_stale(lgrp_cookie_stale_func_t func) { _lgrp_cookie_stale = func; } |
259 static void set_lgrp_cookie(lgrp_cookie_t cookie) { _lgrp_cookie = cookie; } |
264 static void set_lgrp_cookie(lgrp_cookie_t cookie) { _lgrp_cookie = cookie; } |
260 |
265 |
261 static id_t lgrp_home(idtype_t type, id_t id) { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; } |
266 static id_t lgrp_home(idtype_t type, id_t id) { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; } |
262 static lgrp_cookie_t lgrp_init(lgrp_view_t view) { return _lgrp_init != NULL ? _lgrp_init(view) : 0; } |
267 static lgrp_cookie_t lgrp_init(lgrp_view_t view) { return _lgrp_init != NULL ? _lgrp_init(view) : 0; } |
264 static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; }; |
269 static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; }; |
265 static int lgrp_children(lgrp_cookie_t cookie, lgrp_id_t parent, |
270 static int lgrp_children(lgrp_cookie_t cookie, lgrp_id_t parent, |
266 lgrp_id_t *lgrp_array, uint_t lgrp_array_size) { |
271 lgrp_id_t *lgrp_array, uint_t lgrp_array_size) { |
267 return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1; |
272 return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1; |
268 } |
273 } |
|
274 static int lgrp_resources(lgrp_cookie_t cookie, lgrp_id_t lgrp, |
|
275 lgrp_id_t *lgrp_array, uint_t lgrp_array_size, |
|
276 lgrp_rsrc_t type) { |
|
277 return _lgrp_resources != NULL ? _lgrp_resources(cookie, lgrp, lgrp_array, lgrp_array_size, type) : -1; |
|
278 } |
|
279 |
269 static int lgrp_nlgrps(lgrp_cookie_t cookie) { return _lgrp_nlgrps != NULL ? _lgrp_nlgrps(cookie) : -1; } |
280 static int lgrp_nlgrps(lgrp_cookie_t cookie) { return _lgrp_nlgrps != NULL ? _lgrp_nlgrps(cookie) : -1; } |
270 static int lgrp_cookie_stale(lgrp_cookie_t cookie) { |
281 static int lgrp_cookie_stale(lgrp_cookie_t cookie) { |
271 return _lgrp_cookie_stale != NULL ? _lgrp_cookie_stale(cookie) : -1; |
282 return _lgrp_cookie_stale != NULL ? _lgrp_cookie_stale(cookie) : -1; |
272 } |
283 } |
273 static lgrp_cookie_t lgrp_cookie() { return _lgrp_cookie; } |
284 static lgrp_cookie_t lgrp_cookie() { return _lgrp_cookie; } |