summaryrefslogtreecommitdiff
path: root/libguile/posix.c
Commit message (Expand)AuthorAgeFilesLines
* Treat 'SIG_IGN' as a pointer....* libguile/posix.c (scm_system_star): Cast 'SIG_IGN' to 'scm_t_uintptr_t' and use 'scm_from_uintptr_t'. This fixes an 'int-conversion' warning with GCC 6.2. Ludovic Courtès2017-03-011-3/+5
* Elide syscalls in fdes->port...* libguile/fports.h (scm_t_fport): Add options field. (SCM_FDES_RANDOM_P): Deprecate. (scm_i_fdes_to_port): Add options argument. * libguile/fports.c (scm_i_fdes_to_port): Add options argument. Only verify FD if SCM_FPORT_OPTION_VERIFY is there. (scm_fdes_to_port, scm_open_file_with_encoding): Adapt to scm_i_fdes_to_port changes. (fport_random_access_p): Don't try to seek if NOT_SEEKABLE option is set. * libguile/deprecated.h: * libguile/deprecated.c (SCM_FDES_RANDOM_P): Deprecate. * NEWS: Add deprecation. * libguile/filesys.c: * libguile/ioext.c: * libguile/posix.c: * libguile/read.c: * libguile/socket.c: Adapt callers. Andy Wingo2017-02-141-4/+10
* Fix compile warning in posix.c...* libguile/posix.c (scm_system_star): Fix SIG_IGN usage to not emit a warning. Still broken on Windows64 and similar systems though! Andy Wingo2016-09-141-2/+4
* Move system* to posix.c, impl on open-process...* libguile/simpos.c: Trim includes. (scm_system_star): Move to posix.c. * libguile/simpos.h (scm_system_star): Remove. * libguile/posix.h (scm_system_star): Add. * libguile/posix.c (scm_system_star): Move here and implement in terms of open-process. This lets system* work on Windows. Inspired by a patch by Eli Zaretskii. (start_child): Exit with 127 if the command isn't found. Andy Wingo2016-08-311-1/+71
* Add popen feature...* doc/ref/api-options.texi (Common Feature Symbols): Document the popen feature. * doc/ref/posix.texi (Pipes): Depend on the popen feature, not fork. * libguile/posix.c (scm_init_posix): Add popen feature if we can. Andy Wingo2016-07-251-0/+1
* Add POSIX shims for MinGW...* libguile/posix-w32.h: * libguile/posix-w32.c (kill, waitpid, getpriority, setpriority) (sched_getaffinity, sched_setaffinity): Add MinGW implementations. Also, provides macros that on Posix hosts are in sys/wait.h, like WIFEXITED and WTERMSIG. (start_child): Add implementation. Eli Zaretskii2016-07-251-1/+1
* Rename win32-uname.[ch] to posix-w32.[ch]...* libguile/posix-w32.c: * libguile/posix-w32.h: Rename from win32-uname.c and win32-uname.h. * libguile/posix.c: * libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES) (noinst_HEADERS): Adapt. Andy Wingo2016-07-251-4/+4
* Factor start_child out of open_process...* libguile/posix.c (start_child): Factor out from open_process. Based on initial work by Eli Zaretskii. Andy Wingo2016-07-251-84/+104
* More specific status:exit-val et al compilation guards...* libguile/posix.c (scm_status_exit_val, scm_status_term_sig) (scm_status_stop_sig): Guard on WIFEXITED et al macros instead of on MinGW. Andy Wingo2016-07-251-2/+6
* getaffinity, setaffinity docstring cleanup...* libguile/posix.c (scm_getaffinity, scm_setaffinity): Clean up docstrings. Obviously if you have the function, you don't need to be told that you have it in the docstring. Andy Wingo2016-07-251-12/+2
* Provide `kill' only if supported by the host...* libguile/posix.c (scm_kill): Only provide if the host has `kill'. An incompatible change on MinGW, where this function would work only if the PID was the current PID, but that will be fixed by the next process. Andy Wingo2016-07-251-19/+2
* More robust setuid, setgid, etc detection...* configure.ac: Check for getuid, getgid, setuid, and setgid. * libguile/posix.c (scm_getuid, scm_getgid, scm_setuid, scm_setgid): Only provide Scheme functions if the OS provides these facilities. (scm_geteuid, scm_getegid, scm_seteuid, scm_setegid): Provide if the host has getuid, getgid, etc, instead of being in a MinGW guard. Andy Wingo2016-07-251-14/+16
* Merge branch 'stable-2.0'...Conflicts: benchmark-suite/benchmarks/ports.bm libguile/async.h libguile/bytevectors.c libguile/foreign.c libguile/gsubr.c libguile/srfi-1.c libguile/vm-engine.h libguile/vm-i-scheme.c module/Makefile.am module/language/tree-il/analyze.scm module/language/tree-il/peval.scm module/scripts/compile.scm module/scripts/disassemble.scm test-suite/tests/asm-to-bytecode.test test-suite/tests/peval.test test-suite/tests/rdelim.test Mark H Weaver2014-09-301-9/+13
|\
| * Add 'EXIT_SUCCESS' and 'EXIT_FAILURE'....Suggested by Frank Terbeck <ft@bewatermyfriend.org>. * libguile/posix.c (scm_init_posix): Define 'EXIT_SUCCESS' and 'EXIT_FAILURE'. * doc/ref/posix.texi (Processes): Document them. Ludovic Courtès2014-09-221-0/+6
| * Fix calculation of CPU set size for getaffinity....* libguile/posix.c (cpu_set_to_bitvector): Use CPU_SETSIZE, not sizeof, to compute the size of the CPU set. Eli Zaretskii2014-07-031-2/+2
| * Slightly simplify 'scm_open_process'....* libguile/posix.c (scm_open_process): Call 'scm_fdes_to_port' with the '0' flag, and remove 'scm_setvbuf' calls. Ludovic Courtès2014-05-281-7/+5
* | Merge branch 'stable-2.0'...Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c Mark H Weaver2014-04-251-3/+2
|\|
| * Rely on Gnulib for <unistd.h>....* libguile/async.c: * libguile/backtrace.c: * libguile/error.c: * libguile/filesys.c: * libguile/fports.c: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/gdbint.c: * libguile/init.c: * libguile/ioext.c: * libguile/load.c: * libguile/mallocs.c: * libguile/mkstemp.c: * libguile/ports.c: * libguile/posix.c: * libguile/r6rs-ports.c: * libguile/random.c: * libguile/rw.c: * libguile/scmsigs.c: * libguile/script.c: * libguile/simpos.c: * libguile/socket.c: * libguile/stime.c: * libguile/strports.c: * libguile/threads.c: Unconditionally include <unistd.h>. Mark H Weaver2014-02-271-3/+2
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: libguile/keywords.c libguile/vm.c Mark H Weaver2013-07-161-2/+2
|\|
| * Fix #ifdefery for `setegid'....* libguile/posix.c (scm_setegid): Change to #ifdef HAVE_SETEGID. Ludovic Courtès2013-06-161-2/+2
* | Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2013-03-301-0/+1
|\|
| * build: Build and check (ice-9 popen) only when --enable-posix and HAVE_FORK....Fixes <http://bugs.gnu.org/13848>. Reported by Jan Schukat <shookie@email.de>. * configure.ac: Rename `HAVE_FORK' conditional to `BUILD_ICE_9_POPEN'. Set it when both $enable_posix and $ac_cv_func_fork are true. * libguile/posix.c (scm_init_posix): Add the `fork' feature. * doc/ref/api-options.texi (Common Feature Symbols): Add `fork'. * doc/ref/posix.texi (Pipes): Add footnote mentioning the `fork' feature. * module/Makefile.am (SCRIPTS_SOURCES): Make `scripts/autofrisk.scm' and `scripts/scan-api.scm' conditional on `BUILD_ICE_9_POPEN'. * test-suite/tests/popen.test (if-supported): New macro. Wrap body in `if-supported'. Ludovic Courtès2013-03-291-0/+1
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: configure.ac libguile/deprecated.c libguile/deprecated.h libguile/filesys.h libguile/fluids.c libguile/fports.c libguile/gc.c libguile/guile.c libguile/numbers.c libguile/objcodes.c libguile/r6rs-ports.c libguile/smob.c libguile/socket.c libguile/threads.h module/language/scheme/decompile-tree-il.scm module/language/tree-il/peval.scm test-suite/tests/syncase.test Mark H Weaver2013-03-281-75/+33
|\|
| * provide getlogin declaration if needed....* configure.ac: Check for getlogin decl. * libguile/posix.c: Declare getlogin if needed. Andy Wingo2013-03-091-0/+7
| * fix mingw issues with posix.c...* libguile/posix.c (scm_execl, scm_execlp, scm_execle) (scm_open_process): Remove casts for ancient mingw. (scm_utime): If we fall back to utime, assert that flags is 0. (scm_getlogin): Rely on gnulib. Andy Wingo2013-03-091-32/+10
| * simplify posix.c...* libguile/posix.c: Reorder includes to fix mingw include-order problem. Remove ttyname shims; gnulib is the place to fix that. Remove winsock2 include, as gnulib seems to handle that OK. Rely on the new pipe-posix gnulib module. Don't bother shimming getlogin, etc on mingw; gnulib is the place for shims. Andy Wingo2013-03-091-44/+17
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: libguile/array-handle.c libguile/deprecated.h libguile/inline.c libguile/inline.h module/ice-9/deprecated.scm module/language/tree-il/peval.scm Andy Wingo2013-02-181-1/+3
|\|
| * Fix `getgroups' for when zero supplementary group IDs exist....* libguile/posix.c (scm_getgroups): Return the empty vector when NGROUPS is zero. Reported by Mike Gran <spk121@yahoo.com>. Ludovic Courtès2013-02-161-1/+3
| * warn on multithreaded fork...* libguile/posix.c (scm_fork): Issue a warning on a multithreaded fork. * doc/ref/posix.texi (Processes): Add note about multithreaded fork. * test-suite/tests/00-socket.test: Moved here, from socket.test, so as to run before any threads are created. * test-suite/Makefile.am: Adapt. Andy Wingo2013-01-171-0/+16
* | warning instead of error on multithreaded fork...* libguile/posix.c (scm_fork): Issue a warning instead of an error on a multithreaded fork. * doc/ref/posix.texi (Processes): Add note about multithreaded fork. Andy Wingo2013-01-171-2/+6
* | Merge remote-tracking branch 'origin/stable-2.0'...There is a failing test due to a scm_from_utf8_stringn bug brought out by the iconv test that will be fixed in the next commit. Conflicts: libguile/deprecated.h module/ice-9/deprecated.scm Andy Wingo2013-01-151-21/+4
|\|
| * slight open-pipe* / open-process refactor...* libguile/posix.c (scm_open_process): Return the ports as values instead of calling out to Scheme again to make-rw-port. This function is private to (ice-9 popen). * module/ice-9/popen.scm (open-pipe*): Adapt to change. Andy Wingo2013-01-081-21/+4
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: GUILE-VERSION libguile/posix.c module/ice-9/eval.scm test-suite/tests/cse.test Mark H Weaver2013-01-071-2/+5
|\|
| * Remove reference to `scm_init_popen' when `fork' is unavailable....Fixes <http://bugs.gnu.org/12477>. Reported by lin ray <lin.wei.ray@gmail.com>. * configure.ac: Define the `HAVE_FORK' Automake conditional. * module/Makefile.am (ICE_9_SOURCES): Add `ice-9/popen.scm' only when HAVE_FORK. * libguile/posix.c (scm_init_posix): Register `scm_init_popen' only when HAVE_FORK. Ludovic Courtès2012-11-231-2/+5
* | run finalizers asynchronously (in asyncs and/or pthreads)...* libguile/finalizers.c: New excitement! We'll be running finalizers in threads, if that's available. If it's not available, during early boot, we can run finalizers in asyncs. This will make it safer to allocate while holding a mutex. * libguile/posix.c (scm_fork): Shut down the finalizer thread before forking. * libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism during boot and, if available, initialialize the finalizer thread at the very end. * libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing on demand. (scm_gc): Explicitly run finalizers here. If you're calling this function, you probably want synchronous GC. Andy Wingo2012-02-241-0/+1
* | signal an error on multithreaded fork...* libguile/posix.c (scm_fork): Signal an error if a `fork' is attempted after threads have been spawned. * test-suite/tests/00-socket.test: Moved here, from socket.test, so as to run before any threads are created. * test-suite/Makefile.am: Adapt. Andy Wingo2012-02-241-1/+13
* | Revert "install pthread_atfork handlers for guile's static mutexen"...This reverts commit 6a97b1f93aace5c7c976aef51d36b3ae9cfd5630. Andy Wingo2012-02-231-2/+1
* | Merge remote-tracking branch 'local-2.0/stable-2.0'...Conflicts: module/language/tree-il/analyze.scm Andy Wingo2012-02-231-0/+208
|\|
| * rewrite open-process in C, for robustness...* libguile/posix.c (scm_open_process): Rewrite in C, so as to avoid allocations and other calls that are not async-signal-safe. (scm_init_popen, scm_init_posix): Register popen extension. * module/ice-9/popen.scm: Load the popen extension, to get open-process. Andy Wingo2012-02-231-0/+208
* | install pthread_atfork handlers for guile's static mutexen...* libguile/async.c: * libguile/deprecation.c: * libguile/fluids.c: * libguile/gc.c: * libguile/instructions.c: * libguile/ports.c: * libguile/posix.c: * libguile/strings.c: * libguile/threads.c: Use the SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX mechanism to lock a number of static mutexen. Andy Wingo2012-02-171-1/+2
|/
* Improve the usage of variable names in C docstrings....* libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/generalized-arrays.c: * libguile/hashtab.c: * libguile/ioext.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/procprop.c: * libguile/promises.c: * libguile/simpos.c: * libguile/socket.c: * libguile/srfi-1.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/symbols.c: * libguile/threads.c: * libguile/weak-table.c: * libguile/weak-vector.c: Make the variable names in the C docstrings more consistent. Replace a few instances of @var with @code when appropriate. Bake Timmons2012-02-021-19/+21
* fix scm_tmpfile leak...* libguile/posix.c (scm_tmpfile): Fix to actually close the new tmpfile, causing its deletion, while keeping an fd to the file open. Fixes a leak both in memory and disk space on POSIX systems; MINGW systems will leak however. A FIXME for later. Andy Wingo2011-08-171-1/+11
* scm_is_false instead of == SCM_BOOL_F; also is_null, is_true, etc...* libguile/deprecation.c (scm_issue_deprecation_warning) * libguile/eval.c (CAPTURE_ENV): * libguile/goops.c (make_dispatch_procedure, make_class_from_symbol): (create_smob_classes): * libguile/guardians.c (finalize_guarded, scm_i_get_one_zombie): * libguile/hashtab.c (scm_fixup_weak_alist, scm_internal_hash_fold): * libguile/i18n.c (scm_nl_langinfo) * libguile/load.c (scm_primitive_load) * libguile/posix.c (scm_setrlimit) * libguile/socket.c (scm_to_sockaddr): * libguile/srcprop.c (scm_make_srcprops): Use scm_is_false / scm_is_true / scm_is_null instead of comparing against SCM_BOOL_F et al. Andy Wingo2011-05-131-2/+2
* scm_is_eq for SCM vals, not == or !=...* libguile/bytevectors.c (scm_make_bytevector, STRING_TO_UTF) (UTF_TO_STRING): * libguile/continuations.c (scm_i_check_continuation): * libguile/expand.h (SCM_EXPANDED_P): * libguile/fluids.c (scm_i_make_with_fluids): * libguile/generalized-vectors.c (scm_make_generalized_vector): * libguile/goops.c (SCM_GOOPS_UNBOUNDP, slot_definition_using_name): (scm_c_extend_primitive_generic, more_specificp, scm_make) * libguile/i18n.c (SCM_VALIDATE_OPTIONAL_LOCALE_COPY): (scm_locale_string_to_integer) * libguile/modules.c (resolve_duplicate_binding): (scm_module_reverse_lookup) * libguile/posix.c (scm_to_resource): * libguile/r6rs-ports.c (scm_put_bytevector): * libguile/socket.c (scm_connect, scm_bind, scm_sendto * libguile/stacks.c (find_prompt): * libguile/variable.c (scm_variable_ref, scm_variable_bound_p): * libguile/vm-engine.h (ASSERT_BOUND_VARIABLE, ASSERT_BOUND) * libguile/vm-i-system.c (VARIABLE_BOUNDP, local_bound) (long_local_bound, fluid_ref): Use scm_is_eq to compare, not == / !=. Andy Wingo2011-05-131-15/+15
* Move `{total,current}-processor-count' outside of `posix.c'....* libguile/posix.c (scm_total_processor_count, scm_current_processor_count): Move to... * libguile/threads.c: ... here. * libguile/posix.h (scm_total_processor_count, scm_current_processor_count): Move declarations to... * libguile/threads.h: ... here. * test-suite/tests/posix.test ("nproc"): Move tests to... * test-suite/tests/threads.test: ... here. Ludovic Courtès2011-04-251-31/+0
* Allow compilation with `--disable-posix'....Reported by Dmitry Dzhus <dima@dzhus.org>. * configure.ac: Remove `AC_LIBOBJ([filesys])'. Document `--disable-posix' as omitting non-essential POSIX interfaces. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Add `filesys.c'. (DOT_DOC_FILES): Add `filesys.doc'. (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove `filesys.c'. * libguile/posix.c (scm_mkstemp, scm_access): Move to `filesys.c'. (scm_init_posix): Move `R_OK' etc. to `filesys.c'. * libguile/filesys.c (scm_chown, scm_chmod, scm_umask, scm_open_fdes, scm_open, scm_close, scm_close_fdes, scm_link, scm_tc16_dir, scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir, scm_closedir, scm_dir_print, scm_dir_free, scm_chdir, scm_getcwd, set_element, fill_select_type, get_element, retrieve_select_type, scm_select, scm_fcntl, scm_fsync, scm_symlink, scm_readlink, scm_lstat, scm_copy_file): Conditionalize on HAVE_POSIX. (scm_mkstemp, scm_access): New functions. (scm_init_filesys): Conditionalize `scm_tc16_dir', `O_RDONLY', etc. on HAVE_POSIX. Define `R_OK', `W_OK', etc. * libguile/fports.c (fport_print): Use `scm_ttyname' only when HAVE_POSIX. * libguile/i18n.c (lock_locale_mutex, unlock_locale_mutex): New functions. Update users of `scm_i_locale_mutex' to use them. * libguile/init.c (scm_i_init_guile): Always call `scm_init_filesys'. * meta/guile-tools.in (main): Use `setlocale' only when it is defined. * module/ice-9/boot-9.scm: Always load `ice-9/posix'. Ludovic Courtès2011-04-151-106/+0
* Include <sched.h> in `posix.c'....* configure.ac: Check for <sched.h>. * libguile/posix.c [HAVE_SCHED_H]: Include <sched.h>, for `sched_setaffinity' & co. Reported by Marco Maggi <marco.maggi-ipsu@poste.it>. Ludovic Courtès2011-04-141-0/+4
* fix code that causes warnings on gcc 4.6...* libguile/arrays.c (scm_i_read_array): * libguile/backtrace.c (display_backtrace_body): * libguile/filesys.c (scm_readdir) * libguile/i18n.c (chr_to_case): * libguile/ports.c (register_finalizer_for_port): * libguile/posix.c (scm_nice): * libguile/stacks.c (scm_make_stack): Clean up a number of set-but-unused vars. Thanks to Douglas Mencken for the report. * libguile/numbers.c (scm_log, scm_exp): Fix a few #if cases that should be #ifdef. Andy Wingo2011-03-171-3/+1
* Add `scm_i_set_default_port_encoding' and `scm_i_default_port_encoding'....* libguile/ports.c (scm_i_set_default_port_encoding, scm_i_default_port_encoding): New function. Replace `scm_i_set_port_encoding_x' and `scm_i_get_port_encoding' with PORT == SCM_BOOL_F. (scm_i_set_port_encoding_x): Assume PORT is a port. (scm_i_get_port_encoding): Remove. (scm_port_encoding): Adjust accordingly. (scm_new_port_table_entry): Use `scm_i_default_port_encoding'. * libguile/ports.h (scm_i_get_port_encoding): Remove declarations. (scm_i_default_port_encoding, scm_i_set_default_port_encoding): New declarations. * libguile/posix.c (setlocale): Use `scm_i_set_default_port_encoding'. Ludovic Courtès2011-02-101-1/+3
* Fix incorrect FUNC_NAME for scm_current_processor_count...* libguile/posix.c (scm_current_processor_count): Fix incorrect FUNC_NAME (was s_scm_total_processor_count) Mark H Weaver2011-01-281-2/+2