diff options
| author | Manfred Spraul <manfred@colorfullife.com> | 2014-06-06 17:37:49 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-06 19:08:15 -0400 |
| commit | ed247b7ca0d20b4528eec362f8435594818d7601 (patch) | |
| tree | 1ad0072dbfabf441a1aa84b328229b8f09ea6cae | |
| parent | d198cd6d6d02d0a335af2deacb60816ebb4719d1 (diff) | |
ipc/sem.c: store which operation blocks in perform_atomic_semop()
Preparation for the next patch:
In the slow-path of perform_atomic_semop(), store a pointer to the
operation that caused the operation to block.
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | ipc/sem.c | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -109,6 +109,7 @@ struct sem_queue { | |||
| 109 | int pid; /* process id of requesting process */ | 109 | int pid; /* process id of requesting process */ |
| 110 | int status; /* completion status of operation */ | 110 | int status; /* completion status of operation */ |
| 111 | struct sembuf *sops; /* array of pending operations */ | 111 | struct sembuf *sops; /* array of pending operations */ |
| 112 | struct sembuf *blocking; /* the operation that blocked */ | ||
| 112 | int nsops; /* number of operations */ | 113 | int nsops; /* number of operations */ |
| 113 | int alter; /* does *sops alter the array? */ | 114 | int alter; /* does *sops alter the array? */ |
| 114 | }; | 115 | }; |
| @@ -642,6 +643,8 @@ out_of_range: | |||
| 642 | goto undo; | 643 | goto undo; |
| 643 | 644 | ||
| 644 | would_block: | 645 | would_block: |
| 646 | q->blocking = sop; | ||
| 647 | |||
| 645 | if (sop->sem_flg & IPC_NOWAIT) | 648 | if (sop->sem_flg & IPC_NOWAIT) |
| 646 | result = -EAGAIN; | 649 | result = -EAGAIN; |
| 647 | else | 650 | else |
