MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / mi_path_max

Function mi_path_max

system/lib/mimalloc/src/alloc.c:558–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556#include <unistd.h> // pathconf
557
558static size_t mi_path_max(void) {
559 static _Atomic(size_t) path_max = 0;
560 size_t pmax = mi_atomic_load_acquire(&path_max);
561 if (pmax == 0) {
562 long m = 0;
563 #ifdef _PC_PATH_MAX
564 m = pathconf("/",_PC_PATH_MAX);
565 #endif
566 if (m <= 0) pmax = 4096; // guess
567 else if (m < 256) pmax = 256; // at least 256
568 else if (m > 64*1024) pmax = 64*1024; // at most 64 KiB
569 else pmax = m;
570 size_t expected = 0;
571 mi_atomic_cas_strong_acq_rel(&path_max, &expected, pmax);
572 }
573 return pmax;
574}
575
576char* mi_theap_realpath(mi_theap_t* theap, const char* fname, char* resolved_name) mi_attr_noexcept {
577 if (resolved_name != NULL) {

Callers 1

mi_theap_realpathFunction · 0.85

Calls 1

pathconfFunction · 0.85

Tested by

no test coverage detected