OSDN Git Service

Rename hinfo -> dtable. Name the former dtable array 'fdtab'.
[pf3gnuchains/pf3gnuchains3x.git] / winsup / cygwin / debug.h
1 /* debug.h
2
3    Copyright 1998, 1999, 2000 Cygnus Solutions.
4
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
7 details. */
8
9 #ifndef MALLOC_DEBUG
10 #define MALLOC_CHECK do {} while (0)
11 #else
12 #define MALLOC_CHECK ({\
13   debug_printf ("checking malloc pool");\
14   (void)mallinfo ();\
15 })
16 #endif
17
18 extern "C" {
19 DWORD __stdcall WFSO (HANDLE, DWORD);
20 DWORD __stdcall WFMO (DWORD, CONST HANDLE *, BOOL, DWORD);
21 }
22
23 #define WaitForSingleObject WFSO
24 #define WaitForMultipleObject WFMO
25
26 #if !defined(_DEBUG_H_)
27 #define _DEBUG_H_
28
29 void threadname_init ();
30 HANDLE __stdcall makethread (LPTHREAD_START_ROUTINE, LPVOID, DWORD, const char *);
31 const char * __stdcall threadname (DWORD, int lockit = TRUE);
32 void __stdcall regthread (const char *, DWORD);
33 int __stdcall iscygthread ();
34
35 #ifndef DEBUGGING
36 # define ForceCloseHandle CloseHandle
37 # define ForceCloseHandle1(h, n) CloseHandle (h)
38 # define ForceCloseHandle2(h, n) CloseHandle (h)
39 # define ProtectHandle(h) do {} while (0)
40 # define ProtectHandle1(h,n) do {} while (0)
41 # define ProtectHandle2(h,n) do {} while (0)
42 # define debug_init() do {} while (0)
43
44 #else
45
46 # ifdef NO_DEBUG_DEFINES
47 #   undef NO_DEBUG_DEFINES
48 # else
49 #   define CloseHandle(h) \
50         close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, FALSE)
51 #   define ForceCloseHandle(h) \
52         close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, TRUE)
53 #   define ForceCloseHandle1(h,n) \
54         close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n, TRUE)
55 #   define ForceCloseHandle2(h,n) \
56         close_handle (__PRETTY_FUNCTION__, __LINE__, (h), n, TRUE)
57 #   define lock_pinfo_for_update(n) lpfu(__PRETTY_FUNCTION__, __LINE__, n)
58 # endif
59
60 # define ProtectHandle(h) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h)
61 # define ProtectHandle1(h,n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n)
62 # define ProtectHandle2(h,n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), n)
63
64 void debug_init ();
65 void __stdcall add_handle (const char *, int, HANDLE, const char *);
66 BOOL __stdcall close_handle (const char *, int, HANDLE, const char *, BOOL);
67 int __stdcall lpfu (const char *, int, DWORD timeout);
68
69 #endif /*DEBUGGING*/
70 #endif /*_DEBUG_H_*/