MCPcopy Create free account
hub / github.com/ceph/ceph / get_rand_socket_path

Function get_rand_socket_path

src/common/admin_socket_client.cc:35–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33using std::ostringstream;
34
35const char* get_rand_socket_path()
36{
37 static char *g_socket_path = NULL;
38
39 if (g_socket_path == NULL) {
40 char buf[512];
41 const char *tdir = getenv("TMPDIR");
42 #ifdef _WIN32
43 if (tdir == NULL) {
44 tdir = getenv("TEMP");
45 }
46 #endif /* _WIN32 */
47 if (tdir == NULL) {
48 tdir = "/tmp";
49 }
50 snprintf(buf, sizeof(((struct sockaddr_un*)0)->sun_path),
51 "%s/perfcounters_test_socket.%ld.%ld",
52 tdir, (long int)getpid(), time(NULL));
53 g_socket_path = (char*)strdup(buf);
54 }
55 return g_socket_path;
56}
57
58static std::string asok_connect(const std::string &path, int *fd)
59{

Callers 6

mainFunction · 0.85
TESTFunction · 0.85
mainFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
SetUpMethod · 0.85

Calls 1

getenvFunction · 0.85

Tested by 6

mainFunction · 0.68
TESTFunction · 0.68
mainFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68
SetUpMethod · 0.68