1201472Sdavidxu/*- 2201472Sdavidxu * Copyright (c) 2010, David Xu <davidxu@freebsd.org> 3201472Sdavidxu * All rights reserved. 4201472Sdavidxu * 5201472Sdavidxu * Redistribution and use in source and binary forms, with or without 6201472Sdavidxu * modification, are permitted provided that the following conditions 7201472Sdavidxu * are met: 8201472Sdavidxu * 1. Redistributions of source code must retain the above copyright 9201472Sdavidxu * notice unmodified, this list of conditions, and the following 10201472Sdavidxu * disclaimer. 11201472Sdavidxu * 2. Redistributions in binary form must reproduce the above copyright 12201472Sdavidxu * notice, this list of conditions and the following disclaimer in the 13201472Sdavidxu * documentation and/or other materials provided with the distribution. 14201472Sdavidxu * 15201472Sdavidxu * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16201472Sdavidxu * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17201472Sdavidxu * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18201472Sdavidxu * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19201472Sdavidxu * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20201472Sdavidxu * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21201472Sdavidxu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22201472Sdavidxu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23201472Sdavidxu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24201472Sdavidxu * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25201472Sdavidxu * 26201472Sdavidxu * $FreeBSD$ 27201472Sdavidxu * 28201472Sdavidxu */ 29201472Sdavidxu 30201472Sdavidxu#ifndef _SYS__UMTX_H_ 31201472Sdavidxu#define _SYS__UMTX_H_ 32201472Sdavidxu 33201472Sdavidxu#include <sys/_types.h> 34232144Sdavidxu#include <sys/_timespec.h> 35201472Sdavidxu 36201472Sdavidxustruct umtx { 37201472Sdavidxu volatile unsigned long u_owner; /* Owner of the mutex. */ 38201472Sdavidxu}; 39201472Sdavidxu 40201472Sdavidxustruct umutex { 41201472Sdavidxu volatile __lwpid_t m_owner; /* Owner of the mutex */ 42201472Sdavidxu __uint32_t m_flags; /* Flags of the mutex */ 43201472Sdavidxu __uint32_t m_ceilings[2]; /* Priority protect ceiling */ 44201472Sdavidxu __uint32_t m_spare[4]; 45201472Sdavidxu}; 46201472Sdavidxu 47201472Sdavidxustruct ucond { 48201472Sdavidxu volatile __uint32_t c_has_waiters; /* Has waiters in kernel */ 49201472Sdavidxu __uint32_t c_flags; /* Flags of the condition variable */ 50216641Sdavidxu __uint32_t c_clockid; /* Clock id */ 51216641Sdavidxu __uint32_t c_spare[1]; /* Spare space */ 52201472Sdavidxu}; 53201472Sdavidxu 54201472Sdavidxustruct urwlock { 55201472Sdavidxu volatile __int32_t rw_state; 56201472Sdavidxu __uint32_t rw_flags; 57201472Sdavidxu __uint32_t rw_blocked_readers; 58201472Sdavidxu __uint32_t rw_blocked_writers; 59201472Sdavidxu __uint32_t rw_spare[4]; 60201472Sdavidxu}; 61201472Sdavidxu 62201472Sdavidxustruct _usem { 63201472Sdavidxu volatile __uint32_t _has_waiters; 64201472Sdavidxu volatile __uint32_t _count; 65201472Sdavidxu __uint32_t _flags; 66201472Sdavidxu}; 67201472Sdavidxu 68232144Sdavidxustruct _umtx_time { 69232144Sdavidxu struct timespec _timeout; 70232144Sdavidxu __uint32_t _flags; 71232144Sdavidxu __uint32_t _clockid; 72232144Sdavidxu}; 73232144Sdavidxu 74201472Sdavidxu#endif /* !_SYS__UMTX_H_ */ 75