| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/sysutils.c (any8bitchar): Remove.
(_gpgrt_fname_to_wchar): New.
(_gpgrt_mkdir): Use instead of plain utf8 conversion.
(_gpgrt_access): Reimplement using GetFileAttributesW so that long
files names are supported.
* src/estream.c (_gpgrt_w32_get_last_err_code): New.
(func_file_create_w32): New.
(_gpgrt_fopen): Handle the "sysopen" mode flag. Support mapping of
/dev/null.
(_gpgrt_freopen): Support mapping of /dev/null.
* src/w32-gettext.c (load_domain): Allow long file names.
* src/visibility.c (gpgrt_free_wchar): Make function public.
(gpgrt_fname_to_wchar): Ditto.
(gpgrt_utf8_to_wchar): Ditto.
(gpgrt_wchar_to_utf8): Ditto.
* src/w32-add.h (gpgrt_free_wchar): New prototype.
(gpgrt_fname_to_wchar): Ditto.
(gpgrt_utf8_to_wchar): Ditto.
(gpgrt_wchar_to_utf8): Ditto.
* src/gpg-error.def.in: Add them here too.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_access): New.
* src/gpg-error.vers. src/gpg-error.def.in: Add new function.
* src/sysutils.c (any8bitchar): New.
(_gpgrt_access): New.
* src/visibility.c (gpgrt_access): New.
* src/spawn-w32.c (_gpgrt_spawn_process_detached): Use it.
* src/argparse.c (try_versioned_conffile): Use it.
* tests/t-stringutils.c (check_access): New simple test.
--
This is basically a wrapper to allow handling of utf8 encoded file
names on Windows. This also fixes the case for versioned config files
in directories with non-ascii characters.
The new test needs to be run manually on Windows using a directory
with Unicode characters.
GnuPG-bug-id: 5098
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/estream.c (do_close): Add arg 'cancel_mode' and chnage all
callers.
(_gpgrt_fcancel): New.
* src/gpg-error.def.in, src/gpg-error.vers: Add function.
* src/visibility.c (gpgrt_fcancel): New.
* src/gpg-error.h.in (gpgrt_fcancel): New.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/init.c (_gpgrt_reallocarray): New.
* src/visibility.c (gpgrt_reallocarray): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add new function.
* src/gpg-error.h.in: Add new interface.
* tests/t-malloc.c: New.
* tests/Makefile.am (TESTS): Add new test.
--
Note that this function is different from the glibc function because
it has an extra parameter which allows to clear the new elements. A
realloc after a calloc with forgotten memset after it is a common
source of error, thus we introduce this slightly different function.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gpg-error.h.in (GPGRT_CONFDIR_USER, GPGRT_CONFDIR_SYS): New consts.
(ARGPARSE_FLAG_SYS, ARGPARSE_FLAG_USER, ARGPARSE_FLAG_VERBOSE)
(ARGPARSE_NO_CONFFILE, ARGPARSE_CONFFILE, ARGPARSE_OPT_CONFFILE): New
consts.
(ARGPARSE_conffile, ARGPARSE_noconffile): New macros.
(gpgrt_set_confdir): New func.
(gpgrt_argparser): New func.
* src/argparse.c (confdir): New var.
(enum argparser_states): New.
(struct _gpgrt_argparse_internal_s): Add a couple of new fields.
(initialize): Init them.
(any_opt_conffile): New.
(_gpgrt_argparser): New.
(_gpgrt_set_confdir): New.
* src/visibility.c (gpgrt_argparser): New.
(gpgrt_set_confdir): New.
* src/gpg-error.def.in, src/gpg-error.vers: Add those functions.
* tests/t-argparse.c (main): Reworked.
* tests/etc/t-argparse.conf: New file.
* tests/t-argparse.conf: New file.
--
gpgrt_argparser is a high level version of gpgrt_argparse. It handles
reading of configuration files internally and allows allows for a
global configuration file. The design is so that it minimizes the
work to replace the existing option parsing in gpg and friends by this
one and to allow global configuration files for them.
This is the just the basic code which should allow replacement of the
parsers. A forthcoming patch will implement flags for options given
in the global config file.
GnuPG-bug-id: 4788
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_fnameconcat): New.
(gpgrt_absfnameconcat): New.
* src/visibility.c (gpgrt_fnameconcat, gpgrt_absfnameconcat): New.
* src/stringutils.c: New file.
(_gpgrt_vfnameconcat): New.
(_gpgrt_fnameconcat, _gpgrt_absfnameconcat): New.
* src/gpg-error.def.in: Add new functions.
* src/gpg-error.vers: Ditto.
* src/sysutils.c: Include pwd.h.
(_gpgrt_getpwdir): New.
* configure.ac: Test for pwd.h, getpwnam, getpwuid, and their _r
variants.
* src/Makefile.am (libgpg_error_la_SOURCES): Add new file.
* tests/t-stringutils.c: New.
* tests/t-common.h (xmalloc, xstrdup, xfree): New.
(die): Kludge to avoid compiler warnings.
--
The new functions are based on the code of make_filename from GnuPG.
They have been written by me ages ago with only minor modifications by
David Shaw. I re-license them from LGPL-3.0+ OR GPL-2.0+ to
LGPL-2.1-or-later.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/init.c (emergency_cleanup_list): New gloabl var.
(_gpgrt_add_emergency_cleanup): New.
(_gpgrt_abort): New. Repalce all calls to abort by this. Also replace
all assert by either log_assert or a stderr output followed by a
_gpgrt_abort.
(run_emergency_cleanup): New.
* src/visibility.c (gpgrt_add_emergency_cleanup): New public API.
(gpgrt_abort): New public API.
--
Libgcrypt uses its own assert function which makes sure to terminate
the secure memory. This is safe as log as an assert is triggered
internally in Libgcrypt. GnuPG runs emergency cleanup handlers right
before log_fatal etc to tell Libgcrypt to terminate the secure memory.
With the move of the logging function to gpgrt in gnupg 2.3 this did
not anymore. Thus we now provide a mechanism in gpgrt to do right
that. Eventually Libgcrypt can also make use of this.
What this does not handle are calls to abort or failed asserts in
external libraries or in libc. We can't do anything about it in a
library because a library may not setup signal handlers.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_string_filter_t): New type.
(gpgrt_fprintf_sf, gpgrt_fprintf_sf_unlocked): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add them.
* src/visibility.c (gpgrt_fprintf_sf): New.
(gpgrt_fprintf_sf_unlocked): New.
* src/estream-printf.c (pr_string): Add and use args sf, sfvalue and
string_no.
(do_format): Add args sf and sfvalue. Keep a string format counter.
(_gpgrt_estream_format): Add args sf and sfvalue. Change all callers
to provide NULL for them.
* src/estream.c (_gpgrt_vfprintf_unlocked, _gpgrt_vfprintf): Add sf
and sfvalue and adjust all callers.
(do_print_stream): Ditto.
* tests/t-printf.c (stream_to_string): New.
(struct sfstate_s): New.
(string_filter): New.
(check_fprintf_sf): New.
(main): Call new test.
--
The actual reason to implement these functions is to enhance the
internal logging function with a filter to sanitized strings so that
control values or other things can be quoted.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_ftruncate, es_ftruncate): New.
* src/gpg-error.def.in, src/gpg-error.vers: Add gpgrt_ftruncate.
* src/visibility.c (gpgrt_ftruncate): new.
* src/gpgrt-int.h (COOKIE_IOCTL_TRUNCATE): New.
* src/estream.c (func_mem_ioctl): Support new internal IOCTL.
(_gpgrt_ftruncate): New.
--
Right now the ftruncate works only on memory streams. Can easily be
added to other stream times.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in: New API gpgrt_cmp_version.
* src/visibility.c (gpgrt_cmp_version): New wrapper.
* src/version.c (parse_version_string): Revamped.
(do_cmp_version): New.
(_gpgrt_cmp_version): New.
(_gpg_error_check_version): Re-implemented using the new func.
* tests/t-version.c: Include t-common.h.
(t_gpgrt_cmp_version): New test.
(main): Run new test. Change test for new version number to require a
2 level number.
--
We have implementations of very similar functions in all out libs.
Thus it makes sense to provide a generic version. This version is
actually derived from the ftp-indexer.c we use for the gnupg
website (see the gnupg-doc repo).
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/b64enc.c: Change to fit into libgpg-error.
* src/Makefile.am: Add b64enc.c
* src/b64dec.c: Use xtrymalloc etc. Always use gpg_err_code_t.
(_gpgrt_b64dec_start): Set decoder flag
(_gpgrt_b64dec_finish): Check for conflict.
(_gpgrt_b64state): Move to ...
* src/gpgrt-int.h: here. Add new fields.
* src/visibility.c (gpgrt_b64enc_start): New.
(gpgrt_b64enc_write): New.
(gpgrt_b64enc_finish): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add new functions.
* src/gpg-error.h.in: Ditto.
* src/visibility.h: Ditto.
* tests/t-b64dec.c: Remove.
* tests/t-b64.c: New.
* tests/Makefile.am (TESTS): Replace t-b64dec by t-b64.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_usage): New.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_argparse): New.
(gpgrt_strusage): New.
(gpgrt_set_strusage): New.
(gpgrt_set_usage_outfnc): New.
(gpgrt_set_fixed_string_mapper): New.
* src/gpg-error.def.in, src/gpg-error.vers: Add new functions.
* src/gpg-error.h.in: Add ARGPARSE macros from the former argparse.h.
(gpgrt_argparse_t): New.
(gpgrt_opt_t): New.
* configure.ac (AH_BOTTOM): Request argparse macros.
* src/Makefile.am (libgpg_error_la_SOURCES): Add argparse.c.
* src/argparse.h: Remove.
* src/argparse.c: Revamp to fit into libgpg-error.
(_gpgrt_argparse): New.
(_gpgrt_usage): Rename from usage.
(_gpgrt_strusage): Rename from strusage. Define two new levels and
templates for three common licenses.
(_gpgrt_set_strusage): Rename from set_strusage.
(_gpgrt_set_usage_outfnc): New.
(_gpgrt_set_fixed_string_mapper): New.
* tests/t-argparse.c: New.
--
These functions are in use by GnuPG and other software for 20 years
and it makes sense to have them always available instead of copying
and maintaing the source in several projects. Note that there are
minor changes in the API compared to GnuPG.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
| |
--
We may need to change the API and thus we better wait before
publishing this new interface.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gprt_log_levels): Rename to GPGRT_LOGLVL.
--
Explicitly naming them and not distinguishing them from the other log
constants is a Good Thing anyway. It also helps against the symbol name
clash with the GPGRT enum values from gnupg's logging module.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (GPGRT_SPAWN_NONBLOCK): New const.
(GPGRT_SPAWN_RUN_ASFW): New const.
(GPGRT_SPAWN_DETACHED): New const.
(gpgrt_make_pipe): New function.
(gpgrt_create_pipe): New macro.
(gpgrt_create_inbound_pipe): New macro.
(gpgrt_create_outbound_pipe): New macro.
(gpgrt_spawn_process): New function.
(gpgrt_spawn_process_fd): New function.
(gpgrt_spawn_process_detached): New function.
(gpgrt_wait_process): New function.
(gpgrt_wait_processes): New function.
(gpgrt_kill_process): New function.
(gpgrt_release_process): New function.
* src/gpg-error.def.in, src/gpg-error.vers: Add new functions.
* src/visibility.c, src/visibility.h: Add wrappers for new functions.
* src/spawn-posix.c: Rework to better fit the use in gpgrt. Rename
all public function with a _gpgrt prefix.
* src/spawn-w32.c: Ditto.
* src/gpgrt-int.h: Likewise.
* src/Makefile.am (arch_sources): Add spawn-posix.c and spawn-w32.c.
* src/w32-add.h: Add pid_t typedef as a temporary hack.
* configure.ac: Check for signal.h and getrlimit.
(AC_FUNC_FORK): New.
--
This does build but porting the tests and further changes are
required. Don't assume that the API for the new fucntions is stable.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_sentenv, gpgrt_mkdir, gpgrt_chdir): Change
return type to gpg_err_code_t.
* src/sysutils.c (_gpgrt_setenv): Implement that.
(_gpgrt_mkdir): Ditto.
(_gpgrt_chdir): Ditto.
* gpgscm/ffi.c (do_setenv, do_mkdir): Adjust for this change.
--
The functions are already a bit different and thus it is useful to let
them return a gpg-error style error code and don't let the user
implement that for each call.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_mkdir, gpgrt_chdir, gpgrt_getcwd): New.
* src/visibility.c, src/visibility.h: Add wrappers.
* src/gpg-error.vers, src/gpg-error.def.in: Add them.
* src/sysutils.c (modestr_to_mode): New.
(_gpgrt_mkdir, _gpgrt_chdir, _gpgrt_getcwd): New.
* m4/gnupg-misc.m4: New.
* m4/Makefile.am (EXTRA_DIST): Add new M4 file.
* configure.ac: Call new GNUPG_FUNC_MKDIR_TAKES_ONE_ARG.
(AC_CHECK_FUNCS): Add stat.
--
The code has been taken from GnuPG. _gpgrt_mkdir was originally
written by me as gnupg_mkdir and here relicensed to LGPLv2.1+.
_gpgrt_getcwd was originally written by in 2007 and also here
relicensed to LGPLv2.1. The new M4 macro was also written by me for
use in in GnuPG; it has been taken from GnUPG's acinclude.m4, moved to
its own file here, and relicensed to FSFULLR.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_getenv, gpgrt_setenv): New.
(gpgrt_unsetenv): New macro.
* src/gpg-error.vers, src/gpg-error.def.in: Add them.
* src/visibility.c (gpgrt_getenv, gpgrt_setenv): New.
* src/visibility.h: Add them.
* src/sysutils.c: Include string.h and on Windows windows.h.
(_gpgrt_getenv): New.
(_gpgrt_setenv): New.
--
These functions are wrappers to cope with Windows problems. The code
is similar to what we have in GnuPG but not identical.
Requires better testing.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/w32-reg.c: New.
* src/w32-add.h: Add gpgrt_w32_reg_query_string.
* src/visibility.c (gpgrt_w32_reg_query_string): New wrapper.
* src/gpg-error.def.in: Add gpgrt_w32_reg_query_string.
* configure.ac (ac_check_funcs): Add stpcpy.
* src/Makefile.am (arch_sources): Add w32-reg.c
(socklibs): New.
(libgpg_error_la_LIBADD): Add socklibs.
* src/gpgrt-int.h (xfree, xtrymalloc, xtrycalloc)
(xtryrealloc): New internal macros.
(_gpgrt_stpcpy, stpcpy): New replacement fucntion and macro.
* src/logging.c (_gpgrt_logv_internal): Use new registry query
function and add standard registry key.
--
This also fixes the build failure on Widnwos for logging.c.
The code for gpgrt_w32_reg_query_string has been taken from the
function read_w32_registry_string in w32-utils.c in the GPGME package.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_strdup): New API fucntion.
(gpgrt_strconcat): New API fucntion.
* src/visibility.h: Add corresponding macros.
* src/gpg-error.def.in: Add them.
* src/gpg-error.vers: Add them.
* src/gpgrt-int.h (DIM): New macro.
* src/init.c (_gpgrt_strdup): New.
(_gpgrt_strconcat_core): New.
(_gpgrt_strconcat): New.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_realloc): New API function.
(gpgrt_malloc): New API function.
(gpgrt_calloc): New API function.
* src/visibility.h: Add corresponding macros.
* src/gpg-error.def.in: Add them.
* src/gpg-error.vers: Add them.
* src/init.c (_gpgrt_calloc): New.
* src/gpg-error.h.in: Add prototypes.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_get_errorcount): New API.
(gpgrt_inc_errorcount): New API.
(gpgrt_log_set_sink): New API.
(gpgrt_log_set_socket_dir_cb): New API.
(gpgrt_log_set_pid_suffix_cb): New API.
(gpgrt_log_set_prefix): New API.
(gpgrt_log_get_prefix): New API.
(gpgrt_log_test_fd): New API.
(gpgrt_log_get_fd): New API.
(gpgrt_log_get_stream): New API.
(gpgrt_log): New API.
(gpgrt_logv): New API.
(gpgrt_logv_prefix): New API.
(gpgrt_log_string): New API.
(gpgrt_log_info): New API.
(gpgrt_log_error): New API.
(gpgrt_log_fatal): New API.
(gpgrt_log_bug): New API.
(gpgrt_log_debug): New API.
(gpgrt_log_debug_string): New API.
(gpgrt_log_printf): New API.
(gpgrt_log_flush): New API.
(gpgrt_log_printhex): New API.
(gpgrt_log_clock): New API.
(_gpgrt_log_assert): New function for the ABI.
* src/visibility.h: Add corresponding macros.
* src/gpg-error.def.in: Add new functions.
* src/gpg-error.vers: Add new functions.
* src/gpg-error.h.in (GPGRT_LOG_WITH_PREFIX): New constant.
(GPGRT_LOG_WITH_TIME): New constant.
(GPGRT_LOG_WITH_PID): New constant.
(GPGRT_LOG_RUN_DETACHED): New constant.
(GPGRT_LOG_NO_REGISTRY): New constant.
(GPGRT_LOG_BEGIN): New enum value.
(GPGRT_LOG_CONT): New enum value.
(GPGRT_LOG_INFO): New enum value.
(GPGRT_LOG_WARN): New enum value.
(GPGRT_LOG_ERROR): New enum value.
(GPGRT_LOG_FATAL): New enum value.
(GPGRT_LOG_BUG): New enum value.
(GPGRT_LOG_DEBUG): New enum value.
(log_get_errorcount, log_inc_errorcount, log_set_file, log_set_fd)
(log_set_stream, log_set_socket_dir_cb, log_set_pid_suffix_cb)
(log_set_prefix, log_get_prefix, log_test_fd, log_get_fd)
(log_get_stream, log_log, log_logv, log_logv_prefix, log_string)
(log_bug, log_fatal, log_error, log_info, log_debug, log_debug_string)
(log_printf, log_printhex, log_clock)
(log_flush) [GPGRT_ENABLE_LOG_MACROS]: New wrapper macros.
(gpgrt_assert): New macro.
* src/gpgrt-int.h: Add prototypes for logging.c.
(gpgrt_assert): Redefine for internal use.
* src/logging.h: Remove.
* src/logging.c: Include gpgrt-int.h instead of the stuff from GnuPG.
Use _gpgrt malloc funcsions and the internal versions of the estream
functions. Rename all public fucntions with a _gpgrt_ prefix.
(print_prefix): Return the printed length.
(_gpgrt_logv_internal): Ditto.
(_gpgrt_log_printhex): Change order of args and turn into a printf
like function.
(_gpgrt_logv_printhex): New. Take the core of the former
log_printhex.
(_gpgrt_log_clock): Turn into a printf like functions.
(_gpgrt_logv_clock): New. Take the core of the former log_clock.
--
This logging API is a slightly modified version of what we are using
in GnuPG.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* NEWS: Add interface changes.
* src/Makefile.am (libgpg_error_la_SOURCES): Add b64dec.c.
* src/b64dec.c: New. Taken from gpgme. Prefix function names with
_gpgrt_. Change API a bit, not exposing the structure.
* src/gpg-error.def.in: Export Base64 functions.
* src/gpg-error.vers: Likewise.
* src/visibility.c, src/visibility.h: Likewise.
* src/gpg-error.h.in: Add Base64 struct and functions.
* src/gpgrt-int.h: Add Base64 internal functions.
* tests/Makefile.am (TESTS): Add t-b64dec.
* tests/t-b64dec.c: New.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_get_syscall_clamp): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add function.
* src/gpg-error.h.in: Ditto.
* src/estream.c (_gpgrt_get_syscall_clamp): New.
--
This function can be used by other libraries to set their own system
clamp functions.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--
* use https for bug reporting
* in comments and docs, use https to refer to:
- www.gnu.org
- creativecommons.org
- translationproject.org
- mail.gnome.org
- www.perl.org
- www.ctan.org
- www.cl.cam.ac.uk
- www.ntg.nl
- cygwin.com
- www.ethnologue.com
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure.ac (AC_CHECK_HEADERS): Add sys/select.h and sys/time.h.
* src/estream.c: Include both header if available.
(COOKIE_IOCTL_NONBLOCK): New.
(struct estream_cookie_fd): Add field nonblock.
(func_fd_create): Set nonblock from MODEFLAGS.
(es_func_fd_ioctl): New.
(parse_mode): Add modeflag "nonblock".
(es_fill): Map EWOULDBLOCK to EAGAIN. Do not set error indicator for
EAGAIN.
(es_flush, es_seek, es_write_nbf): Map EWOULDBLOCK to EAGAIN.
(do_fdopen): Call COOKIE_IOCTL_NONBLOCK.
(_gpgrt_set_nonblock): New.
(_gpgrt_get_nonblock): New.
(_gpgrt_poll): New.
* src/gpg-error.h.in (struct _gpgrt_poll_s): New.
(gpgrt_poll_t, es_poll_t): New.
(es_set_nonblock, es_get_nonblock, es_poll): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add gpgrt_set_nonblock,
gpgrt_get_nonblock, and gpgrt_poll.
* src/visibility.c (gpgrt_set_nonblock, gpgrt_get_nonblock): New.
(gpgrt_poll): New.
* tests/t-common.h (DIM): New.
* tests/t-poll.c: New.
* tests/Makefile.am (TESTS): Add t-poll.
(t_poll_LDADD): New.
--
The poll interface uses select(2) internally because that is more
portable than poll(2).
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_pending): Change to a macro.
(gpgrt_pending_unlocked): Change to a macro.
(_gpgrt_pending, _gpgrt_pending_unlocked): New private functions.
* src/visibility.c, src/visibility.h: Change accordingly.
* src/gpg-error.vers, src/gpg-error.def.in: Ditto.
* src/estream.c (_gpgrt_pending_unlocked): Rename to
_gpgrt__pending_unlocked.
(_gpgrt_pending): Rename to _gpgrt__pending.
--
The function are supposed to be used with gprt_getc and thus we need
to avoid the function call overhead. We may want to change them to
inline functions, though.
gpgrt_pending is changed to a macro with the idea that we eventually
can export the samestream flags and thus avoid the function call
overhead in the samethread case too.
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_pending, gpgrt_pending_unlocked): New.
* src/estream.c (_gpgrt_pending, _gpgrt_pending_unlocked): New.
(check_pending): new.
(check_pending_fbf, check_pending_nbf): New.
(es_func_mem_read, es_func_fd_read, es_func_w32_read)
(es_func_fp_read, es_fill): Take care of the special 0 value for SIZE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure.ac (AC_SYS_LARGEFILE): New.
(AC_CHECK_HEADERS): Check for stdint.h.
(AC_CHECK_SIZEOF): Add for int, long and long long.
(REPLACEMENT_FOR_OFF_T): New ac_define.
* src/mkheader.c (have_stdint_h, have_w32_system, have_w64_system)
(replacement_for_off_type, stdint_h_included): New.
(xfree, xstrdup): New.
(parse_config_h): New.
(write_special): Support "define:gpgrt_off_t", "define:gpgrt_ssize_t",
"api_ssize_t" tags.
(main): Add config.h arg. Call parse_config_h. Fix substitute code.
* src/Makefile.am (gpg-error.h): Pass config.h to mkheader.
* src/gpg-error.h.in: Include definitions for gpgrt_ssize_t and
gpgrt_off_t. Let mkheader insert ssize_t keywords. Chnage all off_t
to gpgrt_off_t.
* src/estream.c: Change all off_t to gpgrt_off_t. Chnage all ssize_t
to gpgrt_ssize_t.
* src/visibility.c (gpgrt_fseeko): Use gpgrt_off_t.
(gpgrt_ftello): Ditto.
(gpgrt_getline): Use gpgrt_ssize_t.
(gpgrt_read_line): Ditto.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_set_alloc_func): New.
* configure.ac (_ESTREAM_PRINTF_REALLOC): Define.
(_ESTREAM_PRINTF_EXTRA_INCLUDE): Define.
* src/estream.c (mem_alloc, mem_realloc, mem_free): Simplify.
(_gpgrt_free): Remove.
* src/init.c (custom_realloc): New var.
(_gpgrt_set_alloc_func): New.
(_gpgrt_realloc, _gpgrt_malloc, _gpgrt_free): New.
* src/visibility.h (gpg_err_deinit): Mark as visible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_init): New macro.
(gpgrt_check_version): New prototype.
* src/init.c (_gpg_err_init): Rename from gpg_err_init.
(_gpg_err_deinit): Rename from gpg_err_deinit.
* src/visibility.c (gpg_err_init): New.
(gpg_err_deinit): New.
(gpgrt_check_version): New.
* src/gpg-error.vers (gpg_err_init, gpg_err_deinit): Add missing
symbols.
(gpgrt_check_version): New.
* src/gpg-error.def.in (gpg_err_init, gpg_err_deinit): Add missing
symbols.
(gpgrt_check_version): New.
* src/gpg-error.c (main): Use gpgrt_init macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/posix-lock.c: Add weak program for pthread_mutex_trylock.
(_gpgrt_lock_trylock): New.
* src/w32-lock.c (_gpgrt_lock_init): Add missing return statement.
(_gpgrt_lock_trylock): New.
* src/visibility.c (gpgrt_set_syscall_clamp): New.
(gpgrt_lock_trylock): New.
(gpgrt_vsnprintf): Fix symbol name.
* src/init.c (DllMain): Mark unused arg.
* src/estream.c: Replace npth mutexes by our own locks. Replace yeild
macro by _gpgrt_yield.
(pre_syscall_func, post_syscall_func): New.
(do_deinit): Clear both new vars.
(es_func_fd_read, es_func_fd_write): Call pre and post syscall
functions instead of the former SYSCALL macros.
(es_func_w32_read, es_func_w32_write): Ditto.
(es_func_fd_seek, es_func_w32_seek, es_func_fp_read)
(es_func_fp_write, es_func_fp_seek, es_func_fp_destroy): Bracket
syscalls with the pre- and post-syscall fucntions.
(do_npth_read, do_npth_write): Remove.
(_gpgrt_es_init): Remove call to mutex init. It is now statically
initialized.
(_gpgrt_set_syscall_clamp): New.
(es_create): Destroy stream lock on error.
(do_close): Destroy stream lock.
|
| |
|
| |
|
|
* configure.ac: New option --enable-ld-version-script.
(GPGRT_USE_VISIBILITY): New ac_define.
(HAVE_LD_VERSION_SCRIPT): New am_conditional.
* src/gpg-error.vers: New.
* src/gpgrt-int.h: New.
* src/visibility.c, src/visibility.h: New. Lot of changes to symbold
names.
--
This is only doe for the old API. The estream API needs to be added.
|