2002-01-19 21:58:41 +01:00
|
|
|
/* sysutils.h - System utility functions for Gnupg
|
|
|
|
* Copyright (C) 2002 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
*
|
|
|
|
* GnuPG is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-04 21:49:40 +02:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-01-19 21:58:41 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GnuPG is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-04 21:49:40 +02:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2002-01-19 21:58:41 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNUPG_COMMON_SYSUTILS_H
|
|
|
|
#define GNUPG_COMMON_SYSUTILS_H
|
|
|
|
|
2007-07-12 17:28:30 +02:00
|
|
|
/* Because we use system handles and not libc low level file
|
|
|
|
descriptors on W32, we need to declare them as HANDLE (which
|
|
|
|
actually is a plain pointer). This is required to eventually
|
|
|
|
support 64 bits Windows systems. */
|
|
|
|
#ifdef HAVE_W32_SYSTEM
|
|
|
|
typedef void *gnupg_fd_t;
|
|
|
|
#define GNUPG_INVALID_FD ((void*)(-1))
|
2007-10-01 16:48:39 +02:00
|
|
|
#define INT2FD(s) ((void *)(s))
|
|
|
|
#define FD2INT(h) ((unsigned int)(h))
|
2007-07-12 17:28:30 +02:00
|
|
|
#else
|
|
|
|
typedef int gnupg_fd_t;
|
|
|
|
#define GNUPG_INVALID_FD (-1)
|
2007-10-01 16:48:39 +02:00
|
|
|
#define INT2FD(s) (s)
|
|
|
|
#define FD2INT(h) (h)
|
2007-07-12 17:28:30 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-01-19 21:58:41 +01:00
|
|
|
void trap_unaligned (void);
|
|
|
|
int disable_core_dumps (void);
|
2004-05-11 11:54:52 +02:00
|
|
|
int enable_core_dumps (void);
|
2002-01-19 21:58:41 +01:00
|
|
|
const unsigned char *get_session_marker (size_t *rlen);
|
2011-04-12 16:30:08 +02:00
|
|
|
unsigned int get_uint_nonce (void);
|
2007-06-26 15:48:44 +02:00
|
|
|
/*int check_permissions (const char *path,int extension,int checkonly);*/
|
2007-06-20 13:16:42 +02:00
|
|
|
void gnupg_sleep (unsigned int seconds);
|
2007-07-12 17:28:30 +02:00
|
|
|
int translate_sys2libc_fd (gnupg_fd_t fd, int for_write);
|
|
|
|
int translate_sys2libc_fd_int (int fd, int for_write);
|
2007-08-22 12:55:07 +02:00
|
|
|
FILE *gnupg_tmpfile (void);
|
2007-12-03 14:05:15 +01:00
|
|
|
void gnupg_reopen_std (const char *pgmname);
|
2008-02-14 20:50:10 +01:00
|
|
|
void gnupg_allow_set_foregound_window (pid_t pid);
|
2010-03-24 13:15:30 +01:00
|
|
|
int gnupg_remove (const char *fname);
|
2010-04-14 13:24:02 +02:00
|
|
|
int gnupg_mkdir (const char *name, const char *modestr);
|
|
|
|
int gnupg_setenv (const char *name, const char *value, int overwrite);
|
|
|
|
int gnupg_unsetenv (const char *name);
|
2002-01-19 21:58:41 +01:00
|
|
|
|
2004-12-15 15:15:54 +01:00
|
|
|
#ifdef HAVE_W32_SYSTEM
|
2004-12-20 17:17:25 +01:00
|
|
|
|
2010-03-10 13:24:58 +01:00
|
|
|
#include "../common/w32help.h"
|
2004-12-20 17:17:25 +01:00
|
|
|
|
2004-12-15 15:15:54 +01:00
|
|
|
#endif /*HAVE_W32_SYSTEM*/
|
2002-01-19 21:58:41 +01:00
|
|
|
|
|
|
|
#endif /*GNUPG_COMMON_SYSUTILS_H*/
|