2002-01-19 20:58:41 +00:00
|
|
|
/* sysutils.h - System utility functions for Gnupg
|
|
|
|
* Copyright (C) 2002 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
*
|
Change license for some files in common to LGPLv3+/GPLv2+.
Having the LGPL on the common GnuPG code helps to share code
between GnuPG and related projects (like GPGME and Libassuan). This
is good for interoperability and to reduces bugs.
* common/asshelp.c, common/asshelp.h, common/asshelp2.c, common/b64dec.c
* common/b64enc.c, common/convert.c, common/dns-cert.c
* common/dns-cert.h common/exechelp-posix.c, common/exechelp-w32.c
* common/exechelp-w32ce.c, common/exechelp.h, common/get-passphrase.c
* common/get-passphrase.h, common/gettime.c, common/gpgrlhelp.c
* common/helpfile.c, common/homedir.c, common/http.c, common/http.h
* common/i18n.c, common/init.c, common/init.h, common/iobuf.c
* common/iobuf.h, common/localename.c, common/membuf.c, common/membuf.h
* common/miscellaneous.c, common/openpgp-oid.c, common/openpgpdefs.h
* common/percent.c, common/pka.c, common/pka.h, common/session-env.c
* common/session-env.h, common/sexp-parse.h, common/sexputil.c
* common/signal.c, common/srv.c, common/srv.h, common/ssh-utils.c
* common/ssh-utils.h, common/sysutils.c, common/sysutils.h
* common/tlv.c, common/tlv.h, common/ttyio.c, common/ttyio.h
* common/userids.c, common/userids.h, common/xasprintf.c: Change
license to LGPLv3+/GPLv2+/
2012-04-20 15:43:06 +02:00
|
|
|
* This file is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of either
|
2002-01-19 20:58:41 +00:00
|
|
|
*
|
Change license for some files in common to LGPLv3+/GPLv2+.
Having the LGPL on the common GnuPG code helps to share code
between GnuPG and related projects (like GPGME and Libassuan). This
is good for interoperability and to reduces bugs.
* common/asshelp.c, common/asshelp.h, common/asshelp2.c, common/b64dec.c
* common/b64enc.c, common/convert.c, common/dns-cert.c
* common/dns-cert.h common/exechelp-posix.c, common/exechelp-w32.c
* common/exechelp-w32ce.c, common/exechelp.h, common/get-passphrase.c
* common/get-passphrase.h, common/gettime.c, common/gpgrlhelp.c
* common/helpfile.c, common/homedir.c, common/http.c, common/http.h
* common/i18n.c, common/init.c, common/init.h, common/iobuf.c
* common/iobuf.h, common/localename.c, common/membuf.c, common/membuf.h
* common/miscellaneous.c, common/openpgp-oid.c, common/openpgpdefs.h
* common/percent.c, common/pka.c, common/pka.h, common/session-env.c
* common/session-env.h, common/sexp-parse.h, common/sexputil.c
* common/signal.c, common/srv.c, common/srv.h, common/ssh-utils.c
* common/ssh-utils.h, common/sysutils.c, common/sysutils.h
* common/tlv.c, common/tlv.h, common/ttyio.c, common/ttyio.h
* common/userids.c, common/userids.h, common/xasprintf.c: Change
license to LGPLv3+/GPLv2+/
2012-04-20 15:43:06 +02:00
|
|
|
* - the GNU Lesser General Public License as published by the Free
|
|
|
|
* Software Foundation; either version 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* or
|
|
|
|
*
|
|
|
|
* - the GNU General Public License as published by the Free
|
|
|
|
* Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* or both in parallel, as here.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful,
|
2002-01-19 20:58:41 +00:00
|
|
|
* 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
|
2016-11-05 12:02:19 +01:00
|
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
2002-01-19 20:58:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNUPG_COMMON_SYSUTILS_H
|
|
|
|
#define GNUPG_COMMON_SYSUTILS_H
|
|
|
|
|
2007-07-12 15:28:30 +00: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 14:48:39 +00:00
|
|
|
#define INT2FD(s) ((void *)(s))
|
|
|
|
#define FD2INT(h) ((unsigned int)(h))
|
2007-07-12 15:28:30 +00:00
|
|
|
#else
|
|
|
|
typedef int gnupg_fd_t;
|
|
|
|
#define GNUPG_INVALID_FD (-1)
|
2007-10-01 14:48:39 +00:00
|
|
|
#define INT2FD(s) (s)
|
|
|
|
#define FD2INT(h) (h)
|
2007-07-12 15:28:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-01-19 20:58:41 +00:00
|
|
|
void trap_unaligned (void);
|
|
|
|
int disable_core_dumps (void);
|
2004-05-11 09:54:52 +00:00
|
|
|
int enable_core_dumps (void);
|
2016-11-29 16:18:24 +01:00
|
|
|
void enable_special_filenames (void);
|
2002-01-19 20:58:41 +00: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 13:48:44 +00:00
|
|
|
/*int check_permissions (const char *path,int extension,int checkonly);*/
|
2007-06-20 11:16:42 +00:00
|
|
|
void gnupg_sleep (unsigned int seconds);
|
2016-10-31 12:20:33 +01:00
|
|
|
void gnupg_usleep (unsigned int usecs);
|
2007-07-12 15:28:30 +00:00
|
|
|
int translate_sys2libc_fd (gnupg_fd_t fd, int for_write);
|
|
|
|
int translate_sys2libc_fd_int (int fd, int for_write);
|
2016-11-29 16:18:24 +01:00
|
|
|
int check_special_filename (const char *fname, int for_write, int notranslate);
|
2007-08-22 10:55:07 +00:00
|
|
|
FILE *gnupg_tmpfile (void);
|
2007-12-03 13:05:15 +00:00
|
|
|
void gnupg_reopen_std (const char *pgmname);
|
2020-01-13 15:20:49 +01:00
|
|
|
void gnupg_inhibit_set_foregound_window (int yes);
|
2008-02-14 19:50:10 +00:00
|
|
|
void gnupg_allow_set_foregound_window (pid_t pid);
|
2010-03-24 12:15:30 +00:00
|
|
|
int gnupg_remove (const char *fname);
|
2016-11-16 17:43:59 +01:00
|
|
|
gpg_error_t gnupg_rename_file (const char *oldname, const char *newname,
|
|
|
|
int *block_signals);
|
2017-07-25 12:24:01 +02:00
|
|
|
int gnupg_mkdir (const char *name, const char *modestr);
|
|
|
|
int gnupg_chdir (const char *name);
|
2016-04-20 14:55:45 +02:00
|
|
|
int gnupg_chmod (const char *name, const char *modestr);
|
2014-11-11 15:14:31 +01:00
|
|
|
char *gnupg_mkdtemp (char *template);
|
2010-04-14 11:24:02 +00:00
|
|
|
int gnupg_setenv (const char *name, const char *value, int overwrite);
|
|
|
|
int gnupg_unsetenv (const char *name);
|
2014-04-15 16:40:48 +02:00
|
|
|
char *gnupg_getcwd (void);
|
2016-10-26 16:37:07 -04:00
|
|
|
char *gnupg_get_socket_name (int fd);
|
2017-02-08 13:49:41 +01:00
|
|
|
int gnupg_fd_valid (int fd);
|
2002-01-19 20:58:41 +00:00
|
|
|
|
2017-06-23 13:20:42 +02:00
|
|
|
gpg_error_t gnupg_inotify_watch_delete_self (int *r_fd, const char *fname);
|
2016-10-15 21:35:05 +02:00
|
|
|
gpg_error_t gnupg_inotify_watch_socket (int *r_fd, const char *socket_name);
|
|
|
|
int gnupg_inotify_has_name (int fd, const char *name);
|
|
|
|
|
|
|
|
|
2004-12-15 14:15:54 +00:00
|
|
|
#ifdef HAVE_W32_SYSTEM
|
2014-03-07 09:46:44 +01:00
|
|
|
void *w32_get_user_sid (void);
|
2004-12-20 16:17:25 +00:00
|
|
|
|
2010-03-10 12:24:58 +00:00
|
|
|
#include "../common/w32help.h"
|
2004-12-20 16:17:25 +00:00
|
|
|
|
2004-12-15 14:15:54 +00:00
|
|
|
#endif /*HAVE_W32_SYSTEM*/
|
2002-01-19 20:58:41 +00:00
|
|
|
|
|
|
|
#endif /*GNUPG_COMMON_SYSUTILS_H*/
|