Commit Graph

23 Commits

Author SHA1 Message Date
Jakub Jelinek 2afd3180c5 Update copyright years.
From-SVN: r244052
2017-01-04 12:30:51 +01:00
Roland McGrath efd40fc416 Fix PR63758 by using the _NSGetEnviron() API on Darwin
include/

	Roland McGrath  <roland@gnu.org>

	PR other/63758
	* environ.h: New file.

libiberty/

	Roland McGrath  <roland@gnu.org>
	Iain Sandoe  <iain@codesourcery.com>

	PR other/63758
	* pex-unix.c: Obtain the environment interface from settings in environ.h
	rather than in-line code.  Update copyright date.
	* setenv.c: Likewise.
	* xmalloc.c: Likewise.



Co-Authored-By: Iain Sandoe <iain@codesourcery.com>

From-SVN: r228942
2015-10-18 10:33:37 +00:00
Max Ostapenko 29ce50b031 pex-common.h (struct pex_funcs): Add new parameter for open_write field.
libiberty/

2014-09-26  Max Ostapenko  <m.ostapenko@partner.samsung.com>

	* pex-common.h (struct pex_funcs): Add new parameter for open_write field.
	* pex-unix.c (pex_unix_open_write): Add support for new parameter.
	* pex-djgpp.c (pex_djgpp_open_write): Likewise.
	* pex-win32.c (pex_win32_open_write): Likewise.
	* pex-common.c (pex_run_in_environment): Likewise.


include/

2014-09-26  Max Ostapenko  <m.ostapenko@partner.samsung.com>

	* libiberty.h (PEX_STDOUT_APPEND): New flag.
	(PEX_STDERR_APPEND): Likewise.

From-SVN: r215632
2014-09-26 10:58:04 +03:00
Tristan Gingold c1a969777f pex-unix.c (to_ptr32): Fix style.
2012-04-04  Tristan Gingold  <gingold@adacore.com>

	* pex-unix.c (to_ptr32): Fix style.

From-SVN: r186134
2012-04-04 08:44:30 +00:00
Jakub Jelinek d652f226fc Update Copyright years for files modified in 2010.
From-SVN: r168438
2011-01-03 21:52:22 +01:00
Richard Henderson 3b63ca7ea2 Use spawnve on cygwin.
* configure.ac (AC_CHECK_HEADERS): Add process.h.
	(checkfuncs): Add dup3, spawnve, spawnvpe; sort the list.
	(AC_CHECK_FUNCS): Add dup3, spawnve, spawnvpe.
	* configure, config.in: Rebuild.
	* pex-unix.c [HAVE_SPAWNVE] (pex_unix_exec_child): New function.
	[HAVE_SPAWNVE] (save_and_install_fd, restore_fd): New functions.

From-SVN: r166339
2010-11-04 16:37:04 -07:00
Doug Evans 698861dc8d * pex-unix.c (pex_unix_exec_child): Save/restore environ.
From-SVN: r155079
2009-12-08 07:05:35 +00:00
Ben Elliston 5120dc389f pex-unix.c (pex_child_error): Improve warning avoidance by checking the results of write(3) and exiting with...
* pex-unix.c (pex_child_error): Improve warning avoidance by
	checking the results of write(3) and exiting with -2 if any write
	returns a negative value.

Co-Authored-By: Ian Lance Taylor <iant@google.com>

From-SVN: r154431
2009-11-23 15:42:32 +11:00
Ben Elliston c22c44bac0 pex-unix.c (pex_child_error): Define writeerr macro to avoid unused result warnings from write(3) calls.
* pex-unix.c (pex_child_error): Define writeerr macro to avoid
	unused result warnings from write(3) calls.  Undefine writeerr
	after all uses.

From-SVN: r154344
2009-11-20 08:16:45 +11:00
Douglas B Rupp b303ef5160 pex-unix.c (vfork): Remove VMS specific definition (get from header file instead).
* pex-unix.c (vfork): Remove VMS specific definition (get from header
	file instead).
	(to_ptr32): New function.
	(pex_unix_exec_child): Use it.

From-SVN: r150130
2009-07-27 17:20:32 +00:00
Kai Tietz 1651030c42 [patch]: libiberty pex for _WIN64.
From-SVN: r127761
2007-08-24 09:40:35 +02:00
Ben Elliston 1a8e58a38f * pex-unix.c (writeerr): Cast write result to void.
From-SVN: r120702
2007-01-12 13:21:26 +11:00
Ian Lance Taylor 5317e1c7a9 re PR driver/27622 (gcc hang when compiling with -pipe)
PR driver/27622
	* pex-common.h (struct pex_funcs): Add toclose parameter to
	exec_child field.
	* pex-common.c (pex_run_in_environment): Pass toclose to
	exec_child.
	* pex-djgpp.c (pex_djgpp_exec_child): Add toclose parameter.
	* pex-unix.c (pex_unix_exec_child): Likewise.
	* pex-msdos.c (pex_msdos_exec_child): Likewise.
	* pex-win32.c (pex_win32_exec_child): Likewise.

From-SVN: r116494
2006-08-27 23:50:30 +00:00
Mark Shinwell 239559e797 pex-unix.c (pex_unix_exec_child): Insert cast when assigning to environ.
* pex-unix.c (pex_unix_exec_child): Insert cast when assigning
	to environ.

From-SVN: r114326
2006-06-02 14:36:45 +00:00
Mark Shinwell ea60341e32 Patch to provide pex_run_in_environment.
* include/libiberty.h: Declare pex_run_in_environment.

libiberty:

	* pex-common.c: New function pex_run_in_environment.
	* pex-common.h: Add environment parameter to exec_child.
	* pex-msdos.c: Add environment parameter to pex_msdos_exec_child.
	* pex-djgpp.c: Add environment parameter to pex_djgpp_exec_child.
	(pex_djgpp_exec_child): Pass environment to child process.
	* pex-unix.c: Add environment parameter to pex_unix_exec_child.
	(pex_unix_exec_child): Pass environment to child process.
	* pex-win32.c: Add environment parameter to pex_win32_exec_child.
	New function env_compare for comparing VAR=VALUE pairs.
	(win32_spawn): Assemble environment block and pass to CreateProcess.
	(spawn_script): Pass environment through to win32_spawn.
	(pex_win32_exec_child): Pass environment through to spawn_script and
	win32_spawn.
	* functions.texi: Regenerate.
	* pexecute.txh: Document pex_run_in_environment.

From-SVN: r114302
2006-06-01 10:30:51 +00:00
Jim Blandy 8eff378c61 pex-common.c (pex_input_file, [...]): New functions.
src/libiberty/ChangeLog:
2006-03-29  Jim Blandy  <jimb@codesourcery.com>

	* pex-common.c (pex_input_file, pex_input_pipe): New functions.
	(pex_init_common): Initialize obj->input_file.
	(pex_run): Close any file opened by pex_input_file.
	* pexecute.txh (pex_input_file, pex_input_pipe): New docs.
	* pex-common.h (struct pex_obj): New field input_file.
	(struct pex_funcs): New function ptr fdopenw.
	* pex-unix.c (pex_unix_fdopenw): New function.
	(funcs): List it as our fdopenw function.
	* pex-win32.c (pex_win32_fdopenw): New function.
	(funcs): List it as our fdopenw function.
	* pex-djgpp.c (funcs): Leave fdopenw null.
	* pex-msdos (funcs): Same.
	* functions.texi: Regenerated.

src/include/ChangeLog:
2006-04-10  Jim Blandy  <jimb@codesourcery.com>

	* libiberty.h (pex_input_file, pex_input_pipe): New declarations.

From-SVN: r112883
2006-04-12 06:29:21 +00:00
Gabriel Dos Reis d7cf8390c7 libiberty.h (ACONCAT): Properly cast value of alloca().
include/
2005-05-24  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* libiberty.h (ACONCAT): Properly cast value of alloca().

	* ansidecl.h (ATTRIBUTE_UNUSED_LABEL): Don't define if
	__cplusplus.

libiberty/
2005-05-24  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* configure.ac: Check declarations for calloc(), getenv(),
	malloc(), realloc() and sbrk().
	* config.in: Regenerate.
	* configure: Likewise.

	* alloca.c (C_alloca): Change "new" to "new_storage".  Use XNEWVEC
	instead of xmalloc.
	* choose-temp.c (choose_temp_base): Use XNEWVEC instea od xmalloc.
	* concat.c (liiberty_concat_ptr): Surround definition with an
	extern "C" block, if __cplusplus.
	(concat): Use XNEWVEC instead of xmalloc.
	(reconcat): Likewise.
	* cp-demangle.c (struct d_print_template): Rename member
	"template" to "template_decl".  Adjust use throughout the file.
	(d_print_resize): Properly cast return value of realloc().
	(cplus_demangle_print): Same for malloc().
	(d_demangle): Likewise.
	* cp-demint.c (cplus_demangle_fill_builtin_type): Rename parameter
	"typename" to "type_name".
	* cplus-dem.c (grow_vect): Use XRESIZEVEC instead of xrealloc().
	(work_stuff_copy_to_from): Use XNEWVEC insteand of xmalloc().
	(demangle_template_value_parm): Likewise.
	(demangle_template): Likewise.
	(recursively_demangle): Likewise.
	(do_hpacc_template_literal): Likewise.
	(do_arg): Likewise.
	(remember_type): Likewise.
	(remember_Ktype): Likewise.
	(register_Btype): Likewise.
	(string_need): Use XRESIZEVEC instead of xrealloc().
	* dyn-string.c (dyn_string_init): Use XNEWVEC.
	(dyn_string_new): Use XNEW.
	(dyn_string_resize): Use XRESIZEVEC.
	* fnmatch.c (fnmatch): Rename local variable "not" to "negate".
	* getopt.c (getenv): Declare only if !__cplusplus and !getenv.
	Otherwise include <stdlib.h>.
	(exchange): Cast return value of malloc().
	* hashtab.c (htab_size): Define as both macro and non-inline
	function.
	(htab_elements): Likewise.
	* getpwd.c (getpwd): Use XNEWVEC.
	(htab_create_alloc_ex): Use C90 prototype-style.
	* lrealpath.c (lrealpath): Appropriately cast return value of
	malloc().
	* make-relative-prefix.c (save_string): Likewise.
	* make-temp-file.c (try_dir): Rename from "try".  Adjust use in
	the file.
	(choose_tmpdir): Use XNEWVEC.
	* mkstemps.c (mkstemps): Rename parameter "template" to "pattern".
	* pex-common.c (pex_init_common): Use XNEW.
	(pex_add_remove): Use XRESIZEVEC.
	(pex_run): Likewise.
	(pex_get_status_and_time): Likewise.
	* pex-djgpp.c (pex_djgpp_exec_child): Likewise.
	* pex-msdos.c (pex_init): Use XNEW.
	(pex_msdos_exec_child): Likewise.
	(pex_msdos_exec_child): Use XRESIZEVEC.
	* pex-unix.c (pex_wait): Use XNEW.
	* pex-win32.c (fix_argv): Use XNEWVEC.
	* pexecute.c (pwait): Likewise.
	* setenv.c (setenv): Properly cast return value of malloc().
	* sigsetmask.c (sigsetmask): Rename local variables "old" and
	"new" to "old_sig" and "new_sig".
	* sort.c (main): Use XNEWVEC.
	* spaces.c (spaces): Cast return value of malloc().
	* strndup.c (strndup): Likewise.
	* ternary.c (ternary_insert): Use XNEW.
	* xmalloc.c (malloc, realloc, calloc, sbrk): Surround declaration
	with an extern "C" block if __cplusplus.
	* xstrdup.c (xstrdup): Cast return value of memcpy().
	* xstrerror.c (strerror): Enclose declaration in an extern "C"
	block if __cplusplus.
	* xstrndup.c (xstrndup): Use XNEW. Cast return value of memcpy().

From-SVN: r100115
2005-05-24 20:48:25 +00:00
Nick Clifton ee58dffdbc Update the address and phone number of the FSF organization.
From-SVN: r99519
2005-05-10 15:33:18 +00:00
Ian Lance Taylor a584cf65fa pex-common.c: New file.
libiberty:
	* pex-common.c: New file.
	* pex-one.c: New file.
	* pexecute.c: New file.
	* pex-common.h: Include <stdio.h>.
	(struct pex_obj): Define.
	(struct pex_funcs): Define.
	(pex_init_common): Declare.
	* pex-unix.c: Rewrite.
	* pex-win32.c: Rewrite.
	* pex-djgpp.c: Rewrite.
	* pex-msdos.c: Rewrite.
	* testsuite/text-pexecute.c: New file.
	* pexecute.txh: Rewrite.
	* configure.ac: Check for wait3 and wait4.  Set CHECK to
	really-check rather than check-cplus-dem.
	* functions.texi: Rebuild.
	* Makefile.in: Rebuild dependencies.
	(CFILES): Add pexecute.c, pex-common.c, pex-one.c.
	(REQUIRED_OFILES): Add pexecute.o, pex-common.o, pex-one.o.
	* testsuite/Makefile.in (really-check): New target.
	(check-pexecute, test-pexecute): New targets.
	* configure: Rebuild.
include:
	* libiberty.h: Include <stdio.h>.
	(PEX_RECORD_TIMES, PEX_USE_PIPES, PEX_SAVE_TEMPS): Define.
	(PEX_LAST, PEX_SEARCH, PEX_SUFFIX, PEX_STDERR_TO_STDOUT): Define.
	(PEX_BINARY_INPUT, PEX_BINARY_OUTPUT): Define.
	(pex_init, pex_run, pex_read_output): Declare.
	(pex_get_status, pex_get_times, pex_free, pex_one): Declare.
	(struct pex_time): Define.

From-SVN: r97148
2005-03-29 02:08:46 +00:00
Gabriel Dos Reis 885f2199f3 partition.h: Remove use of PARAMS.
include/
2005-03-27  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        * partition.h: Remove use of PARAMS.
        * obstack.h: Remove conditional prototypes __STDC__.
        * objalloc.h:  Remove use of PARAMS.
        * splay-tree.h: Likewise.

libiberty/
2005-03-27  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        Convert libiberty to use ISO C prototype style 5/n.
        * random.c (srandom, initstate, setstate, random): Use ISO C
        prototypes.
        * putenv.c (putenv): Likewise.
        * physmem.c (physmem_available, physmem_total, main):
        Likewise.
        * pex-win32.c (fix_argv, pexecute, pwait): Likewise.
        * pex-unix.c (pexecute, pwait): Likewise.
        * pex-msdos.c (pexecute, pwait): Likewise.
        * pex-djgpp.c (pexecute, pwait): Likewise.
        * partition.c (partition_new, partition_delete,
        partition_union)
        (elem_compare, partition_print): Likewise.
        * obstack.c (_obstack_begin, _obstack_begin_1,
        _obstack_newchunk,
        _obstack_allocated_p, _obstack_free, obstack_free,
        _obstack_memory_used, print_and_abort, obstack_next_free,
        obstack_object_size, obstack_base): Likewise.  Remove codes
        predicated on !defined(__STDC__).
        * objalloc.c (objalloc_create, _objalloc_alloc, objalloc_free,
        objalloc_free_block): Use ISO C prototypes.
        * mkstemps.c (mkstemps): Likewise.
        * memset.c (memset): Likewise.
        * mempcpy.c (mempcpy): Likewise.
        * rename.c (rename): Likewise.
        * rindex.c (rindex): Likewise.
        * setenv.c (setenv, unsetenv): Likewise.
        * sigsetmask.c (sigsetmask): Likewise.
        * snprintf.c (snprintf): Likewise.
        * sort.c (sort_pointers, xmalloc): Likewise.
        * spaces.c (spaces): Likewise.
        * splay-tree.c (splay_tree_delete_helper,
        splay_tree_splay_helper, splay_tree_splay,
        splay_tree_foreach_helper, splay_tree_xmalloc_allocate,
        splay_tree_new, splay_tree_xmalloc_allocate,
        splay_tree_new_with_allocator, splay_tree_delete,
        splay_tree_insert, splay_tree_remove, splay_tree_lookup,
        splay_tree_max, splay_tree_min, splay_tree_predecessor,
        splay_tree_successor, splay_tree_foreach,
        splay_tree_compare_ints, splay_tree_compare_pointers):
        Likewise.
        * stpcpy.c (stpcpy): Likewise.
        * stpncpy.c (stpncpy): Likewise.
        * strcasecmp.c (strcasecmp): Likewise.
        * strchr.c (strchr): Likewise.
        * strdup.c (strdup): Likewise.

From-SVN: r97125
2005-03-28 04:22:33 +00:00
Matt Kraai ecc30353f4 * pex-unix.c: Fix the spelling of longjmp.
From-SVN: r91507
2004-11-30 02:56:42 +00:00
Ian Lance Taylor fed8129b15 pex-unix.c (pexecute): Use vfork instead of fork, with appropriate changes to make this safe.
* pex-unix.c (pexecute): Use vfork instead of fork, with
	appropriate changes to make this safe.
	* pex-common.h (STDERR_FILE_NO): Define.

From-SVN: r79617
2004-03-18 03:16:37 +00:00
Zack Weinberg 55d0e5e022 Makefile.in (CFILES): Add pex-*.c.
* Makefile.in (CFILES): Add pex-*.c.
	(REQUIRED_OFILES): Change pexecute.o to @pexecute@
	(CONFIGURED_OFILES): Add pex-*.o.
	(TEXIFILES): Add pexecute.txh.
	(pexecute.o): Delete rule.
	(pex-cygwin.o, pex-djgpp.o, pex-mpw.o, pex-msdos.o, pex-os2.o,
	pex-unix.o, pex-win32.o): New rules.
	* configure.in: Change AC_INIT argument to xmalloc.c.
	Compute appropriate pexecute implementation and substitute it
	as @pexecute@.

	* pexecute.c: Split up into...
	* pex-cygwin.c, pex-djgpp.c, pex-mpw.c, pex-msdos.c, pex-os2.c,
	pex-unix.c, pex-win32.c, pex-common.h, pexecute.txh: ... these
	new files.

	* functions.texi: Regenerate.
	* configure: Regenerate.

From-SVN: r61728
2003-01-24 20:02:11 +00:00