Skip to content

Commit

Permalink
ipc/sem.c: store which operation blocks in perform_atomic_semop()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Michael Kerrisk <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
manfred-colorfu authored and torvalds committed Jun 6, 2014
1 parent d198cd6 commit ed247b7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ipc/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ struct sem_queue {
int pid; /* process id of requesting process */
int status; /* completion status of operation */
struct sembuf *sops; /* array of pending operations */
struct sembuf *blocking; /* the operation that blocked */
int nsops; /* number of operations */
int alter; /* does *sops alter the array? */
};
Expand Down Expand Up @@ -642,6 +643,8 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
goto undo;

would_block:
q->blocking = sop;

if (sop->sem_flg & IPC_NOWAIT)
result = -EAGAIN;
else
Expand Down

0 comments on commit ed247b7

Please sign in to comment.