MCPcopy Create free account
hub / github.com/F-Stack/f-stack / shm_init

Function shm_init

freebsd/kern/uipc_shm.c:933–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

931}
932
933static void
934shm_init(void *arg)
935{
936 char name[32];
937 int i;
938
939 mtx_init(&shm_timestamp_lock, "shm timestamps", NULL, MTX_DEF);
940 sx_init(&shm_dict_lock, "shm dictionary");
941 shm_dictionary = hashinit(1024, M_SHMFD, &shm_hash);
942 new_unrhdr64(&shm_ino_unr, 1);
943 shm_dev_ino = devfs_alloc_cdp_inode();
944 KASSERT(shm_dev_ino > 0, ("shm dev inode not initialized"));
945
946 for (i = 1; i < MAXPAGESIZES; i++) {
947 if (pagesizes[i] == 0)
948 break;
949#define M (1024 * 1024)
950#define G (1024 * M)
951 if (pagesizes[i] >= G)
952 snprintf(name, sizeof(name), "%luG", pagesizes[i] / G);
953 else if (pagesizes[i] >= M)
954 snprintf(name, sizeof(name), "%luM", pagesizes[i] / M);
955 else
956 snprintf(name, sizeof(name), "%lu", pagesizes[i]);
957#undef G
958#undef M
959 SYSCTL_ADD_ULONG(NULL, SYSCTL_STATIC_CHILDREN(_vm_largepages),
960 OID_AUTO, name, CTLFLAG_RD, &count_largepages[i],
961 "number of non-transient largepages allocated");
962 }
963}
964SYSINIT(shm_init, SI_SUB_SYSV_SHM, SI_ORDER_ANY, shm_init, NULL);
965
966/*

Callers

nothing calls this directly

Calls 4

mtx_initFunction · 0.85
new_unrhdr64Function · 0.85
snprintfFunction · 0.85
hashinitFunction · 0.70

Tested by

no test coverage detected