Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2020 08:16:46 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r367835 - head/sys/kern
Message-ID:  <202011190816.0AJ8GkS5073485@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Thu Nov 19 08:16:45 2020
New Revision: 367835
URL: https://svnweb.freebsd.org/changeset/base/367835

Log:
  pipe: tidy up pipelock

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==============================================================================
--- head/sys/kern/sys_pipe.c	Thu Nov 19 07:23:39 2020	(r367834)
+++ head/sys/kern/sys_pipe.c	Thu Nov 19 08:16:45 2020	(r367835)
@@ -614,14 +614,17 @@ pipespace(struct pipe *cpipe, int size)
 static __inline int
 pipelock(struct pipe *cpipe, int catch)
 {
-	int error;
+	int error, prio;
 
 	PIPE_LOCK_ASSERT(cpipe, MA_OWNED);
+
+	prio = PRIBIO;
+	if (catch)
+		prio |= PCATCH;
 	while (cpipe->pipe_state & PIPE_LOCKFL) {
 		cpipe->pipe_state |= PIPE_LWANT;
 		error = msleep(cpipe, PIPE_MTX(cpipe),
-		    catch ? (PRIBIO | PCATCH) : PRIBIO,
-		    "pipelk", 0);
+		    prio, "pipelk", 0);
 		if (error != 0)
 			return (error);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011190816.0AJ8GkS5073485>