aboutsummaryrefslogtreecommitdiffstats
path: root/src/mkheader.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spawn: Expose spawn functions API.NIIBE Yutaka2024-06-051-0/+3
| | | | | | | | | | | | | * src/gpg-error.def.in: Update. * src/gpg-error.vers: Update. * src/gpg-error.h.in: Add declarations. * src/visibility.c: Add implementations. * src/visibility.h: Expose them. -- GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka <[email protected]>
* Cleaner semantics for _gpgrt_process_spawn without a callback.NIIBE Yutaka2024-05-291-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpg-error.h.in (@define:struct_spawn_cb_arg@): Remove. (gpgrt_spawn_actions_t): New. (@define:spawn_actions_functions@): New. * src/gpgrt-int.h (_gpgrt_spawn_actions_new) (_gpgrt_spawn_actions_release, _gpgrt_spawn_actions_set_envvars) (_gpgrt_spawn_actions_set_redirect): New. [HAVE_W32_SYSTEM] (_gpgrt_spawn_actions_set_inherit_handles): New. [!HAVE_W32_SYSTEM] (_gpgrt_spawn_actions_set_inherit_fds) (_gpgrt_spawn_actions_set_atfork): New. (_gpgrt_process_spawn): Use gpgrt_spawn_actions_t. (_gpgrt_spawn_helper): Remove. * src/mkheader.c: Emit gpgrt_spawn_actions_* definition. * src/spawn-posix.c(_gpgrt_spawn_actions_new) (_gpgrt_spawn_actions_release, _gpgrt_spawn_actions_set_envvars) (_gpgrt_spawn_actions_set_redirect) (_gpgrt_spawn_actions_set_inherit_fds) (_gpgrt_spawn_actions_set_atfork): New. (spawn_detached, _gpgrt_process_spawn): Use gpgrt_spawn_actions_t. (_gpgrt_spawn_helper): Remove. * src/spawn-w32.c: Ditto, with _gpgrt_spawn_actions_set_inherit_handles, but no _gpgrt_spawn_actions_set_atfork. -- GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka <[email protected]>
* Import spawn functions from GnuPG master.NIIBE Yutaka2024-05-281-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpg-error.h.in (@define:gpgrt_process_t@): Remove. (@define:struct_spawn_cb_arg@): New. (enum gpgrt_process_requests): New. (GPGRT_PROCESS_DETACHED, GPGRT_PROCESS_STDIN_PIPE) (GPGRT_PROCESS_STDOUT_PIPE, GPGRT_PROCESS_STDERR_PIPE) (GPGRT_PROCESS_STDINOUT_SOCKETPAIR, GPGRT_PROCESS_STDIN_KEEP) (GPGRT_PROCESS_STDOUT_KEEP, GPGRT_PROCESS_STDERR_KEEP) (GPGRT_PROCESS_STDFDS_SETTING, GPGRT_PROCESS_STREAM_NONBLOCK): New. * src/gpgrt-int.h (_gpgrt_process_spawn, _gpgrt_process_terminate) (_gpgrt_process_get_fds, _gpgrt_process_get_streams) (_gpgrt_process_ctl, _gpgrt_process_wait, _gpgrt_process_release) (_gpgrt_process_wait_list, _gpgrt_spawn_helper): New. * src/mkheader.c: Emit definition of struct_spawn_cb_arg. * src/spawn-posix.c (_gpgrt_process_spawn, _gpgrt_process_terminate) (_gpgrt_process_get_fds, _gpgrt_process_get_streams) (_gpgrt_process_ctl, _gpgrt_process_wait, _gpgrt_process_release) (_gpgrt_process_wait_list, _gpgrt_spawn_helper): New. * src/spawn-w32.c: Ditto. -- GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Support --verbose option for mkheader.NIIBE Yutaka2023-07-281-4/+15
| | | | | | | | | | * src/mkheader.c (include_file): Only emit the notification when invoked with --verbose. (main): Add --verbose handling. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Add hurd-amd64 supportSamuel Thibault2023-05-241-0/+2
| | | | | | | -- This supports the x86_64-pc-gnu triplet Signed-off-by: Samuel Thibault <[email protected]>
* spawn: Introduce gpgrt_process_t and use it for spawn API.NIIBE Yutaka2022-11-041-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (AC_FUNC_FORK): No use. * src/gpg-error.h.in (@define:gpgrt_process_t@): New. (@define:pid_t@): Remove. (gpgrt_spawn_process, gpgrt_spawn_process_fd): Use gpgrt_process_t. (gpgrt_wait_process, gpgrt_wait_processes): Likewise. (gpgrt_kill_process, gpgrt_release_process): Likewise. * src/gpgrt-int.h (_gpgrt_spawn_process): Likewise. (_gpgrt_spawn_process_fd): Likewise. (_gpgrt_wait_process, _gpgrt_wait_processes): Likewise. (_gpgrt_kill_process, _gpgrt_release_process): Likewise. * src/mkheader.c (write_special): Handle @define:gpgrt_process_t@. Remove handling of @define:pid_t@. * src/spawn-posix.c (_gpgrt_spawn_process): Use gpgrt_process_t. (_gpgrt_spawn_process_fd): Likewise. (_gpgrt_wait_process, _gpgrt_wait_processes): Likewise. (_gpgrt_kill_process, _gpgrt_release_process): Likewise. * src/spawn-w32.c (_gpgrt_spawn_process): Use gpgrt_process_t. (_gpgrt_spawn_process_fd): Likewise. (_gpgrt_wait_process, _gpgrt_wait_processes): Likewise. (_gpgrt_kill_process, _gpgrt_release_process): Likewise. -- GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka <[email protected]>
* Remove Windows CE support.NIIBE Yutaka2022-06-281-5/+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 <[email protected]>
* w32: Add ES_SYSHD_SOCK support for gpgrt_sysopen.NIIBE Yutaka2022-04-041-0/+7
| | | | | | | | | | | | | | | | * src/mkheader.c (write_special): Support @SOCKET_t@ substitution. * src/gpgrt-int.h (gpgrt_stream_backend_kind_t): Add BACKEND_SOCK. * src/gpg-error.h.in (struct _gpgrt_syshd): Use @SOCKET_t@. * src/estream.c [HAVE_W32_SYSTEM] (estream_cookie_sock_t): New. [HAVE_W32_SYSTEM] (func_sock_create, func_sock_read): New. [HAVE_W32_SYSTEM] (func_sock_write, func_sock_seek): New. [HAVE_W32_SYSTEM] (func_sock_destroy, func_sock_ioctl): New. [HAVE_W32_SYSTEM] (estream_functions_sock, do_sockopen): New. [HAVE_W32_SYSTEM] (do_sysopen): Call do_sockopen. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* build,tests: Fix leaks of memory or file pointer.Jakub Jelen2021-04-121-0/+1
| | | | | | | | | | | | * src/mkheader.c (parse_config_h): Close FP. * tests/t-b64.c (test_b64enc_string): Free STATE. (test_b64dec_string): Free BUFFER. * tests/t-syserror.c (main): Close FP. -- GnuPG-bug-id: 5381 Signed-off-by: Jakub Jelen <[email protected]>
* syscfg: Add armv7a-unknown-linux-gnueabihf as an alias.Werner Koch2019-03-191-0/+1
| | | | | | | -- GnuPG-bug-id: 4409 Signed-off-by: Werner Koch <[email protected]>
* syscfg: Add support for arc-unknown-linux-gnuWerner Koch2018-09-211-1/+2
| | | | | | | | | | * src/mkheader.c (canon_host_triplet): Add to table. -- Note that unknown in the above triplet is actually a wildcard for 4 part triplets. Signed-off-by: Werner Koch <[email protected]>
* core: Make cross building in mkheader more explicit.Werner Koch2018-09-211-1/+11
| | | | | | | | | | | | | | | | | * src/mkheader.c (main): Add option --cross. (write_special): Don't use native in cross mode. * src/Makefile.am (mkheader_opts): New. (gpg-error.h): Add MKHEADER_OPTS. -- The old behaviour was that an existing lock-obj-oub.native.h was preferred over one from syscfg even in cross mode. The Makefile tried to get this right by deleting such a file first but when calling mkheader manually for testing this may have not been done. We now allow (and also use by the Makefile) an option --cross to make this explicit. Signed-off-by: Werner Koch <[email protected]>
* core: Simplify calling convention of mkheader.Werner Koch2018-09-211-25/+40
| | | | | | | | | | | | * src/Makefile.am (gpg-error.h): Remove HOST_OS from mkheader call. * src/mkheader.c (canon_host_triplet): Add return arg r_os. (main): Remove first arg and derive host_os from host_triplet. -- No need to let the caller pass the host_os, we can derive it from the triplet. Signed-off-by: Werner Koch <[email protected]>
* syscfg: Support ARC CPUs and simplify aliasing table.Werner Koch2018-09-181-15/+77
| | | | | | | | | | | | | | | | | | | * src/mkheader.c (xmalloc): New. (xstrdup): Implement using xmalloc. (canon_host_triplet): Add supporr for arc CPU. Adjust alias table to also alias *-pc-*. Rename ibm to unknown. Add internal arg. Add unknown vendor hack. (main): New mode to just print the canonicalized form. * src/Makefile.am (lock_obj_pub): s/-(pc|ibm)-/-unknown/. Also rename files accordingly. -- config.sub does no real aliasing and thus we would need to add several vendors to the alising tables despite that this has no technical meanding. Instead we now replace the vendor with "unknown" for the 4-part-"triplets". This change will make maintenace easier. Signed-off-by: Werner Koch <[email protected]>
* core: Fix building on W64Werner Koch2018-03-141-2/+34
| | | | | | | | | | | | | * src/w32-add.h: Remove hack to define pid_t. * src/gpg-error.h.in: Eval macro to define pid_t. * src/mkheader.c (have_sys_types_h, sys_types_h_included): New. (parse_config_h): Test for sys/types.h. (write_special): Protect inclusion of sys/types.h. Define new macro 'define:pid_t'. -- Regression-due-to: 1865c0ba1769b407a3c504f1ab0a4278704a9fc1 Signed-off-by: Werner Koch <[email protected]>
* Minor clean up.NIIBE Yutaka2017-04-191-2/+3
| | | | | | | | * 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]>
* Add support for armv7-unknown-linux-gnueabihf.Werner Koch2017-02-281-0/+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]>
* syscfg: Add powerpc-unknown-linux-gnuspeWerner Koch2016-04-221-0/+1
| | | | --
* Add syscfg alias for x86_64-pc-linux-gnuhardened1Werner Koch2016-01-271-0/+1
| | | | --
* Support i[456]86-pc{,-linux,-kfreebsd}-gnu.hDaniel Kahn Gillmor2015-09-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * src/mkheader (canon_host_triplet): Add new entries. * src/syscfg/lock-obj-pub.i486-pc-gnu.h: Rename to ... * src/syscfg/lock-obj-pub.i686-pc-gnu.h: this. * src/syscfg/lock-obj-pub.i486-pc-kfreebsd-gnu.h: Rename to ... * src/syscfg/lock-obj-pub.i686-pc-kfreebsd-gnu.h: this. * src/syscfg/lock-obj-pub.i486-pc-linux-gnu.h: Remove. * src/Makefile.am (lock_obj_pub): Update. -- i486-pc, i586-pc, and i686-pc all use the same ABI given the GNU userland and a specific kernel. This changeset updates the arch-specific lock-obj header generation to treat the hardware aliases explicitly and should improve cross-building for anyone wanting to target any of these 9 architectures. It also removes src/syscfg/lock-obj-pub.i486-pc-linux-gnu.h, which should be handled by the alias to src/syscfg/lock-obj-pub.i686-pc-linux-gnu.h Debian-Bug-Id: 799177
* Allow building with --disable-threads.Werner Koch2015-06-151-0/+5
| | | | | | | | | | | | | | | | | | | | * src/posix-lock-obj.h (LOCK_ABI_NOT_AVAILABLE): New. (LOCK_ABI_VERSION): Define depending on USE_POSIX_THREADS. (_gpgrt_lock_t) [!USE_POSIX_THREADS]: Do not define the union. * src/gen-posix-lock-obj.c: Take care of USE_POSIX_THREADS. * src/posix-lock.c (_gpgrt_lock_init, _gpgrt_lock_lock) (_gpgrt_lock_trylock, _gpgrt_lock_unlock) (_gpgrt_lock_destroy): Return success for a no-threads version. * tests/t-lock.c: Disable tests if threads are not available. * src/mkheader.c (main): Add NO-THREADS to the printed comment. * configure.ac: Show NO-TRHEADS in the final summary. -- Warning: Using --disable-threads creates a different ABI which we can't encode in the the cpu-vendor-os triplet. The run time checks should detect this and abort the process. Signed-off-by: Werner Koch <[email protected]>
* Remove useless conditions.Werner Koch2015-03-161-1/+1
| | | | | | | | * src/estream.c (fname_set_internal): Remove useless condition. * src/mkheader.c (main): Ditto. -- Detected by Stack 0.3.
* Add host-triplet aliasing feature to mkheader.Werner Koch2015-03-061-4/+46
| | | | | | | | | | | | | | * src/Makefile.am (lock_obj_pub): Rename i586-pc-linux-gnu to i686-pc-linux-gnu. Remove i486-pc-linux-gnu. * src/mkheader.c (canon_host_triplet): New. (main): Use it. -- config.sub does not map i{4,5,6}86-pc-linux-gnu to one common triplet. However, they all use the same ABI and thus we do not need several versions of the syscfg files. Signed-off-by: Werner Koch <[email protected]>
* Fix problems with ssize_t and off_t.Werner Koch2014-09-111-8/+161
| | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Extend the platform dependent build rules.Werner Koch2014-01-171-25/+92
| | | | | | | | | | | | | | | | | | | | * src/mkheader.c (mk_include_name): New. (include_file): Implement '&' substitution. (try_include_file): New. (write_special): Use try_include_file and syscfg/. (main): Add a new arg. * configure.ac (CROSS_COMPILING): New am_conditional. (HOST_TRIPLET_STRING): New ac_define. * src/gen-posix-lock-obj.c (main): Print the host triplet. * src/w32-lock-obj-pub.in: Move to ... * src/syscfg/lock-obj-pub.mingw32.h: here. * src/Makefile.am (lock_obj_pub): New. (pre_mkheader_cmds): New. (gpg-error.h): Run pre_mkheader_cmds. (parts_of_gpg_error_h, lock-obj-pub.native.h): Do not use when cross-compiling. Signed-off-by: Werner Koch <[email protected]>
* Add gpgrt_lock_ functions.Werner Koch2014-01-161-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpg-error.h.in (GPGRT_LOCK_DEFINE): New. (gpgrt_lock_init): New. (gpgrt_lock_lock): New. (gpgrt_lock_unlock): New. (gpgrt_lock_destroy): New. (gpgrt_yield): New. * src/gpg-error.def.in: Add new functions. * m4/lock.m4, m4/threadlib.m4: New. Taken from current gnulib. * configure.ac: Call gl_LOCK. Check size of pthread_mutex_t. Add LIBTHREAD to GPG_ERROR_CONFIG_LIBS. * src/err-codes.h.in (GPG_ERR_INV_LOCK_OBJ): New. * src/gen-posix-lock-obj.c: New. * src/gen-w32-lock-obj.c: New. * src/lock.h, src/thread.h: New. * src/posix-lock-obj.h, src/w32-lock-obj.h: New. * src/posix-lock.c, src/w32-lock.c: New. * src/posix-thread.c, src/w32-thread.c: * src/w32-lock-obj-pub.in: New. * src/mkheader.c (include_file): Support build time include files. (write_special): Add keyword "include:lock-obj". * src/Makefile.am: (posix-lock-obj-pub.in): New rule. (noinst_PROGRAMS): Add gen-*-lock-obj helpers. * tests/t-common.h: New. * tests/t-lock.c: New. * tests/Makefile.am (t_lock_LDADD): Add new test. -- This patch introduces the gpgrt_ functions which will be extended over time to provide a library of commonly used code in GnuPG and Libgcrypt. Having them in a library named libgpg-error is a misnomer but this way we can achieve a smooth upgrade path. In contrasts to other GnuPG libraries, the gpgrt_ functions return a simple gpg_err_code_t and not gpg_error_t. The rationale for this is that a source of error identifier does not make sense here; it is better to use the source of error identifier of the caller. This can easily be achieved in a component by wrapping these function in a gpg_error macro/inline. There is no cross-compiling support for Posix platforms; the gen-posix-lock-obj tool must be run on the target system. Note that the gen-w32-lock-obj tool is not needed at build time but was used to figure out ABI definitions for Windows. Signed-off-by: Werner Koch <[email protected]>
* Improve maintainability by rewriting the mkheader helper.Werner Koch2014-01-141-0/+363
* src/mkheader.c: New. Based on the mkheader from Libassuan. * src/mkheader.awk: Remove. * src/errnos.in: Add trailing linefeed. * src/gpg-error.h.in: Change meta include directives for use with mkheader.c. * src/Makefile.am (EXTRA_DIST): Replace mkheader.awk by mkheader.c (BUILT_SOURCES): Remove extra-h.in. (CLEANFILES): Remove extra-h.in. Add mkheader.c. (parts_of_gpg_error_h): New. (extra-h.in): Remove rule. (mkheader): Add rule. (gpg-error.h): Change rule to use mkheader. Signed-off-by: Werner Koch <[email protected]>