Index: pipe.h =================================================================== --- pipe.h (revision 229942) +++ pipe.h (working copy) @@ -138,5 +138,7 @@ struct pipepair { #define PIPE_UNLOCK(pipe) mtx_unlock(PIPE_MTX(pipe)) #define PIPE_LOCK_ASSERT(pipe, type) mtx_assert(PIPE_MTX(pipe), (type)) +#define PIPE_CNT(pipe) (((pipe)->pipe_state & PIPE_DIRECTW) ? \ + (pipe)->pipe_map.cnt : (pipe)->pipe_buffer.cnt) #endif /* !_SYS_PIPE_H_ */