Skip to content

Commit f10578e

Browse files
committed
test
1 parent 63dcf5a commit f10578e

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

gpkg/glibc/shmctl.c

+19-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@ int __shmctl64(int shmid, int cmd, struct __shmid64_ds *buf) {
99

1010
if (cmd == IPC_RMID) {
1111
DBG("%s: IPC_RMID for shmid=%x\n", __PRETTY_FUNCTION__, shmid);
12+
13+
int socket_id = ashv_socket_id_from_shmid(shmid);
14+
1215
pthread_mutex_lock(&mutex);
16+
1317
int idx = ashv_find_local_index(shmid);
18+
if (idx == -1 && socket_id != ashv_local_socket_id) {
19+
idx = ashv_read_remote_segment(shmid);
20+
}
21+
1422
if (idx == -1) {
15-
DBG("%s: shmid=%x does not exist locally\n", __PRETTY_FUNCTION__, shmid);
16-
/* We do not rm non-local regions, but do not report an error for that. */
23+
DBG ("%s: ERROR: shmid %x does not exist\n", __PRETTY_FUNCTION__, shmid);
1724
pthread_mutex_unlock(&mutex);
18-
return 0;
25+
errno = EINVAL;
26+
return -1;
1927
}
2028

2129
if (shmem[idx].addr) {
@@ -35,14 +43,22 @@ int __shmctl64(int shmid, int cmd, struct __shmid64_ds *buf) {
3543
return -1;
3644
}
3745

46+
int socket_id = ashv_socket_id_from_shmid(shmid);
47+
3848
pthread_mutex_lock(&mutex);
49+
3950
int idx = ashv_find_local_index(shmid);
51+
if (idx == -1 && socket_id != ashv_local_socket_id) {
52+
idx = ashv_read_remote_segment(shmid);
53+
}
54+
4055
if (idx == -1) {
4156
DBG ("%s: ERROR: shmid %x does not exist\n", __PRETTY_FUNCTION__, shmid);
4257
pthread_mutex_unlock (&mutex);
4358
errno = EINVAL;
4459
return -1;
4560
}
61+
4662
/* Report max permissive mode */
4763
memset(buf, 0, sizeof(struct shmid_ds));
4864
buf->shm_segsz = shmem[idx].size;

0 commit comments

Comments
 (0)