LLVM OpenMP 20.0.0git
kmp_environment.h
Go to the documentation of this file.
1/*
2 * kmp_environment.h -- Handle environment variables OS-independently.
3 */
4
5//===----------------------------------------------------------------------===//
6//
7// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8// See https://llvm.org/LICENSE.txt for license information.
9// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef KMP_ENVIRONMENT_H
14#define KMP_ENVIRONMENT_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20// Return a copy of the value of environment variable or NULL if the variable
21// does not exist.
22// *Note*: Returned pointed *must* be freed after use with __kmp_env_free().
23char *__kmp_env_get(char const *name);
24void __kmp_env_free(char const **value);
25
26// Return 1 if the environment variable exists or 0 if does not exist.
27int __kmp_env_exists(char const *name);
28
29// Set the environment variable.
30void __kmp_env_set(char const *name, char const *value, int overwrite);
31
32// Unset (remove) environment variable.
33void __kmp_env_unset(char const *name);
34
35// -----------------------------------------------------------------------------
36// Working with environment blocks.
37
38/* kmp_env_blk_t is read-only collection of environment variables (or
39 environment-like). Usage:
40
41kmp_env_blk_t block;
42__kmp_env_blk_init( & block, NULL ); // Initialize block from process
43 // environment.
44// or
45__kmp_env_blk_init( & block, "KMP_WARNING=1|KMP_AFFINITY=none" ); // from string
46__kmp_env_blk_sort( & block ); // Optionally, sort list.
47for ( i = 0; i < block.count; ++ i ) {
48 // Process block.vars[ i ].name and block.vars[ i ].value...
49}
50__kmp_env_block_free( & block );
51*/
52
54 char *name;
55 char *value;
56};
58
60 char *bulk;
62 int count;
63};
65
66void __kmp_env_blk_init(kmp_env_blk_t *block, char const *bulk);
69char const *__kmp_env_blk_var(kmp_env_blk_t *block, char const *name);
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif // KMP_ENVIRONMENT_H
76
77// end of file //
__itt_string_handle * name
Definition: ittnotify.h:3305
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
char const * __kmp_env_blk_var(kmp_env_blk_t *block, char const *name)
void __kmp_env_free(char const **value)
void __kmp_env_blk_sort(kmp_env_blk_t *block)
char * __kmp_env_get(char const *name)
int __kmp_env_exists(char const *name)
void __kmp_env_blk_init(kmp_env_blk_t *block, char const *bulk)
void __kmp_env_blk_free(kmp_env_blk_t *block)
void __kmp_env_set(char const *name, char const *value, int overwrite)
void __kmp_env_unset(char const *name)
kmp_env_var_t * vars