18564292ac4b9adf51c45517cca2878732feb5bb4sewardj/*
286562bd89ac23ce795d19c71fabcb9d1c8f956d3bart  This file is part of drd, a thread error detector.
38564292ac4b9adf51c45517cca2878732feb5bb4sewardj
4d4bab99f83dbc53665c5769c3f6b50ffcd2a9a7dbart  Copyright (C) 2006-2013 Bart Van Assche <bvanassche@acm.org>.
58564292ac4b9adf51c45517cca2878732feb5bb4sewardj
68564292ac4b9adf51c45517cca2878732feb5bb4sewardj  This program is free software; you can redistribute it and/or
78564292ac4b9adf51c45517cca2878732feb5bb4sewardj  modify it under the terms of the GNU General Public License as
88564292ac4b9adf51c45517cca2878732feb5bb4sewardj  published by the Free Software Foundation; either version 2 of the
98564292ac4b9adf51c45517cca2878732feb5bb4sewardj  License, or (at your option) any later version.
108564292ac4b9adf51c45517cca2878732feb5bb4sewardj
118564292ac4b9adf51c45517cca2878732feb5bb4sewardj  This program is distributed in the hope that it will be useful, but
128564292ac4b9adf51c45517cca2878732feb5bb4sewardj  WITHOUT ANY WARRANTY; without even the implied warranty of
138564292ac4b9adf51c45517cca2878732feb5bb4sewardj  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
148564292ac4b9adf51c45517cca2878732feb5bb4sewardj  General Public License for more details.
158564292ac4b9adf51c45517cca2878732feb5bb4sewardj
168564292ac4b9adf51c45517cca2878732feb5bb4sewardj  You should have received a copy of the GNU General Public License
178564292ac4b9adf51c45517cca2878732feb5bb4sewardj  along with this program; if not, write to the Free Software
188564292ac4b9adf51c45517cca2878732feb5bb4sewardj  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
198564292ac4b9adf51c45517cca2878732feb5bb4sewardj  02111-1307, USA.
208564292ac4b9adf51c45517cca2878732feb5bb4sewardj
218564292ac4b9adf51c45517cca2878732feb5bb4sewardj  The GNU General Public License is contained in the file COPYING.
228564292ac4b9adf51c45517cca2878732feb5bb4sewardj*/
238564292ac4b9adf51c45517cca2878732feb5bb4sewardj
248564292ac4b9adf51c45517cca2878732feb5bb4sewardj
258564292ac4b9adf51c45517cca2878732feb5bb4sewardj// Semaphore state information: owner thread and recursion count.
268564292ac4b9adf51c45517cca2878732feb5bb4sewardj
278564292ac4b9adf51c45517cca2878732feb5bb4sewardj
2828230a3734e045791173aca660efc7d7aeef78cebart#ifndef __DRD_SEMAPHORE_H
2928230a3734e045791173aca660efc7d7aeef78cebart#define __DRD_SEMAPHORE_H
308564292ac4b9adf51c45517cca2878732feb5bb4sewardj
318564292ac4b9adf51c45517cca2878732feb5bb4sewardj
328564292ac4b9adf51c45517cca2878732feb5bb4sewardj#include "drd_thread.h"           // DrdThreadId
330268dfacec38138a01a58d05a038826e26b6c436bart#include "pub_tool_basics.h"      // Addr
348564292ac4b9adf51c45517cca2878732feb5bb4sewardj
358564292ac4b9adf51c45517cca2878732feb5bb4sewardj
368564292ac4b9adf51c45517cca2878732feb5bb4sewardjstruct semaphore_info;
378564292ac4b9adf51c45517cca2878732feb5bb4sewardj
388564292ac4b9adf51c45517cca2878732feb5bb4sewardj
39dc1ef03a8d13efe24661a89091e66169bf3f1091bartvoid DRD_(semaphore_set_trace)(const Bool trace_semaphore);
40dc1ef03a8d13efe24661a89091e66169bf3f1091bartstruct semaphore_info* DRD_(semaphore_init)(const Addr semaphore,
41dc1ef03a8d13efe24661a89091e66169bf3f1091bart                                            const Word pshared,
42dc1ef03a8d13efe24661a89091e66169bf3f1091bart                                            const UInt value);
43dc1ef03a8d13efe24661a89091e66169bf3f1091bartvoid DRD_(semaphore_destroy)(const Addr semaphore);
4425f9f5411f64046c2ffc0822f727aedc21f07720bartstruct semaphore_info* DRD_(semaphore_open)(const Addr semaphore,
4519f91bbaedb4caef8a60ce94b0f507193cc0bc10florian                                            const HChar* name, const Word oflag,
4625f9f5411f64046c2ffc0822f727aedc21f07720bart                                            const Word mode, const UInt value);
4725f9f5411f64046c2ffc0822f727aedc21f07720bartvoid DRD_(semaphore_close)(const Addr semaphore);
48dc1ef03a8d13efe24661a89091e66169bf3f1091bartvoid DRD_(semaphore_pre_wait)(const Addr semaphore);
49dc1ef03a8d13efe24661a89091e66169bf3f1091bartvoid DRD_(semaphore_post_wait)(const DrdThreadId tid, const Addr semaphore,
50dc1ef03a8d13efe24661a89091e66169bf3f1091bart                               const Bool waited);
51dc1ef03a8d13efe24661a89091e66169bf3f1091bartvoid DRD_(semaphore_pre_post)(const DrdThreadId tid, const Addr semaphore);
52dc1ef03a8d13efe24661a89091e66169bf3f1091bartvoid DRD_(semaphore_post_post)(const DrdThreadId tid, const Addr semaphore,
53dc1ef03a8d13efe24661a89091e66169bf3f1091bart                               const Bool waited);
54dc1ef03a8d13efe24661a89091e66169bf3f1091bartULong DRD_(get_semaphore_segment_creation_count)(void);
558564292ac4b9adf51c45517cca2878732feb5bb4sewardj
568564292ac4b9adf51c45517cca2878732feb5bb4sewardj
5728230a3734e045791173aca660efc7d7aeef78cebart#endif /* __DRD_SEMAPHORE_H */
58