| 20 | #define BUF_SIZE 4096 |
| 21 | |
| 22 | static 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 |
| 46 | const char *acl_process_path(void) |
no test coverage detected
searching dependent graphs…