diff options
-rw-r--r-- | ipc/sem.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -92,7 +92,14 @@ | |||
92 | /* One semaphore structure for each semaphore in the system. */ | 92 | /* One semaphore structure for each semaphore in the system. */ |
93 | struct sem { | 93 | struct sem { |
94 | int semval; /* current value */ | 94 | int semval; /* current value */ |
95 | int sempid; /* pid of last operation */ | 95 | /* |
96 | * PID of the process that last modified the semaphore. For | ||
97 | * Linux, specifically these are: | ||
98 | * - semop | ||
99 | * - semctl, via SETVAL and SETALL. | ||
100 | * - at task exit when performing undo adjustments (see exit_sem). | ||
101 | */ | ||
102 | int sempid; | ||
96 | spinlock_t lock; /* spinlock for fine-grained semtimedop */ | 103 | spinlock_t lock; /* spinlock for fine-grained semtimedop */ |
97 | struct list_head pending_alter; /* pending single-sop operations */ | 104 | struct list_head pending_alter; /* pending single-sop operations */ |
98 | /* that alter the semaphore */ | 105 | /* that alter the semaphore */ |
@@ -1444,8 +1451,10 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, | |||
1444 | goto out_unlock; | 1451 | goto out_unlock; |
1445 | } | 1452 | } |
1446 | 1453 | ||
1447 | for (i = 0; i < nsems; i++) | 1454 | for (i = 0; i < nsems; i++) { |
1448 | sma->sem_base[i].semval = sem_io[i]; | 1455 | sma->sem_base[i].semval = sem_io[i]; |
1456 | sma->sem_base[i].sempid = task_tgid_vnr(current); | ||
1457 | } | ||
1449 | 1458 | ||
1450 | ipc_assert_locked_object(&sma->sem_perm); | 1459 | ipc_assert_locked_object(&sma->sem_perm); |
1451 | list_for_each_entry(un, &sma->list_id, list_id) { | 1460 | list_for_each_entry(un, &sma->list_id, list_id) { |