Lines Matching refs:shm
50 globals->shm = NULL; in tsrm_win32_ctor()
74 if (globals->shm) { in tsrm_win32_dtor()
75 for (ptr = globals->shm; ptr < (globals->shm + globals->shm_size); ptr++) { in tsrm_win32_dtor()
81 free(globals->shm); in tsrm_win32_dtor()
433 for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) { in shm_get()
444 if (ptr < (TWG(shm) + TWG(shm_size))) { in shm_get()
448 newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair)); in shm_get()
453 TWG(shm) = newptr; in shm_get()
643 shm_pair *shm; in shmget() local
661 …info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descrip… in shmget()
685 shm = shm_get(key, NULL); in shmget()
686 if (!shm) { in shmget()
691 shm->segment = shm_handle; in shmget()
692 shm->info = info_handle; in shmget()
693 shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); in shmget()
695 if (NULL != shm->descriptor && created) { in shmget()
696 shm->descriptor->shm_perm.key = key; in shmget()
697 shm->descriptor->shm_segsz = size; in shmget()
698 shm->descriptor->shm_ctime = time(NULL); in shmget()
699 shm->descriptor->shm_cpid = getpid(); in shmget()
700 shm->descriptor->shm_perm.mode = flags; in shmget()
702 shm->descriptor->shm_perm.cuid = shm->descriptor->shm_perm.cgid= 0; in shmget()
703 shm->descriptor->shm_perm.gid = shm->descriptor->shm_perm.uid = 0; in shmget()
704 shm->descriptor->shm_atime = shm->descriptor->shm_dtime = 0; in shmget()
705 shm->descriptor->shm_lpid = shm->descriptor->shm_nattch = 0; in shmget()
706 shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0; in shmget()
709 …if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->sh… in shmget()
710 if (NULL != shm->segment) { in shmget()
711 CloseHandle(shm->segment); in shmget()
713 UnmapViewOfFile(shm->descriptor); in shmget()
714 CloseHandle(shm->info); in shmget()
723 shm_pair *shm = shm_get(key, NULL); in shmat() local
725 if (!shm->segment) { in shmat()
729 shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); in shmat()
731 if (NULL == shm->addr) { in shmat()
737 shm->descriptor->shm_atime = time(NULL); in shmat()
738 shm->descriptor->shm_lpid = getpid(); in shmat()
739 shm->descriptor->shm_nattch++; in shmat()
741 return shm->addr; in shmat()
746 shm_pair *shm = shm_get(0, (void*)shmaddr); in shmdt() local
748 if (!shm->segment) { in shmdt()
752 shm->descriptor->shm_dtime = time(NULL); in shmdt()
753 shm->descriptor->shm_lpid = getpid(); in shmdt()
754 shm->descriptor->shm_nattch--; in shmdt()
756 return UnmapViewOfFile(shm->addr) ? 0 : -1; in shmdt()
760 shm_pair *shm = shm_get(key, NULL); in shmctl() local
762 if (!shm->segment) { in shmctl()
768 memcpy(buf, shm->descriptor, sizeof(struct shmid_ds)); in shmctl()
772 shm->descriptor->shm_ctime = time(NULL); in shmctl()
773 shm->descriptor->shm_perm.uid = buf->shm_perm.uid; in shmctl()
774 shm->descriptor->shm_perm.gid = buf->shm_perm.gid; in shmctl()
775 shm->descriptor->shm_perm.mode = buf->shm_perm.mode; in shmctl()
779 if (shm->descriptor->shm_nattch < 1) { in shmctl()
780 shm->descriptor->shm_perm.key = -1; in shmctl()