signal cleanup fix
[gnupg.git] / common / sysutils.h
blobfd4340f3de8298bd682baa3e12b041d1e46888eb
1 /* sysutils.h - System utility functions for Gnupg
2 * Copyright (C) 2002 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef GNUPG_COMMON_SYSUTILS_H
21 #define GNUPG_COMMON_SYSUTILS_H
23 /* Because we use system handles and not libc low level file
24 descriptors on W32, we need to declare them as HANDLE (which
25 actually is a plain pointer). This is required to eventually
26 support 64 bits Windows systems. */
27 #ifdef HAVE_W32_SYSTEM
28 typedef void *gnupg_fd_t;
29 #define GNUPG_INVALID_FD ((void*)(-1))
30 #define INT2FD(s) ((void *)(s))
31 #define FD2INT(h) ((unsigned int)(h))
32 #else
33 typedef int gnupg_fd_t;
34 #define GNUPG_INVALID_FD (-1)
35 #define INT2FD(s) (s)
36 #define FD2INT(h) (h)
37 #endif
40 void trap_unaligned (void);
41 int disable_core_dumps (void);
42 int enable_core_dumps (void);
43 const unsigned char *get_session_marker (size_t *rlen);
44 /*int check_permissions (const char *path,int extension,int checkonly);*/
45 void gnupg_sleep (unsigned int seconds);
46 int translate_sys2libc_fd (gnupg_fd_t fd, int for_write);
47 int translate_sys2libc_fd_int (int fd, int for_write);
48 FILE *gnupg_tmpfile (void);
49 void gnupg_reopen_std (const char *pgmname);
50 void gnupg_allow_set_foregound_window (pid_t pid);
53 #ifdef HAVE_W32_SYSTEM
55 #include "../jnlib/w32help.h"
57 #endif /*HAVE_W32_SYSTEM*/
59 #endif /*GNUPG_COMMON_SYSUTILS_H*/