Lines Matching refs:shm

47 	globals->shm	 = NULL;  in tsrm_win32_ctor()
71 if (globals->shm) { in tsrm_win32_dtor()
72 for (ptr = globals->shm; ptr < (globals->shm + globals->shm_size); ptr++) { in tsrm_win32_dtor()
76 free(globals->shm); in tsrm_win32_dtor()
403 for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) { in shm_get()
414 if (ptr < (TWG(shm) + TWG(shm_size))) { in shm_get()
418 newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair)); in shm_get()
423 TWG(shm) = newptr; in shm_get()
632 shm_pair *shm; in shmget() local
648 if (size == 0 || size > SIZE_MAX - sizeof(shm->descriptor)) { in shmget()
651 size += sizeof(shm->descriptor); in shmget()
676 for (shm_pair *ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) { in shmget()
679 ptr = TWG(shm); in shmget()
685 shm = shm_get(key, NULL); in shmget()
686 if (!shm) { in shmget()
690 shm->segment = shm_handle; in shmget()
691 shm->descriptor = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); in shmget()
693 if (NULL != shm->descriptor && created) { in shmget()
694 shm->descriptor->shm_perm.key = key; in shmget()
695 shm->descriptor->shm_segsz = size; in shmget()
696 shm->descriptor->shm_ctime = time(NULL); in shmget()
697 shm->descriptor->shm_cpid = getpid(); in shmget()
698 shm->descriptor->shm_perm.mode = flags; in shmget()
700 shm->descriptor->shm_perm.cuid = shm->descriptor->shm_perm.cgid= 0; in shmget()
701 shm->descriptor->shm_perm.gid = shm->descriptor->shm_perm.uid = 0; in shmget()
702 shm->descriptor->shm_atime = shm->descriptor->shm_dtime = 0; in shmget()
703 shm->descriptor->shm_lpid = shm->descriptor->shm_nattch = 0; in shmget()
704 shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0; in shmget()
707 …if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->sh… in shmget()
708 if (NULL != shm->segment) { in shmget()
709 CloseHandle(shm->segment); in shmget()
710 shm->segment = INVALID_HANDLE_VALUE; in shmget()
712 UnmapViewOfFile(shm->descriptor); in shmget()
713 shm->descriptor = NULL; in shmget()
722 shm_pair *shm = shm_get(key, NULL); in shmat() local
724 if (!shm || !shm->segment) { in shmat()
728 shm->addr = shm->descriptor + sizeof(shm->descriptor); in shmat()
729 shm->descriptor->shm_atime = time(NULL); in shmat()
730 shm->descriptor->shm_lpid = getpid(); in shmat()
731 shm->descriptor->shm_nattch++; in shmat()
733 return shm->addr; in shmat()
738 shm_pair *shm = shm_get(0, (void*)shmaddr); in shmdt() local
741 if (!shm || !shm->segment) { in shmdt()
745 shm->descriptor->shm_dtime = time(NULL); in shmdt()
746 shm->descriptor->shm_lpid = getpid(); in shmdt()
747 shm->descriptor->shm_nattch--; in shmdt()
750 if (shm->descriptor->shm_nattch <= 0) { in shmdt()
751 ret = UnmapViewOfFile(shm->descriptor) ? 0 : -1; in shmdt()
752 shm->descriptor = NULL; in shmdt()
759 shm_pair *shm = shm_get(key, NULL); in shmctl() local
761 if (!shm || !shm->segment) { in shmctl()
767 memcpy(buf, shm->descriptor, sizeof(struct shmid_ds)); in shmctl()
771 shm->descriptor->shm_ctime = time(NULL); in shmctl()
772 shm->descriptor->shm_perm.uid = buf->shm_perm.uid; in shmctl()
773 shm->descriptor->shm_perm.gid = buf->shm_perm.gid; in shmctl()
774 shm->descriptor->shm_perm.mode = buf->shm_perm.mode; in shmctl()
778 if (shm->descriptor->shm_nattch < 1) { in shmctl()
779 shm->descriptor->shm_perm.key = -1; in shmctl()