MCPcopy Create free account
hub / github.com/acl-dev/acl / get_tls_buf

Function get_tls_buf

lib_acl/src/stdlib/sys/acl_process.c:22–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#define BUF_SIZE 4096
21
22static char *get_tls_buf(void)
23{
24 const char *myname = "get_tls_buf";
25 static acl_pthread_key_t buf_key = (acl_pthread_key_t) ACL_TLS_OUT_OF_INDEXES;
26 char *buf;
27 static char buf_unsafe[BUF_SIZE];
28
29 buf = (char*) acl_pthread_tls_get(&buf_key);
30 if (buf != NULL)
31 return (buf);
32
33 if (buf_key == (acl_pthread_key_t) ACL_TLS_OUT_OF_INDEXES) {
34 acl_msg_warn("%s(%d): acl_pthread_tls_get error(%s), "
35 "use unsafe buf", myname, __LINE__, acl_last_serror());
36 buf = buf_unsafe;
37 } else {
38 buf = (char*) acl_mycalloc(1, BUF_SIZE);
39 acl_pthread_tls_set(buf_key, buf,
40 (void (*)(void*)) acl_myfree_fn);
41 }
42 return (buf);
43}
44
45#ifdef ACL_LINUX
46const char *acl_process_path(void)

Callers 2

acl_process_pathFunction · 0.85
acl_getcwdFunction · 0.85

Calls 4

acl_pthread_tls_getFunction · 0.85
acl_msg_warnFunction · 0.85
acl_last_serrorFunction · 0.85
acl_pthread_tls_setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…