OSDN Git Service

* Makefile.in: Add -lntdll to link line.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygserver / woutsup.h
1 /* woutsup.h: for Cygwin code compiled outside the DLL (i.e. cygserver).
2
3    Copyright 2002, 2003, 2007 Red Hat, Inc.
4
5 This file is part of Cygwin.
6
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
9 details. */
10
11 #define _MT_SAFE 1
12
13 #ifdef __INSIDE_CYGWIN__
14 #error "woutsup.h is not for code being compiled inside the dll"
15 #endif
16
17 #ifndef _WIN32_WINNT
18 #define _WIN32_WINNT 0x0500
19 #endif
20
21 #if _WIN32_WINNT < 0x0500
22 #undef _WIN32_WINNT
23 #define _WIN32_WINNT 0x0500
24 #endif
25
26 #define WIN32_LEAN_AND_MEAN 1
27 #define _WINGDI_H
28 #define _WINUSER_H
29 #define _WINNLS_H
30 #define _WINVER_H
31 #define _WINNETWK_H
32 #define _WINSVC_H
33 #include <windows.h>
34 #include <wincrypt.h>
35 #include <lmcons.h>
36 #undef _WINGDI_H
37 #undef _WINUSER_H
38 #undef _WINNLS_H
39 #undef _WINVER_H
40 #undef _WINNETWK_H
41 #undef _WINSVC_H
42
43 #include "bsd_helper.h"
44 #include "bsd_log.h"
45 #include "bsd_mutex.h"
46
47 /* The one function we use from winuser.h most of the time */
48 extern "C" DWORD WINAPI GetLastError (void);
49
50 extern int cygserver_running;
51
52 #define SIGHANDLE(SIG)                                                  \
53   do                                                                    \
54     {                                                                   \
55       struct sigaction act;                                             \
56                                                                         \
57       act.sa_handler = &handle_signal;                                  \
58       act.sa_mask = 0;                                                  \
59       act.sa_flags = 0;                                                 \
60                                                                         \
61       if (sigaction (SIG, &act, NULL) == -1)                            \
62         {                                                               \
63           panic ("failed to install handler for " #SIG ": %s",          \
64                  strerror (errno));                                     \
65           exit (1);                                                     \
66         }                                                               \
67     } while (false)
68
69 #define debug_printf(f,...)     debug((f),##__VA_ARGS__)
70 #define syscall_printf(f,...)   log(LOG_ERR,(f),##__VA_ARGS__)
71 #define system_printf(f,...)    log(LOG_ERR,(f),##__VA_ARGS__)