Lines Matching refs:shm
46 globals->shm = NULL; in tsrm_win32_ctor()
70 if (globals->shm) { in tsrm_win32_dtor()
71 for (ptr = globals->shm; ptr < (globals->shm + globals->shm_size); ptr++) { in tsrm_win32_dtor()
77 free(globals->shm); in tsrm_win32_dtor()
416 for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) { in shm_get()
427 if (ptr < (TWG(shm) + TWG(shm_size))) { in shm_get()
431 newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair)); in shm_get()
436 TWG(shm) = newptr; in shm_get()
593 shm_pair *shm; in shmget() local
611 …info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descrip… in shmget()
623 shm = shm_get(key, NULL); in shmget()
624 shm->segment = shm_handle; in shmget()
625 shm->info = info_handle; in shmget()
626 shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); in shmget()
628 if (NULL != shm->descriptor && created) { in shmget()
629 shm->descriptor->shm_perm.key = key; in shmget()
630 shm->descriptor->shm_segsz = size; in shmget()
631 shm->descriptor->shm_ctime = time(NULL); in shmget()
632 shm->descriptor->shm_cpid = getpid(); in shmget()
633 shm->descriptor->shm_perm.mode = flags; in shmget()
635 shm->descriptor->shm_perm.cuid = shm->descriptor->shm_perm.cgid= 0; in shmget()
636 shm->descriptor->shm_perm.gid = shm->descriptor->shm_perm.uid = 0; in shmget()
637 shm->descriptor->shm_atime = shm->descriptor->shm_dtime = 0; in shmget()
638 shm->descriptor->shm_lpid = shm->descriptor->shm_nattch = 0; in shmget()
639 shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0; in shmget()
642 …if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->sh… in shmget()
643 if (NULL != shm->segment) { in shmget()
644 CloseHandle(shm->segment); in shmget()
646 UnmapViewOfFile(shm->descriptor); in shmget()
647 CloseHandle(shm->info); in shmget()
656 shm_pair *shm = shm_get(key, NULL); in shmat() local
658 if (!shm->segment) { in shmat()
662 shm->descriptor->shm_atime = time(NULL); in shmat()
663 shm->descriptor->shm_lpid = getpid(); in shmat()
664 shm->descriptor->shm_nattch++; in shmat()
666 shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); in shmat()
668 return shm->addr; in shmat()
673 shm_pair *shm = shm_get(0, (void*)shmaddr); in shmdt() local
675 if (!shm->segment) { in shmdt()
679 shm->descriptor->shm_dtime = time(NULL); in shmdt()
680 shm->descriptor->shm_lpid = getpid(); in shmdt()
681 shm->descriptor->shm_nattch--; in shmdt()
683 return UnmapViewOfFile(shm->addr) ? 0 : -1; in shmdt()
687 shm_pair *shm = shm_get(key, NULL); in shmctl() local
689 if (!shm->segment) { in shmctl()
695 memcpy(buf, shm->descriptor, sizeof(struct shmid_ds)); in shmctl()
699 shm->descriptor->shm_ctime = time(NULL); in shmctl()
700 shm->descriptor->shm_perm.uid = buf->shm_perm.uid; in shmctl()
701 shm->descriptor->shm_perm.gid = buf->shm_perm.gid; in shmctl()
702 shm->descriptor->shm_perm.mode = buf->shm_perm.mode; in shmctl()
706 if (shm->descriptor->shm_nattch < 1) { in shmctl()
707 shm->descriptor->shm_perm.key = -1; in shmctl()