aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* core: New API functions gpgrt_strdup and gpgrt_strconcat.Werner Koch2017-11-177-2/+111
| | | | | | | | | | | | | | | * 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 <[email protected]>
* core: New API functions gpgrt_malloc, gpgrt_calloc, and gpgrt_realloc.Werner Koch2017-11-177-1/+63
| | | | | | | | | | | | | * 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 <[email protected]>
* core: Add logging API.Werner Koch2017-11-178-298/+803
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* New configure options and macros for internal use.Werner Koch2017-11-173-11/+158
| | | | | | | | | | | | | * configure.ac: Add option --enable-log-clock. * configure.ac: Add option --enable-werror. * src/sysutils.c: New. * src/Makefile.am (libgpg_error_la_SOURCES): Add sysutils.c * src/gpgrt-int.h: Add internal i18n macros and hacks to make working with sockets easier. (es_stdin, es_stdout, es_stderr): New internal macros. (snprintf): New macro. Signed-off-by: Werner Koch <[email protected]>
* core: Change license of logging.[ch] to LGPLv2.1Werner Koch2017-10-052-48/+32
| | | | | | | | | | | -- This file has a long history. I was first written by me in 1998 for GnuPG under the name logger.c. In 2010 it was renamed to logging.c. Almost everything was written by me. A few minor fixes are from g10 Code employees and some other people. Signed-off-by: Werner Koch <[email protected]>
* core: Import of logging.[ch] from GnuPGWerner Koch2017-10-052-0/+1218
| | | | | | | | | -- Taken from GnuPG master commit 98c260e057e7829580da99f0c8e0037a3896bfae Signed-off-by: Werner Koch <[email protected]>
* syscfg: Add lock-obj-pub file for ia64-unknown-linux-gnu.Werner Koch2017-07-052-0/+26
| | | | | | | | | * src/syscfg/lock-obj-pub.ia64-unknown-linux-gnu.h: new. * src/Makefile.am (lock_obj_pub): Add it. -- GnuPG-bug-id: 3242 Signed-off-by: Werner Koch <[email protected]>
* doc: Typo fixWerner Koch2017-07-051-1/+1
| | | | --
* Align 'es_poll' semantics closer with POSIX.Justus Winter2017-05-311-3/+0
| | | | | | | | | | | | | * src/estream.c (_gpgrt_poll): Do not return early if some streams are found to be ready before even polling the others. -- POSIX mandates that all streams are examined and returning early violates that. It also imposes an order on how the callee serves the streams, which might be incompatible with the order the callee wants to serve them, leading to deadlocks. Signed-off-by: Justus Winter <[email protected]>
* Fix memory leak for estream.NIIBE Yutaka2017-05-301-5/+20
| | | | | | | * src/estream.c (do_list_remove): Free the item. (do_close): Free the buffer. Signed-off-by: NIIBE Yutaka <[email protected]>
* Minor clean up.NIIBE Yutaka2017-04-193-4/+6
| | | | | | | | * src/b64dec.c (_gpgrt_b64dec_proc): Add a comment. * src/estream.c (_gpgrt_fread, _gpgrt_fwrite): Use &&. * src/mkheader.c (xstrdup): Use memcpy as we know length. Signed-off-by: NIIBE Yutaka <[email protected]>
* w32: Conditionalize ISO 2022 definitions.NIIBE Yutaka2017-03-071-0/+2
| | | | | | | | | * src/w32-iconv.c (iso2022_SI_seq, iso2022_SO_seq) [USE_MLANG_DLL]: Only for USE_MLANG_DLL. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* Release 1.27libgpg-error-1.27Werner Koch2017-02-283-3/+3
| | | | | | | | | | * configure.ac: Bump LT version to C22/A22/R0. -- Note that C21/A21/R0 was used in 1.26 but later lost in the repo due to a merge. Signed-off-by: Werner Koch <[email protected]>
* Add support for armv7-unknown-linux-gnueabihf.Werner Koch2017-02-285-72/+7
| | | | | | | | | | | | | | | | | * src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabihf.h: Remove. * src/syscfg/lock-obj-pub.armv5-unknown-linux-musleabi.h: Remove. * src/syscfg/lock-obj-pub.armv6-unknown-linux-musleabihf.h: Remove. * src/Makefile.am (lock_obj_pub): Remove them. * src/mkheader.c (canon_host_triplet): Add removed as aliases. Addn alias for armv7-unknown-linux-gnueabihf. -- Info provided by Marvin Schmidt <[email protected]> via [email protected] on Tue, 14 Feb 2017 15:00:15 +0100 Consilidated arm syscfg file by aliasing them. Signed-off-by: Werner Koch <[email protected]>
* New public header gpgrt.h as alias for gpg-error.hWerner Koch2017-02-282-4/+10
| | | | | | | | | | * src/gpg-error.h.in (GPGRT_H): New double include protection. * src/Makefile.am (nodist_include_HEADERS): Add gpgrt.h. (BUILT_SOURCES): Ditto. (CLEANFILES): Ditto. (gpgrt.h): New rule. Signed-off-by: Werner Koch <[email protected]>
* Improve tracing of estream.Werner Koch2017-02-284-94/+191
| | | | | | | | | | | | * src/gpgrt-int.h (trace_errno): Add new parameter. Adjust all users. * src/init.c (trace_fp, trace_with_errno, trace_missing_lf) (trace_prefix_done): New vars. (_gpgrt_internal_trace_begin): Add arg WITH_ERRNO. Open a trace file on first use. Init new vars. (print_internal_trace_prefix): New. * src/estream.c, src/w32-estream.c: Improve tracing. Signed-off-by: Werner Koch <[email protected]>
* w32: Fix gpgrt_poll for Windows.Werner Koch2017-02-281-6/+0
| | | | | | | | | | | | * src/estream.c (_gpgrt_poll) [W32]: Do not call the syscall clamp. -- The system call clamp may only be used directloy around system calls. We don't need them here because we use independent threads to implement non-blocking behaviour. In fact the clamp may lead to a deadlock. Signed-off-by: Werner Koch <[email protected]>
* Use the new tracing ramework for estream.Werner Koch2017-02-262-103/+159
| | | | | | | | | * src/estream.c: Add trace calls to some functions. * src/w32-estream.c: Replace existing trace calls by the new framework. -- Signed-off-by: Werner Koch <[email protected]>
* Add a tracing framework.Werner Koch2017-02-262-0/+121
| | | | | | | | | | | | | | | | | | | | * src/init.c (trace_save_errno, trace_arg_module) (trace_arg_file, trace_arg_line): New module vars. (do_internal_trace): New. (_gpgrt_internal_trace_printf): New. (_gpgrt_internal_trace): New. (_gpgrt_internal_trace_errno): New. (_gpgrt_internal_trace_end): New. * src/gpgrt-int.h (trace): New macro. (trace_errno): New macro. (trace_start): New macro. (trace_append): New macro. (trace_finish): New macro. -- We want to be abale to use libgpg-error also with pre-c99 compilers and thus we can use the __VA_ARGS__ but resort to the common macro trick.
* Rename internal functions of estream.Werner Koch2017-02-264-93/+94
| | | | | | | | | | | | | | | | | | | | * src/estream.c (_gpgrt_es_init): Rename to _gpgrt_estream_init. (es_fill): Rename to fill_stream. (es_fflush): Rename to flush_stream. (es_deinitialize): Rename to deinit_stream_obj. (es_create): Rename to create_stream (es_read_nbf): Rename to do_read_nbf. (es_read_lbf): Rename to do_read_lbf. (es_read_fbf): Rename to do_read_fbf. (es_peek): Rename to peek_stream. (es_skip): Rename to skip_stream. (es_print): Rename to do_print_stream. -- The use of the "es_" was confusing. Avoid that. Signed-off-by: Werner Koch <[email protected]>
* w32: Do not use the syscall clamps in pollable mode.Werner Koch2017-02-241-10/+36
| | | | | | | | | | | | | * src/estream.c (estream_cookie_w32): Add flag no_syscall_clamp. (func_w32_create): Add arg no_syscall_clamp. (func_w32_read): Do not call pre/post_syscall_clamp when flag is set. (func_w32_write): Ditto. (func_w32_seek): Ditto. (do_w32open): Set NO_SYSCALL_CLAMP in pollable mode. (es_create) [W32]: Make sure that pollable-mode is unly used with the W32 backend. Signed-off-by: Werner Koch <[email protected]>
* w32: Replace gpgrt locks in w32-streams by native critical sections.Werner Koch2017-02-231-49/+50
| | | | | | | | | | | | | | | | * src/w32-estream.c (TRACE_ERR): Also print the error number. This is in particular useful on non-english systems. (reader_context_s, writer_context_s): Replace the gpgrt mutex by a native critical section. Change all calls to gpgrt_lock_ fucntions by the EnterCriticalSection et al. (_gpgrt_w32_poll): Make CODE unsigned which is what WFMO returns. Remove the then useless condition. -- The locking code here is self-contained and may badly interact with the possible nPth "clamped" gpgrt lock functions. Signed-off-by: Werner Koch <[email protected]>
* New error code GPG_ERR_INV_NAME.Werner Koch2017-02-191-0/+1
| | | | Signed-off-by: Werner Koch <[email protected]>
* syscfg: Add a sh3 architecture.NIIBE Yutaka2017-02-022-0/+24
| | | | | | | | * src/syscfg/lock-obj-pub.sh3-unknown-linux-gnu.h: New. * src/Makefile.am (lock_obj_pub): Add it. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* Add Base64 decoder.NIIBE Yutaka2017-02-018-1/+330
| | | | | | | | | | | | | | | | * 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 <[email protected]>
* estream: Correctly set ERRNO to EOPNOTSUPP.Werner Koch2017-01-191-2/+4
| | | | | | | * src/estream.c (es_flush, es_write_nbf): Fix setting of ERRNO to EOPNOTSUPP. Signed-off-by: Werner Koch <[email protected]>
* doc,configure: Be consistent about preferring --with-libgpg-error-prefixDaniel Kahn Gillmor2017-01-101-1/+1
| | | | | | | | | | | | | | | | | | | * doc/gpgrt.texi: Say "--with-libgpg-error-prefix" instead of "--with-gpg-error-prefix". * src/gpg-error.m4: When warning about library locations, warn with the preferred "--with-libgpg-error-prefix" name. -- in src/gpg-error.m4, it already says: > dnl --with-libgpg-error-prefix=PFX is the preferred name for this option, > dnl since that is consistent with how our three siblings use the directory/ > dnl package name in --with-$dir_name-prefix=PFX. so this is an attempt to live up to that expectation. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Fix macro GPGRT_GCC_VERSIONWerner Koch2017-01-031-1/+1
| | | | | | | | * src/gpg-error.h.in (GPGRT_GCC_VERSION): Fix. -- Fixes-commit: 4e790613f66efcfc62d73722d5f1730a37cb8324 Signed-off-by: Werner Koch <[email protected]>
* New error code GPG_ERR_TRY_LATER.Werner Koch2016-12-131-0/+1
| | | | Signed-off-by: Werner Koch <[email protected]>
* New error code GPG_ERR_DNS_TIMEOUT.Werner Koch2016-12-121-1/+2
| | | | Signed-off-by: Werner Koch <[email protected]>
* New error codes to support libdns.Werner Koch2016-12-121-0/+15
| | | | Signed-off-by: Werner Koch <[email protected]>
* Fix NULL segv in new option --descWerner Koch2016-12-021-0/+3
| | | | | | * src/gpg-error.c (print_desc): Shortcur for unknown symbols. Signed-off-by: Werner Koch <[email protected]>
* New error code GPG_ERR_INV_FLAGWerner Koch2016-12-021-0/+1
|
* New option --desc for gpg-error.Werner Koch2016-12-022-47/+166
| | | | | | | | | | | | | | | * doc/errorref.txt: Remove all tabs. * doc/Makefile.am (install-data-local): New to install errorref.txt. (uninstall-local): New. (errorref.txt.x): New. * src/Makefile.am (gpg_error_CPPFLAGS): Define PKGDATADIR * src/gpg-error.c (print_desc): New. (show_usage): New. (main): Improve option parser. Add new option --desc. Call print_desc. -- Signed-off-by: Werner Koch <[email protected]>
* w32-iconv: Remove invalid link to unicode.org in comment.Daniel Kahn Gillmor2016-11-181-1/+0
| | | | | | | | | | | | | -- http://www.unicode.org/unicode/onlinedat/languages.html currently says: The mapping information between Macintosh and Windows codes is no longer available on the Unicode site. Please consult the Macintosh and Windows developer sites. And there are no outbound links. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* w32: Update links from http to https.Daniel Kahn Gillmor2016-11-181-2/+2
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Fix more misspellings.Daniel Kahn Gillmor2016-11-181-1/+1
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Fix misspellings in error descriptions.Daniel Kahn Gillmor2016-11-181-2/+2
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Fix EXEEXT for lock obj creation.NIIBE Yutaka2016-11-171-1/+1
| | | | | | | | | | | | * src/Makefile.am (lock-obj-pub.native.h): Add EXEEXT for the executable gen-posix-lock-obj. -- This change is from packaging work for Cygwin. Reported-by: Michael Haubenwallner <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
* Fix typo in two new error descriptions.Werner Koch2016-11-142-3/+3
|
* estream: Minor portability fix.Werner Koch2016-11-122-4/+4
| | | | | | | | | | -- A trailing comma in an enum is not groked by all compilers. Binary operation should have their own parentheses to make it clear that a binary operator was meant. Signed-off-by: Werner Koch <[email protected]>
* estream: Support 'es_poll' on Windows.Justus Winter2016-11-124-74/+1175
| | | | | | | | | | | | | | | | | | | | | * src/Makefile.am (arch_sources): Add new file. * src/estream.c (O_NONBLOCK): Move to 'gpgrt-int.h'. (BUFFER_BLOCK_SIZE): Likewise. (BUFFER_UNREAD_SIZE): Likewise. (struct notify_list_s, notify_list_t): Likewise. (struct _gpgrt_stream_internal, estream_internal_t): Likewise. (X_POLLABLE): New macro. (parse_mode): Parse keyword 'pollable', emulate O_NONBLOCK using the same mechanism on Windows. (_gpgrt_poll): Use the new '_gpgrt_w32_poll' on Windows. * src/gpgrt-int.h (_gpgrt_functions_w32_pollable): New declaration. (_gpgrt_w32_pollable_create): New prototype. (_gpgrt_w32_poll): Likewise. * src/w32-estream.c: New file. This code is adapted from GPGME. * tests/t-poll.c (create_pipe): Create pollable streams. GnuPG-bug-id: 2731 Signed-off-by: Justus Winter <[email protected]>
* estream: Track the kind of backend used.Justus Winter2016-11-122-17/+33
| | | | | | | | | * src/estream.c (struct _gpgrt_stream_internal): Add 'kind'. (init_stream_obj): New parameter 'kind', initialize field. (es_create): New parameter 'kind'. Update all callers. * src/gpgrt-int.h (gpgrt_stream_backend_kind_t): New type. Signed-off-by: Justus Winter <[email protected]>
* estream: Rework how the cookie functions are handled.Justus Winter2016-11-122-49/+69
| | | | | | | | | | | | | | | | | | | | | | * src/estream.c (cookie_ioctl_function_t): Move to 'gpgrt-int.h', along with the macros for the IOCTL numbers. (estream_functions_mem): Use the new type and add the ioctl function. (estream_functions_fd): Likewise. (estream_functions_w32): Likewise. (estream_functions_fp): Likewise. (init_stream_object): Use the new type, and also initialize 'func_ioctl'. (es_create): Use the new type. (_gpgrt_fopen): Adapt. (_gpgrt_mopen): Likewise. (_gpgrt_fopenmem): Likewise. (_gpgrt_fopencookie): Likewise. (_gpgrt_fdopen): Likewise. (_gpgrt_fpopen): Likewise. (do_w32open): Likewise. * src/gpgrt-int.h (struct cookie_io_functions_s): New type. Signed-off-by: Justus Winter <[email protected]>
* estream: Rework modestring handling.Justus Winter2016-11-121-46/+44
| | | | | | | | | | | | | | | | | | * src/estream.c (X_SAMETHREAD, X_SYSOPEN): New macros. (parse_mode): Rework how information flows from here to 'es_create'. Instead of using an integer flag per mode, use flags. (init_stream_obj): Adapt accordingly. (es_create): Likewise. (_gpgrt_fopen): Likewise. (_gpgrt_mopen): Likewise. (_gpgrt_fopenmem): Likewise. (_gpgrt_fopencookie): Likewise. (_gpgrt_fdopen): Likewise. (_gpgrt_fpopen): Likewise. (do_w32open): Likewise. (_gpgrt_freopen): Likewise. Signed-off-by: Justus Winter <[email protected]>
* Add new interface gpgrt_get_syscall_clamp.Werner Koch2016-11-127-0/+26
| | | | | | | | | | | | | * 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 <[email protected]>
* Use the syscall clamp functions also for lock functionsWerner Koch2016-11-117-1/+104
| | | | | | | | | | | | | | | | | | | | * src/posix-lock.c (pre_lock_func, post_lock_func): New. (_gpgrt_lock_set_lock_clamp): New. (_gpgrt_lock_lock): Use clamp functions. * src/w32-lock.c (pre_lock_func, post_lock_func): New. (_gpgrt_lock_set_lock_clamp): New. (_gpgrt_lock_lock): Use clamp functions. * src/posix-lock.c (pre_syscall_func, post_syscall_func): New. (_gpgrt_thread_set_syscall_clamp): New. (_gpgrt_yield): Use clamp functions. * src/w32-lock.c (pre_syscall_func, post_syscall_func): New. (_gpgrt_thread_set_syscall_clamp): New. (_gpgrt_yield): Use clamp functions. * src/estream.c: Include lock.h and thread.h. (do_deinit): Call _gpgrt_lock_set_lock_clamp. (_gpgrt_set_syscall_clamp): Ditto. Signed-off-by: Werner Koch <[email protected]>
* w32: Fix lock c++ narrowing conversion warningAndre Heinecke2016-11-111-2/+2
| | | | | | | | | * src/syscfg/lock-obj-pub.mingw32.h (gpgrt_lock_t): Declare priv as unsigned char. -- This fixes error: narrowing conversion of ‘255’ from ‘int’ to ‘volatile char’ inside { } [-Werror=narrowing]
* Change description of GPG_ERR_OPEN_KEYRING.Werner Koch2016-11-101-1/+1
| | | | Signed-off-by: Werner Koch <[email protected]>
* Add error codes GPG_ERR_TOO_YOUNG and GPG_ERR_TOO_OLD.Werner Koch2016-11-021-0/+2
| | | | Signed-off-by: Werner Koch <[email protected]>