Fixes <http://bugs.gnu.org/18988>.
Reported by Chris Vine <chris@cvine.freeserve.co.uk>.
* libguile/filesys.c (scm_select): Clarify handling of signal
interruptions.
* doc/ref/posix.texi (Ports and File Descriptors): Adjust accordingly.
* doc/ref/posix.texi (Signals): Fix the documentation for setitimer; it
was wrong.
* libguile/scmsigs.c (pack_tv): New helper. Allow usecs >= 1e6.
(unpack_tv): New helper.
(scm_setitimer): Use the new helpers.
* test-suite/tests/signals.test: Add setitimer tests.
* libguile/ports-internal.h (struct scm_port_internal): Add
setvbuf' field. Change 'pending_eof' to a 1-bit unsigned char.
* libguile/ports.c (scm_new_port_table_entry): Clear 'pti->setvbuf'.
* libguile/fports.c (scm_setvbuf): Accept any open port, and error out
when PORT's setvbuf' field is NULL. Remove explicit 'scm_gc_free' calls.
(scm_i_fdes_to_port): Set PORT's 'setvbuf' field.
* test-suite/tests/ports.test ("setvbuf")["closed port", "string port"]:
New tests.
* doc/ref/posix.texi (Ports and File Descriptors): Suggest that
'setvbuf' works for different port types.
* libguile/filesys.c (scm_sendfile)[HAVE_SYS_SENDFILE_H &&
HAVE_SENDFILE]: Compare RESULT with C_COUNT. Loop until C_COUNT bytes
have been sent.
* doc/ref/posix.texi (File System): Update the description. Explain the
new semantics.
* test-suite/tests/filesys.test ("sendfile"): Rewrite using
`pass-if-equal'. Check the return value for all the tests.
["file with offset past the end", "file with offset near the end"]:
New tests.
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'.
In response to <http://bugs.gnu.org/13958>.
Reported by Lluís Batlle i Rossell <viric@viric.name>.
* doc/ref/posix.texi (Network Databases): Document the missing errno
value for EAI_SYSTEM.
* libguile/net_db.c (scm_getaddrinfo): Likewise.
* configure.ac: Check for <sys/sendfile.h> and `sendfile'.
* libguile/filesys.c (scm_sendfile): New function.
* libguile/filesys.h (scm_sendfile): New declaration.
* test-suite/tests/filesys.test ("sendfile"): New test prefix.
* doc/ref/posix.texi (File System): Document `sendfile'.
* 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.
* 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.
* doc/ref/api-compound.texi
* doc/ref/api-evaluation.texi
* doc/ref/api-foreign.texi
* doc/ref/api-io.texi
* doc/ref/posix.texi
* doc/ref/srfi-modules.texi: Add missing parentheses and commas to definitions
of C functions.
* doc/ref/api-data.texi: Change from @deffn to @deftypefn for C function
with arguments not of SCM type.
* doc/ref/posix.texi (Network Databases): Update description of
`EAI_NODATA' to mention that Darwin provides it.
* libguile/net_db.c (scm_getaddrinfo): Likewise.
* test-suite/tests/net-db.test ("getaddrinfo")["wrong service name"]:
Accept `EAI_NODATA' too. Reported by David Fang <fang@csl.cornell.edu>,
see <http://bugs.gnu.org/10684>.
* libguile/socket.c (scm_recv, scm_send, scm_recvfrom, scm_sendto):
Expect the buffer to be a bytevector. Move the string-handling
code under `#if SCM_ENABLE_DEPRECATED == 1' and issue a deprecation
warning.
* test-suite/tests/socket.test ("AF_UNIX/SOCK_DGRAM")["sendto",
"sendto/sockaddr"]: Adjust accordingly.
* doc/ref/posix.texi (Network Sockets and Communication): Update
documentation of `recv!', `send', `recvfrom!', and `sendto'.
* libguile/posix.c (scm_total_processor_count,
scm_current_processor_count): New functions.
* libguile/posix.h (scm_total_processor_count,
scm_current_processor_count): New declarations.
* test-suite/tests/posix.test ("nproc"): New test prefix.
* doc/ref/posix.texi (Processes): Document `total-processor-count' and
`current-processor-count'.
* doc/ref/posix.texi (Processes): Add cross-reference from `setaffinity'
and `getaffinity' to the corresponding node in the glibc manual.
* libguile/posix.c (scm_getaffinity, scm_setaffinity): Likewise.
* configure.ac: Add checks for `sched_setaffinity' and
`sched_getaffinity'.
* doc/ref/posix.texi (Processes): Document `getaffinity' and
`setaffinity'.
* libguile/posix.c (cpu_set_to_bitvector,
scm_getaffinity)[HAVE_SCHED_GETAFFINITY]: New functions.
(scm_setaffinity)[HAVE_SCHED_SETAFFINITY]: New function.
* libguile/posix.h (scm_getaffinity, scm_setaffinity): New declarations.
* test-suite/tests/posix.test ("affinity"): New test prefix.
* libguile/posix.c:
* libguile/posix.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_cuserid): Deprecate cuserid, as it only
returns 8 bytes of a user's login.
* doc/ref/posix.texi: Remove cuserid from docs.
* libguile/posix.h:
* libguile/posix.c (scm_utime): Add optional nanosecond arguments. This
is an incompatible change on the C level, but it's unlikely people are
using this POSIX wrapper function, because they would just use the
POSIX function directly. Hopefully, anyway.
* module/system/base/compile.scm (call-with-output-file/atomic):
Propagate source timestamps to targets with nanosecond precision, if
available. Fixes build on systems with ext4 filesystems.
* libguile/filesys.c (scm_stat2scm):
* module/ice-9/posix.scm (stat:atimensec, stat:mtimensec)
(stat:ctimensec): Add three new elements to Scheme stat structures,
for nanosecond-level timestamps.
* configure.ac: Add checks for utimensat, and for nanosecond fields in
struct stat. We should switch to using Gnulib things for these,
though.
* doc/ref/posix.texi (File System): Add documentation for utime's
additional arguments, and nanosecond stat timestamp accessors.
because it looks better in the DVI output. Exceptions are
- wide examples, which would cause overfull hboxes if they
used the bigger @lisp font
- very large examples, which may look too big at the @lisp size.
As the Autoconf documentation says, "These days portable programs
[...] should not rely on `HAVE_RESTARTABLE_SYSCALLS', since nowadays
whether a system call is restartable is a dynamic issue, not a
configuration-time issue."
In other words, if we ever rely on HAVE_RESTARTABLE_SYSCALLS, we are
at the mercy of any code that Guile happens to be linked with, because
that code could install a signal handler without the SA_RESTART flag,
and then a Guile system call could unexpectedly return EINTR.
The readline part of this goes back to this problem report:
http://sources.redhat.com/ml/guile/2000-05/msg00177.html; and is an
excellent example of the above paragraph. It was noted during the
discussion that undefining HAVE_RESTARTABLE_SYSCALLS would fix the
problem, but that solution wasn't adopted - I guess because Guile was
still using cooperative threads then (not pthreads) and so there was a
significant concern (whether founded or not) that not using
restartable syscalls (where available) could lead to a loss of
performance.
Now Guile's default mode of operation is with pthreads, where we
already don't assume that HAVE_RESTARTABLE_SYSCALLS is reliable, so
there is no possible further performance loss. And in any case we
really have no choice, if we want correct operation.
Thanks to Sylvain Beucler for reporting this and suggesting the fix.
* configure.in (AC_SYS_RESTARTABLE_SYSCALLS): Removed.
* doc/ref/posix.texi (Signals): Remove statement that Guile always
sets SA_RESTART flag.
* guile-readline/configure.in (GUILE_SIGWINCH_SA_RESTART_CLEARED):
Remove this setting, together with its test code.
(HAVE_RL_PRE_INPUT_HOOK): Remove this setting and its code, as no
longer needed.
* guile-readline/readline.c (sigwinch_enable_restart): Removed.
(scm_init_readline): Remove setting of rl_pre_input_hook.
* libguile/_scm.h (SCM_SYSCALL): Remove the definition that relies on
HAVE_RESTARTABLE_SYSCALLS.
* libguile/scmsigs.c (scm_sigaction_for_thread): Don't always set the
SA_RESTART flag if available. Update docstring accordingly.
(scm_init_scmsigs): Remove code that sets SA_RESTART flag for all
signals.
* THANKS: Add Sylvain.