summaryrefslogtreecommitdiff
path: root/src/w32-estream.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove Windows CE support.NIIBE Yutaka2022-06-281-42/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * contrib/*: Remove. * Makefile.am: Remove contrib. * autogen.sh: Remove Windows CE support. * configure.ac (have_w32ce_system): Remove. * src/Makefile.am [HAVE_W32CE_SYSTEM] (extra_cppflags): Remove. (gpg_extra_headers): Remove. (EXTRA_DIST): Remove mkw32errmap.c and w32ce-add.h (BUILT_SOURCES): Remove mkw32errmap.map.c. (tmp_files): Remove mkw32errmap.tab.h mkw32errmap.map.c (CLEANFILES): Likewise. * src/estream-printf.c [HAVE_W32CE_SYSTEM]: Remove. * src/estream.c [HAVE_W32CE_SYSTEM]: Remove. * src/gpg-error.def.in [HAVE_W32CE_SYSTEM]: Remove. * src/gpgrt-int.h: Fix comment. * src/init.c [HAVE_W32CE_SYSTEM]: Remove. * src/init.h [HAVE_W32CE_SYSTEM]: Remove. * src/mkheader.c: Remove Windows CE support. * src/mkw32errmap.c, src/w32ce-add.h: Remove. * src/spawn-posix.c [HAVE_W32CE_SYSTEM]: Remove. * src/spawn-w32.c [HAVE_W32CE_SYSTEM]: Remove. * src/sysutils.c [HAVE_W32CE_SYSTEM]: Remove. * src/w32-estream.c [HAVE_W32CE_SYSTEM]: Remove. * src/w32-reg.c [HAVE_W32CE_SYSTEM]: Remove. * tests/Makefile.am [HAVE_W32CE_SYSTEM]: Remove. -- GnuPG-bug-id: 5912 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Fix for MinGW which doesn't define EOPNOTSUPP.NIIBE Yutaka2022-03-251-0/+4
| | | | | | | | | | * src/w32-estream.c: Add EOPNOTSUPP. -- GnuPG-bug-id: 5890 Reported-by: Eli Zaretskii Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* core,w32: Use timeout in es_poll even if there are no FDs.Werner Koch2020-08-111-3/+17
| | | | | | | | | | | | * src/w32-estream.c (_gpgrt_w32_poll): Sleep if there are no handles to wait for. -- This better matches the semantics of poll and select and avoid busy waitins. We had this problem for example in the LDAP helper process reaper of GnuPG's Dirmngr. Signed-off-by: Werner Koch <wk@gnupg.org>
* estream: Increase buffer size for Windows.Werner Koch2019-03-191-2/+2
| | | | | | | | * src/gpgrt-int.h (BUFFER_BLOCK_SIZE) [W32]: Increase from 512 to 8k. * src/w32-estream.c (READBUF_SIZE, WRITEBUF_SIZE): Increase from 4k to 8k. Signed-off-by: Werner Koch <wk@gnupg.org>
* core: New functions gpgrt_abort and gpgrt_add_emergency_cleanup.Werner Koch2019-01-041-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* w32: Remove cruft in w32-estream from olden times.Andre Heinecke2018-10-311-28/+0
| | | | | | | | | | | | | * src/w32-io.c (set_synchronize): Remove. (create_reader, create_writer): No need for set_synchronize. -- The set_synchronize dates back to 2001 at a time when gpgme got the Windows support on WindowsME and Windows2000. Maybe this was required then due to bugs in that old NT or partly NT based Windows versions. Removal similar to the removal in gpgme's w32-io.
* core,w32: Avoid recursive use of npth_unprotect.Werner Koch2018-05-011-2/+10
| | | | | | | | | | | | | | | | | | | | * src/w32-estream.c (reader): Use standard free. (writer): Ditto. -- There are two errors: The minor one is that we allocated with calloc but released with _gpgrt_free. The major one is the recursive use of npth_unprotect due to the syscall_clamp mechanism: 1. Around the call to _gpgrt_w32_poll 2. By gpgrt_lock_lock on behalf of a the custom allocation handler in the worker threads at their _gpgrt_free. This problem was exhibited by GnuPG's dirmngr component. GnuPG-bug-id: 3937 Signed-off-by: Werner Koch <wk@gnupg.org>
* core: Fix gpgrt_poll for Windows under nPth.Werner Koch2018-04-301-0/+2
| | | | | | * src/estream.c (_gpgrt_poll) [W32]: Use syscall clamp. Signed-off-by: Werner Koch <wk@gnupg.org>
* w32: Avoid unused code warning.Werner Koch2017-11-171-0/+8
| | | | | | | | * src/w32-estream.c (_gpgrt_w32_poll) [!ENABLE_TRACING]: Do not use waitinfo. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* Improve tracing of estream.Werner Koch2017-02-281-39/+77
| | | | | | | | | | | | * 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 <wk@gnupg.org>
* Use the new tracing ramework for estream.Werner Koch2017-02-271-94/+83
| | | | | | | | | * 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 <wk@gnupg.org>
* 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 <wk@gnupg.org>
* estream: Support 'es_poll' on Windows.Justus Winter2016-11-121-0/+1047
* 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 <justus@g10code.com>