1 /*****************************************************************************\ 2 * slurm_xlator.h - Definitions required to translate Slurm function names 3 * to aliases containing a prefix of "slurm_". 4 * 5 * This is required because some Slurm functions have common names 6 * (e.g. "debug" and "info"). If a user application defines these functions 7 * and uses Slurm APIs, they could link to the user function rather than 8 * the Slurm function. By renaming the functions, inappropriate linking 9 * should be avoided. 10 * 11 * All Slurm functions referenced from the switch, auth, and mpi plugins should 12 * have aliases established. Functions not referenced from the plugins 13 * need not be aliased. 14 * 15 * To use this header file: 16 * 1. In the module containing the exported function code, establish an 17 * alias for each of the functions after they are defined. 18 * #include "src/common/macros.h" 19 * strong_alias(<name>, slurm_<name>); 20 * 2. For each function, change it's name then include the appropriate 21 * header file with definitions. 22 * #define <name> slurm_<name> 23 * 3. In the plugin modules using the functions, include this header file 24 * and remove other slurm header files (they should all be in this header). 25 * This logic will have the plugin link only to the function names with 26 * the "slurm_" prefix. 27 * 28 * NOTE: Not all operating systems support this function aliasing (e.g. AIX). 29 ***************************************************************************** 30 * Copyright (C) 2004 The Regents of the University of California. 31 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). 32 * Written by Mark Grondona <grondona1@llnl.gov>, 33 * Morris Jette <jette1@llnl.gov> 34 * CODE-OCEC-09-009. All rights reserved. 35 * 36 * This file is part of Slurm, a resource management program. 37 * For details, see <https://slurm.schedmd.com/>. 38 * Please also read the included file: DISCLAIMER. 39 * 40 * Slurm is free software; you can redistribute it and/or modify it under 41 * the terms of the GNU General Public License as published by the Free 42 * Software Foundation; either version 2 of the License, or (at your option) 43 * any later version. 44 * 45 * In addition, as a special exception, the copyright holders give permission 46 * to link the code of portions of this program with the OpenSSL library under 47 * certain conditions as described in each individual source file, and 48 * distribute linked combinations including the two. You must obey the GNU 49 * General Public License in all respects for all of the code used other than 50 * OpenSSL. If you modify file(s) with this exception, you may extend this 51 * exception to your version of the file(s), but you are not obligated to do 52 * so. If you do not wish to do so, delete this exception statement from your 53 * version. If you delete this exception statement from all source files in 54 * the program, then also delete it here. 55 * 56 * Slurm is distributed in the hope that it will be useful, but WITHOUT ANY 57 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 58 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 59 * details. 60 * 61 * You should have received a copy of the GNU General Public License along 62 * with Slurm; if not, write to the Free Software Foundation, Inc., 63 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 64 \*****************************************************************************/ 65 66 #ifndef __SLURM_XLATOR_H__ 67 #define __SLURM_XLATOR_H__ 68 69 #include "config.h" 70 71 #if USE_ALIAS 72 73 /* bitstring.[ch] functions*/ 74 #define bit_alloc slurm_bit_alloc 75 #define bit_test slurm_bit_test 76 #define bit_set slurm_bit_set 77 #define bit_clear slurm_bit_clear 78 #define bit_nclear slurm_bit_nclear 79 #define bit_nset slurm_bit_nset 80 #define bit_set_all slurm_bit_set_all 81 #define bit_clear_all slurm_bit_clear_all 82 #define bit_ffc slurm_bit_ffc 83 #define bit_ffs slurm_bit_ffs 84 #define bit_free slurm_bit_free 85 #define bit_realloc slurm_bit_realloc 86 #define bit_size slurm_bit_size 87 #define bit_and slurm_bit_and 88 #define bit_not slurm_bit_not 89 #define bit_or slurm_bit_or 90 #define bit_set_count slurm_bit_set_count 91 #define bit_set_count_range slurm_bit_set_count_range 92 #define bit_clear_count slurm_bit_clear_count 93 #define bit_nset_max_count slurm_bit_nset_max_count 94 #define bit_rotate_copy slurm_bit_rotate_copy 95 #define bit_rotate slurm_bit_rotate 96 #define bit_fmt slurm_bit_fmt 97 #define bit_unfmt slurm_bit_unfmt 98 #define bitfmt2int slurm_bitfmt2int 99 #define bit_fmt_hexmask slurm_bit_fmt_hexmask 100 #define bit_unfmt_hexmask slurm_bit_unfmt_hexmask 101 #define bit_fmt_binmask slurm_bit_fmt_binmask 102 #define bit_unfmt_binmask slurm_bit_unfmt_binmask 103 #define bit_fls slurm_bit_fls 104 #define bit_fill_gaps slurm_bit_fill_gaps 105 #define bit_super_set slurm_bit_super_set 106 #define bit_copy slurm_bit_copy 107 #define bit_pick_cnt slurm_bit_pick_cnt 108 #define bit_nffc slurm_bit_nffc 109 #define bit_noc slurm_bit_noc 110 #define bit_nffs slurm_bit_nffs 111 #define bit_copybits slurm_bit_copybits 112 113 /* fd.[ch] functions */ 114 #define fd_set_blocking slurm_fd_set_blocking 115 #define fd_set_nonblocking slurm_fd_set_nonblocking 116 #define send_fd_over_pipe slurm_send_fd_over_pipe 117 #define receive_fd_over_pipe slurm_receive_fd_over_pipe 118 119 /* hostlist.[ch] functions */ 120 #define hostlist_create slurm_hostlist_create 121 #define hostlist_copy slurm_hostlist_copy 122 #define hostlist_count slurm_hostlist_count 123 #define hostlist_delete slurm_hostlist_delete 124 #define hostlist_delete_host slurm_hostlist_delete_host 125 #define hostlist_delete_nth slurm_hostlist_delete_nth 126 #define hostlist_deranged_string slurm_hostlist_deranged_string 127 #define hostlist_deranged_string_malloc \ 128 slurm_hostlist_deranged_string_malloc 129 #define hostlist_deranged_string_xmalloc \ 130 slurm_hostlist_deranged_string_xmalloc 131 #define hostlist_destroy slurm_hostlist_destroy 132 #define hostlist_find slurm_hostlist_find 133 #define hostlist_iterator_create slurm_hostlist_iterator_create 134 #define hostlist_iterator_destroy slurm_hostlist_iterator_destroy 135 #define hostlist_iterator_reset slurm_hostlist_iterator_reset 136 #define hostlist_next slurm_hostlist_next 137 #define hostlist_next_range slurm_hostlist_next_range 138 #define hostlist_nth slurm_hostlist_nth 139 #define hostlist_pop slurm_hostlist_pop 140 #define hostlist_pop_range slurm_hostlist_pop_range 141 #define hostlist_push slurm_hostlist_push 142 #define hostlist_push_host slurm_hostlist_push_host 143 #define hostlist_push_list slurm_hostlist_push_list 144 #define hostlist_ranged_string slurm_hostlist_ranged_string 145 #define hostlist_ranged_string_malloc \ 146 slurm_hostlist_ranged_string_malloc 147 #define hostlist_ranged_string_xmalloc \ 148 slurm_hostlist_ranged_string_xmalloc 149 #define hostlist_remove slurm_hostlist_remove 150 #define hostlist_shift slurm_hostlist_shift 151 #define hostlist_shift_range slurm_hostlist_shift_range 152 #define hostlist_sort slurm_hostlist_sort 153 #define hostlist_uniq slurm_hostlist_uniq 154 #define hostset_copy slurm_hostset_copy 155 #define hostset_count slurm_hostset_count 156 #define hostset_create slurm_hostset_create 157 #define hostset_delete slurm_hostset_delete 158 #define hostset_destroy slurm_hostset_destroy 159 #define hostset_insert slurm_hostset_insert 160 #define hostset_shift slurm_hostset_shift 161 #define hostset_shift_range slurm_hostset_shift_range 162 #define hostset_within slurm_hostset_within 163 164 /* gres.[ch] functions */ 165 #define gres_gresid_to_gresname slurm_gres_gresid_to_gresname 166 #define gres_get_node_used slurm_gres_get_node_used 167 #define gres_get_system_cnt slurm_gres_get_system_cnt 168 #define gres_get_value_by_type slurm_gres_get_value_by_type 169 #define gres_get_job_info slurm_gres_get_job_info 170 #define gres_build_job_details slurm_gres_build_job_details 171 #define gres_get_step_info slurm_gres_get_step_info 172 #define gres_get_step_state slurm_gres_get_step_state 173 #define gres_get_job_state slurm_gres_get_job_state 174 #define gres_2_tres_str slurm_gres_2_tres_str 175 #define gres_set_job_tres_cnt slurm_gres_set_job_tres_cnt 176 #define gres_set_node_tres_cnt slurm_gres_set_node_tres_cnt 177 #define gres_device_major slurm_gres_device_major 178 #define destroy_gres_device slurm_destroy_gres_device 179 180 /* list.[ch] functions */ 181 #define list_create slurm_list_create 182 #define list_destroy slurm_list_destroy 183 #define list_is_empty slurm_list_is_empty 184 #define list_count slurm_list_count 185 #define list_append slurm_list_append 186 #define list_prepend slurm_list_prepend 187 #define list_find_first slurm_list_find_first 188 #define list_delete_all slurm_list_delete_all 189 #define list_for_each slurm_list_for_each 190 #define list_for_each_max slurm_list_for_each_max 191 #define list_sort slurm_list_sort 192 #define list_push slurm_list_push 193 #define list_pop slurm_list_pop 194 #define list_peek slurm_list_peek 195 #define list_enqueue slurm_list_enqueue 196 #define list_dequeue slurm_list_dequeue 197 #define list_iterator_create slurm_list_iterator_create 198 #define list_iterator_reset slurm_list_iterator_reset 199 #define list_iterator_destroy slurm_list_iterator_destroy 200 #define list_next slurm_list_next 201 #define list_insert slurm_list_insert 202 #define list_find slurm_list_find 203 #define list_remove slurm_list_remove 204 #define list_delete_item slurm_list_delete_item 205 206 /* log.[ch] functions */ 207 #define get_log_level slurm_get_log_level 208 #define get_sched_log_level slurm_get_sched_log_level 209 #define log_init slurm_log_init 210 #define log_reinit slurm_log_reinit 211 #define log_fini slurm_log_fini 212 #define log_alter slurm_log_alter 213 #define log_alter_with_fp slurm_log_alter_with_fp 214 #define log_set_fpfx slurm_log_set_fpfx 215 #define log_fp slurm_log_fp 216 #define log_has_data slurm_log_has_data 217 #define log_flush slurm_log_flush 218 #define log_var slurm_log_var 219 #define fatal_abort slurm_fatal_abort 220 #define fatal slurm_fatal 221 #define error slurm_error 222 #define info slurm_info 223 #define verbose slurm_verbose 224 225 /* macros.h functions 226 * None exported today. 227 * The header file used only for #define values. */ 228 229 /* net.[ch] functions */ 230 #define net_stream_listen slurm_net_stream_listen 231 #define net_set_low_water slurm_net_set_low_water 232 233 /* node_conf.[ch] functions */ 234 #define init_node_conf slurm_init_node_conf 235 #define build_all_nodeline_info slurm_build_all_nodeline_info 236 #define rehash_node slurm_rehash_node 237 #define hostlist2bitmap slurm_hostlist2bitmap 238 239 /* pack.[ch] functions */ 240 #define create_buf slurm_create_buf 241 #define free_buf slurm_free_buf 242 #define grow_buf slurm_grow_buf 243 #define init_buf slurm_init_buf 244 #define xfer_buf_data slurm_xfer_buf_data 245 #define pack_time slurm_pack_time 246 #define unpack_time slurm_unpack_time 247 #define packdouble slurm_packdouble 248 #define unpackdouble slurm_unpackdouble 249 #define packlongdouble slurm_packlongdouble 250 #define unpacklongdouble slurm_unpacklongdouble 251 #define pack64 slurm_pack64 252 #define unpack64 slurm_unpack64 253 #define pack32 slurm_pack32 254 #define unpack32 slurm_unpack32 255 #define pack16 slurm_pack16 256 #define unpack16 slurm_unpack16 257 #define pack8 slurm_pack8 258 #define unpack8 slurm_unpack8 259 #define pack32_array slurm_pack32_array 260 #define unpack32_array slurm_unpack32_array 261 #define packmem slurm_packmem 262 #define unpackmem slurm_unpackmem 263 #define unpackmem_ptr slurm_unpackmem_ptr 264 #define unpackmem_xmalloc slurm_unpackmem_xmalloc 265 #define unpackmem_malloc slurm_unpackmem_malloc 266 #define unpackstr_xmalloc_escaped slurm_unpackstr_xmalloc_escaped 267 #define unpackstr_xmalloc_chooser slurm_unpackstr_xmalloc_chooser 268 #define packstr_array slurm_packstr_array 269 #define unpackstr_array slurm_unpackstr_array 270 #define packmem_array slurm_packmem_array 271 #define unpackmem_array slurm_unpackmem_array 272 273 /* parse_time.[ch] functions */ 274 #define parse_time slurm_parse_time 275 #define time_str2mins slurm_time_str2mins 276 #define time_str2secs slurm_time_str2secs 277 #define secs2time_str slurm_secs2time_str 278 #define mins2time_str slurm_mins2time_str 279 #define mon_abbr slurm_mon_abbr 280 281 /* env.[ch] functions */ 282 #define setenvf slurm_setenvpf 283 #define unsetenvp slurm_unsetenvp 284 #define getenvp slurm_getenvp 285 #define env_array_create slurm_env_array_create 286 #define env_array_merge slurm_env_array_merge 287 #define env_array_copy slurm_env_array_copy 288 #define env_array_free slurm_env_array_free 289 #define env_array_append slurm_env_array_append 290 #define env_array_append_fmt slurm_env_array_append_fmt 291 #define env_array_overwrite slurm_env_array_overwrite 292 #define env_array_overwrite_fmt slurm_env_array_overwrite_fmt 293 #define env_array_overwrite_het_fmt slurm_env_array_overwrite_het_fmt 294 295 /* read_config.[ch] functions */ 296 #define destroy_config_key_pair slurm_destroy_config_key_pair 297 #define get_extra_conf_path slurm_get_extra_conf_path 298 #define sort_key_pairs slurm_sort_key_pairs 299 300 /* run_in_daemon.[ch] functions */ 301 #define run_in_daemon slurm_run_in_daemon 302 #define running_in_slurmctld slurm_running_in_slurmctld 303 #define running_in_slurmd slurm_running_in_slurmd 304 #define running_in_slurmdbd slurm_running_in_slurmdbd 305 #define running_in_slurmdstepd slurm_running_in_slurmdstepd 306 #define running_in_slurmstepd slurm_running_in_slurmstepd 307 308 /* slurm_auth.[ch] functions 309 * None exported today. 310 * The header file used only for #define values. */ 311 312 /* strlcpy.[ch] functions */ 313 #ifndef HAVE_STRLCPY 314 #define strlcpy slurm_strlcpy 315 #endif 316 317 /* switch.[ch] functions 318 * None exported today. 319 * The header file used only for #define values. */ 320 321 /* xassert.[ch] functions */ 322 #define __xassert_failed slurm_xassert_failed 323 324 /* xmalloc.[ch] functions */ 325 #define xfree_ptr slurm_xfree_ptr 326 327 /* xsignal.[ch] functions */ 328 #define xsignal slurm_xsignal 329 #define xsignal_save_mask slurm_xsignal_save_mask 330 #define xsignal_set_mask slurm_xsignal_set_mask 331 #define xsignal_block slurm_xsignal_block 332 #define xsignal_unblock slurm_xsignal_unblock 333 #define xsignal_sigset_create slurm_xsignal_sigset_create 334 335 /* xstring.[ch] functions */ 336 #define _xstrcat slurm_xstrcat 337 #define _xstrncat slurm_xstrncat 338 #define _xstrcatchar slurm_xstrcatchar 339 #define _xstrftimecat slurm_xstrftimecat 340 #define _xiso8601timecat slurm_xiso8601timecat 341 #define _xrfc5424timecat slurm_xrfc5424timecat 342 #define _xstrfmtcat slurm_xstrfmtcat 343 #define _xmemcat slurm_xmemcat 344 #define xstrdup slurm_xstrdup 345 #define xstrdup_printf slurm_xstrdup_printf 346 #define xbasename slurm_xbasename 347 #define _xstrsubstitute slurm_xstrsubstitute 348 #define xshort_hostname slurm_xshort_hostname 349 #define xstring_is_whitespace slurm_xstring_is_whitespace 350 #define xstrtolower slurm_xstrtolower 351 #define xstrchr slurm_xstrchr 352 #define xstrrchr slurm_xstrrchr 353 #define xstrcmp slurm_xstrcmp 354 #define xstrncmp slurm_xstrncmp 355 #define xstrcasecmp slurm_xstrcasecmp 356 #define xstrncasecmp slurm_xstrncasecmp 357 #define xstrcasestr slurm_xstrcasestr 358 359 /* slurm_protocol_api.[ch] functions */ 360 #define convert_num_unit2 slurm_convert_num_unit2 361 #define convert_num_unit slurm_convert_num_unit 362 #define revert_num_unit slurm_revert_num_unit 363 #define get_convert_unit_val slurm_get_convert_unit_val 364 #define get_unit_type slurm_get_unit_type 365 366 /* slurm_protocol_defs.[ch] functions */ 367 #define preempt_mode_string slurm_preempt_mode_string 368 #define preempt_mode_num slurm_preempt_mode_num 369 #define job_reason_string slurm_job_reason_string 370 #define job_state_string slurm_job_state_string 371 #define job_state_string_compact slurm_job_state_string_compact 372 #define job_state_num slurm_job_state_num 373 #define node_state_string slurm_node_state_string 374 #define node_state_string_compact slurm_node_state_string_compact 375 #define private_data_string slurm_private_data_string 376 #define accounting_enforce_string slurm_accounting_enforce_string 377 #define reservation_flags_string slurm_reservation_flags_string 378 #define print_multi_line_string slurm_print_multi_line_string 379 380 /* slurmdbd_defs.[ch] functions */ 381 #define slurmdbd_defs_init slurm_slurmdbd_defs_init 382 #define slurmdbd_defs_fini slurm_slurmdbd_defs_fini 383 #define slurmdbd_free_buffer slurm_slurmdbd_free_buffer 384 #define slurmdbd_free_list_msg slurm_slurmdbd_free_list_msg 385 #define slurmdbd_free_usage_msg slurm_slurmdbd_free_usage_msg 386 #define slurmdbd_free_id_rc_msg slurm_slurmdbd_free_id_rc_msg 387 388 /* slurmdbd_pack.[ch] functions */ 389 #define pack_slurmdbd_msg slurm_pack_slurmdbd_msg 390 #define unpack_slurmdbd_msg slurm_unpack_slurmdbd_msg 391 #define slurmdbd_pack_fini_msg slurm_slurmdbd_pack_fini_msg 392 393 /* plugin.[ch] functions */ 394 #define plugin_get_syms slurm_plugin_get_syms 395 #define plugin_load_and_link slurm_plugin_load_and_link 396 #define plugin_strerror slurm_plugin_strerror 397 #define plugin_unload slurm_plugin_unload 398 399 /* plugrack.[ch] functions */ 400 #define plugrack_create slurm_plugrack_create 401 #define plugrack_destroy slurm_plugrack_destroy 402 #define plugrack_read_dir slurm_plugrack_read_dir 403 #define plugrack_set_major_type slurm_plugrack_set_major_type 404 #define plugrack_use_by_type slurm_plugrack_use_by_type 405 406 #define jobacctinfo_pack slurm_jobacctinfo_pack 407 #define jobacctinfo_unpack slurm_jobacctinfo_unpack 408 #define jobacctinfo_create slurm_jobacctinfo_create 409 #define jobacctinfo_destroy slurm_jobacctinfo_destroy 410 411 /* parse_config.[ch] functions */ 412 #define s_p_hashtbl_create slurm_s_p_hashtbl_create 413 #define s_p_hashtbl_destroy slurm_s_p_hashtbl_destroy 414 #define s_p_parse_file slurm_s_p_parse_file 415 #define s_p_parse_pair slurm_s_p_parse_pair 416 #define s_p_parse_line slurm_s_p_parse_line 417 #define s_p_hashtbl_merge slurm_s_p_hashtbl_merge 418 #define s_p_get_string slurm_s_p_get_string 419 #define s_p_get_long slurm_s_p_get_long 420 #define s_p_get_uint16 slurm_s_p_get_uint16 421 #define s_p_get_uint32 slurm_s_p_get_uint32 422 #define s_p_get_uint64 slurm_s_p_get_uint64 423 #define s_p_get_pointer slurm_s_p_get_pointer 424 #define s_p_get_array slurm_s_p_get_array 425 #define s_p_get_boolean slurm_s_p_get_boolean 426 #define s_p_dump_values slurm_s_p_dump_values 427 #define transfer_s_p_options slurm_transfer_s_p_options 428 429 /* slurm_step_layout.[ch] functions */ 430 #define pack_slurm_step_layout slurm_pack_slurm_step_layout 431 #define unpack_slurm_step_layout slurm_unpack_slurm_step_layout 432 433 /* slurm_step_route.[ch] functions */ 434 #define route_split_hostlist_treewidth slurm_route_split_hostlist_treewidth 435 436 437 #define eio_handle_create slurm_eio_handle_create 438 #define eio_handle_destroy slurm_eio_handle_destroy 439 #define eio_handle_mainloop slurm_eio_handle_mainloop 440 #define eio_message_socket_accept slurm_eio_message_socket_accept 441 #define eio_message_socket_readable slurm_eio_message_socket_readable 442 #define eio_new_obj slurm_eio_new_obj 443 #define eio_new_initial_obj slurm_eio_new_initial_obj 444 #define eio_obj_create slurm_eio_obj_create 445 #define eio_obj_destroy slurm_eio_obj_destroy 446 #define eio_remove_obj slurm_eio_remove_obj 447 #define eio_signal_shutdown slurm_eio_signal_shutdown 448 #define eio_signal_wakeup slurm_eio_signal_wakeup 449 450 /* callerid.[ch] functions */ 451 #define callerid_get_own_netinfo slurm_callerid_get_own_netinfo 452 453 /* some stepd_api.[ch] functions */ 454 #define stepd_available slurm_stepd_available 455 #define stepd_connect slurm_stepd_connect 456 #define stepd_connect_nss slurm_stepd_connect_nss 457 #define stepd_get_uid slurm_stepd_get_uid 458 #define stepd_add_extern_pid slurm_stepd_add_extern_pid 459 #define stepd_get_x11_display slurm_stepd_get_x11_display 460 #define stepd_get_info slurm_stepd_get_info 461 #define stepd_getpw slurm_stepd_getpw 462 #define xfree_struct_passwd slurm_xfree_struct_passwd 463 #define stepd_getgr slurm_stepd_getgr 464 #define xfree_struct_group_array slurm_xfree_struct_group_array 465 466 /* xcgroup_read_config.[ch] */ 467 #define xcgroup_config_read_mutex slurm_xcgroup_config_read_mutex 468 #define xcgroup_get_slurm_cgroup_conf slurm_xcgroup_get_slurm_cgroup_conf 469 #define xcgroup_fini_slurm_cgroup_conf slurm_xcgroup_fini_slurm_cgroup_conf 470 471 #endif /* USE_ALIAS */ 472 473 /* Include the function definitions after redefining their names. */ 474 #include "src/common/bitstring.h" 475 #include "src/common/callerid.h" 476 #include "src/common/eio.h" 477 #include "src/common/env.h" 478 #include "src/common/hostlist.h" 479 #include "src/common/list.h" 480 #include "src/common/log.h" 481 #include "src/common/macros.h" 482 #include "src/common/node_select.h" 483 #include "src/common/pack.h" 484 #include "src/common/parse_config.h" 485 #include "src/common/read_config.h" 486 #include "src/common/slurm_auth.h" 487 #include "src/common/slurm_jobacct_gather.h" 488 #include "src/common/slurm_route.h" 489 #include "src/common/slurm_step_layout.h" 490 #include "src/common/strlcpy.h" 491 #include "src/common/stepd_api.h" 492 #include "src/common/switch.h" 493 #include "src/common/working_cluster.h" 494 #include "src/common/xassert.h" 495 #include "src/common/xcgroup_read_config.h" 496 #include "src/common/xmalloc.h" 497 #include "src/common/xsignal.h" 498 #include "src/common/xstring.h" 499 500 #endif /*__SLURM_XLATOR_H__*/ 501