Commit 969d2aca authored by Ulrich Drepper's avatar Ulrich Drepper Committed by Linus Torvalds

[PATCH] More ->pid to ->tgid changes

One more overlooked area where the proper process ID has to be used:
SysV IPC "pid" values should use the thread group ID, not the per-thread
one.
parent 6cf73674
...@@ -707,7 +707,7 @@ asmlinkage long sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int ms ...@@ -707,7 +707,7 @@ asmlinkage long sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int ms
goto retry; goto retry;
} }
msq->q_lspid = current->pid; msq->q_lspid = current->tgid;
msq->q_stime = get_seconds(); msq->q_stime = get_seconds();
if(!pipelined_send(msq,msg)) { if(!pipelined_send(msq,msg)) {
...@@ -801,7 +801,7 @@ asmlinkage long sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, ...@@ -801,7 +801,7 @@ asmlinkage long sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz,
list_del(&msg->m_list); list_del(&msg->m_list);
msq->q_qnum--; msq->q_qnum--;
msq->q_rtime = get_seconds(); msq->q_rtime = get_seconds();
msq->q_lrpid = current->pid; msq->q_lrpid = current->tgid;
msq->q_cbytes -= msg->m_ts; msq->q_cbytes -= msg->m_ts;
atomic_sub(msg->m_ts,&msg_bytes); atomic_sub(msg->m_ts,&msg_bytes);
atomic_dec(&msg_hdrs); atomic_dec(&msg_hdrs);
......
...@@ -664,7 +664,7 @@ static int semctl_main(int semid, int semnum, int cmd, int version, union semun ...@@ -664,7 +664,7 @@ static int semctl_main(int semid, int semnum, int cmd, int version, union semun
for (un = sma->undo; un; un = un->id_next) for (un = sma->undo; un; un = un->id_next)
un->semadj[semnum] = 0; un->semadj[semnum] = 0;
curr->semval = val; curr->semval = val;
curr->sempid = current->pid; curr->sempid = current->tgid;
sma->sem_ctime = get_seconds(); sma->sem_ctime = get_seconds();
/* maybe some queued-up processes were waiting for this */ /* maybe some queued-up processes were waiting for this */
update_queue(sma); update_queue(sma);
...@@ -1052,7 +1052,7 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops, ...@@ -1052,7 +1052,7 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops,
if (error) if (error)
goto out_unlock_free; goto out_unlock_free;
error = try_atomic_semop (sma, sops, nsops, un, current->pid); error = try_atomic_semop (sma, sops, nsops, un, current->tgid);
if (error <= 0) if (error <= 0)
goto update; goto update;
...@@ -1064,7 +1064,7 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops, ...@@ -1064,7 +1064,7 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops,
queue.sops = sops; queue.sops = sops;
queue.nsops = nsops; queue.nsops = nsops;
queue.undo = un; queue.undo = un;
queue.pid = current->pid; queue.pid = current->tgid;
queue.id = semid; queue.id = semid;
if (alter) if (alter)
append_to_queue(sma ,&queue); append_to_queue(sma ,&queue);
...@@ -1206,7 +1206,7 @@ void exit_sem(struct task_struct *tsk) ...@@ -1206,7 +1206,7 @@ void exit_sem(struct task_struct *tsk)
sem->semval += u->semadj[i]; sem->semval += u->semadj[i];
if (sem->semval < 0) if (sem->semval < 0)
sem->semval = 0; /* shouldn't happen */ sem->semval = 0; /* shouldn't happen */
sem->sempid = current->pid; sem->sempid = current->tgid;
} }
} }
sma->sem_otime = get_seconds(); sma->sem_otime = get_seconds();
......
...@@ -89,7 +89,7 @@ static inline void shm_inc (int id) { ...@@ -89,7 +89,7 @@ static inline void shm_inc (int id) {
if(!(shp = shm_lock(id))) if(!(shp = shm_lock(id)))
BUG(); BUG();
shp->shm_atim = get_seconds(); shp->shm_atim = get_seconds();
shp->shm_lprid = current->pid; shp->shm_lprid = current->tgid;
shp->shm_nattch++; shp->shm_nattch++;
shm_unlock(shp); shm_unlock(shp);
} }
...@@ -136,7 +136,7 @@ static void shm_close (struct vm_area_struct *shmd) ...@@ -136,7 +136,7 @@ static void shm_close (struct vm_area_struct *shmd)
/* remove from the list of attaches of the shm segment */ /* remove from the list of attaches of the shm segment */
if(!(shp = shm_lock(id))) if(!(shp = shm_lock(id)))
BUG(); BUG();
shp->shm_lprid = current->pid; shp->shm_lprid = current->tgid;
shp->shm_dtim = get_seconds(); shp->shm_dtim = get_seconds();
shp->shm_nattch--; shp->shm_nattch--;
if(shp->shm_nattch == 0 && if(shp->shm_nattch == 0 &&
...@@ -209,7 +209,7 @@ static int newseg (key_t key, int shmflg, size_t size) ...@@ -209,7 +209,7 @@ static int newseg (key_t key, int shmflg, size_t size)
if(id == -1) if(id == -1)
goto no_id; goto no_id;
shp->shm_cprid = current->pid; shp->shm_cprid = current->tgid;
shp->shm_lprid = 0; shp->shm_lprid = 0;
shp->shm_atim = shp->shm_dtim = 0; shp->shm_atim = shp->shm_dtim = 0;
shp->shm_ctim = get_seconds(); shp->shm_ctim = get_seconds();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment