summaryrefslogtreecommitdiff
path: root/libguile/socket.c
Commit message (Expand)AuthorAgeFilesLines
* Conditionally define SOCK_CLOEXEC, SOCK_NONBLOCK...* libguile/socket.c (scm_init_socket): Conditionally define SOCK_CLOEXEC and SOCK_NONBLOCK. Fixes compilation on macOS. Andy Wingo2017-02-211-2/+5
* Add accept4 support...* doc/ref/posix.texi (Network Sockets and Communication): Add documentation. * libguile/socket.c (scm_accept4): New function, replaces accept implementation. (scm_accept): Call scm_accept4. (scm_init_socket): Define SOCK_CLOEXEC and SOCK_NONBLOCK. * libguile/socket.h: Add private scm_accept4 decl. * module/ice-9/suspendable-ports.scm (accept): Update. Andy Wingo2017-02-151-6/+20
* Switch to accept4...* lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Switch from accept gnulib module to accept4. * libguile/socket.c (scm_accept): Use accept4. Andy Wingo2017-02-151-1/+1
* 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
* Support `connect' on nonblocking sockets...* libguile/socket.c (scm_connect): * doc/ref/posix.texi (Network Sockets and Communication): Support connect on nonblocking ports. Andy Wingo2016-06-091-2/+5
* `accept' on nonblocking socket can return #f...* doc/ref/posix.texi (Network Sockets and Communication): * libguile/socket.c (scm_accept): Return #f if the socket is nonblocking and no connection is ready. Andy Wingo2016-06-091-11/+14
* socket: TCP_CORK, TCP_NODELAY...* libguile/socket.c (scm_init_socket): Define TCP_NODELAY and TCP_CORK if they are available. * doc/ref/posix.texi (Network Sockets and Communication): Add documentation. * NEWS: Add entry. Andy Wingo2016-06-041-0/+9
* Fix getsockopt/setsockopt handling of SO_SNDBUF/SO_RCVBUF options....Reported by Park SungMin <byulparan_eng@icloud.com> in <https://lists.gnu.org/archive/html/guile-user/2015-11/msg00026.html>. * libguile/socket.c (scm_getsockopt, scm_setsockopt): Remove code that incorrectly assumed that the argument for SO_SNDBUF and SO_RCVBUF options was of type 'size_t'. Both the Linux and POSIX documentation indicates that the argument is of type 'int', as is the case for most options. Mark H Weaver2016-05-221-28/+2
* 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/+1
|\
| * Use 'offsetof' to avoid undefined behavior....* libguile/socket.c (SUN_LEN): Use 'offsetof'. Mark H Weaver2014-03-111-1/+1
| * 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-2/+0
* | Merge commit 'b9b88351ea2c4b43a6f90938554dc5693b17e328'...Conflicts: libguile/deprecated.h test-suite/tests/00-socket.test Andy Wingo2014-02-081-45/+1
|\|
| * Deprecate htons, htonl, ntohs, ntohl...* libguile/sockets.h: * libguile/sockets.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_htons, scm_htonl, scm_ntohs, scm_ntohl): Deprecate. Bytevectors adequately subsume their functionality. * doc/ref/posix.texi: * test-suite/tests/00-socket.test: Update. Andy Wingo2014-02-081-45/+1
* | Merge branch 'stable-2.0'...Conflicts: module/system/vm/traps.scm test-suite/tests/peval.test Mark H Weaver2014-01-091-1/+1
|\|
| * Hide EINTR returns from 'accept'....* libguile/socket.c (scm_accept): Wrap 'accept' call in 'SCM_SYSCALL'. Ludovic Courtès2013-12-151-1/+1
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: libguile/keywords.c libguile/vm.c Mark H Weaver2013-07-161-1/+1
|\|
| * Define `AF_UNIX' only when Unix-domain sockets are supported....* libguile/socket.c (scm_init_socket): Defined `AF_UNIX' only when `HAVE_UNIX_DOMAIN_SOCKETS' is defined. Reported by Eli Zaretskii <eliz@gnu.org>. Ludovic Courtès2013-06-161-1/+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-26/+25
|\|
| * Define the new Linux-specific `SO_REUSEPORT'....* libguile/socket.c (scm_init_socket)[SO_REUSEPORT]: Define `SO_REUSEPORT'. (scm_setsockopt, scm_getsockopt): Update docstring. * doc/ref/posix.texi (Network Sockets and Communication): List `SO_REUSEPORT'. Ludovic Courtès2013-03-181-0/+5
| * mingw include order for socket.c...* libguile/socket.c: Reorder includes to fix include order on mingw. Andy Wingo2013-03-091-17/+19
| * squish remove some mingw-specific code that is covered by gnulib...* libguile/socket.c (scm_init_socket): Remove mingw-specific code. * libguile/fports.c: Remove ftruncate redefine; mingw is fine. (scm_i_fdes_to_port): If we have no F_GETFL, just do an fstat. The right place for an F_GETFL replacement would be in gnulib. (fport_input_waiting): Remove an outdated comment. * libguile/error.c (SCM_I_STRERROR, SCM_I_ERRNO): Remove, replacing uses with strerror and errno. * libguile/win32-socket.c: * libguile/win32-socket.h: Remove. Mingw has suitable replacements. * configure.ac: * libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (noinst_HEADERS): Update for win32-socket removal. Andy Wingo2013-03-091-14/+2
* | 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-1/+7
|\|
| * Verify the value of `SHUT_RD' and related constants....* libguile/socket.c: Add `verify' clauses for the values of `SHUT_RD', `SHUT_WR', and `SHUT_RDWR'. Ludovic Courtès2012-12-101-1/+7
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c Andy Wingo2012-02-081-4/+4
|\|
| * 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-4/+4
* | merge strictness branch from 2.0Andy Wingo2011-05-131-5/+5
|\|
| * 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-3/+3
* | remove all deprecated code...* libguile/async.c: * libguile/async.h: * libguile/debug.h: * libguile/deprecated.c: * libguile/deprecated.h: * libguile/evalext.h: * libguile/gc-malloc.c: * libguile/gc.h: * libguile/gen-scmconfig.c: * libguile/numbers.c: * libguile/ports.c: * libguile/ports.h: * libguile/procprop.c: * libguile/procprop.h: * libguile/read.c: * libguile/socket.c: * libguile/srfi-4.h: * libguile/strings.c: * libguile/strings.h: * libguile/tags.h: * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm: Remove all deprecated code. CPP defines that were not previously issuing warnings were changed so that their expansions would indicate the replacement forms to use, e.g. scm_sizet__GONE__REPLACE_WITH__size_t. The two exceptions were SCM_LISTN, which did not produce warnings before, and the string-filter argument order stuff. Drops the initial dirty memory usage of Guile down to 2.8 MB on my machine, from 4.4 MB. Andy Wingo2011-05-121-126/+31
|/
* Make VM string literals immutable....* libguile/strings.c (scm_i_make_string, scm_i_make_wide_string): Add `read_only_p' parameter. All callers updated. * libguile/vm-i-loader.c (load_string, load_wide_string): Push read-only strings. * test-suite/tests/strings.test ("literals"): New test prefix. Ludovic Courtès2011-03-201-1/+1
* Set sockaddr_in.sin_len field when it exists....* configure.ac: Detect when struct sockaddr_in has a sin_len field. Remove obsolete comment. * libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Set the sin_len field in our struct sockaddr_in when it exists. Noah Lavine2011-02-131-1/+5
* zero newly allocated sockaddrs...* libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Zero the sockaddrs, so we do not pass uninitialized memory to the kernel. Noah Lavine2011-02-131-0/+3
* Make `inet-ntop' and `inet-pton' available even when !HAVE_IPV6....* libguile/socket.c (scm_inet_pton, scm_inet_ntop): Move out of `#ifdef HAVE_IPV6' and conditionalize the IPv6-specific bits. Reported by Jan Nieuwenhuizen <janneke@gnu.org>. Ludovic Courtès2011-01-291-37/+61
* Have `recv!', `send', etc. accept a bytevector....* 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'. Ludovic Courtès2011-01-291-72/+162
* scm_accept no longer leaves guile mode...* libguile/socket.c (scm_accept): Revert 7d1fc8721724ab64ccdc44d6f4f84abad43751b4. Now that we don't need to leave guile mode in order for GC to happen, don't do so, as we assume that anyone who cares has already done a select() beforehand. Andy Wingo2010-12-021-17/+1
* Add support for more multicast sockopts....* libguile/socket.c: Add support for IP_MULTICAST_TTL and IP_MILTICAST_IF sockopts. Tristan Colgate-McFarlane2010-10-201-0/+18
* Remove references to undefined macros....The intent is to allow compilation with `-Wundef', which in turn should make it easier to catch erroneous uses of nonexistent macros. * libguile/__scm.h: Don't assume `BUILDING_LIBGUILE' is defined. * libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): Remove unneeded CPP conditional on `TYPE_MIN == 0'. * libguile/fports.c: Check for the definition of `HAVE_CHSIZE' and `HAVE_FTRUNCATE', not for their value. * libguile/ports.c: Likewise. * libguile/numbers.c (guile_ieee_init): Likewise with `HAVE_DINFINITY' and `HAVE_DQNAN'. * test-suite/standalone/test-conversion.c (ieee_init): Likewise. * libguile/strings.c: Likewise with `SCM_STRING_LENGTH_HISTOGRAM'. * libguile/strings.h: Likewise. * libguile/tags.h: Likewise with `HAVE_INTTYPES_H' and `HAVE_STDINT_H'. * libguile/threads.c: Likewise with `HAVE_PTHREAD_GET_STACKADDR_NP'. * libguile/vm-engine.c (VM_NAME): Likewise with `VM_CHECK_IP'. * libguile/gen-scmconfig.c (main): Use "#ifdef HAVE_", not "#if HAVE_". * libguile/socket.c (scm_setsockopt): Likewise. Ludovic Courtès2009-11-171-4/+4
* Deprecate `inet-ntoa' and `inet-aton'....Suggested by Bruno Haible. * libguile/inet_aton.c: Remove. * libguile/Makefile.am (EXTRA_libguile_la_SOURCES): Remove `inet_aton.c'. * libguile/deprecated.c (scm_inet_aton, scm_inet_ntoa): New functions. * libguile/deprecated.h: Update accordingly. * libguile/socket.c (scm_inet_aton, scm_inet_ntoa): Remove. * doc/ref/posix.texi (Network Address Conversion): Mark `inet-ntoa' and `inet-aton' as deprecated. Ludovic Courtès2009-11-161-47/+0
* Use Gnulib's `inet_ntop' and `inet_pton' modules....* m4/gnulib-cache.m4: Add `inet_ntop' and `inet_pton'. * configure.ac: Don't check for `inet_ntop' and `inet_pton'. * libguile/socket.c (scm_inet_pton, scm_inet_ntop): Compile regardless of `HAVE_INET_PTON' and `HAVE_INET_NTOP' respectively. * libguile/filesys.c: Use <stdlib.h> instead of <canonicalize.h>. Ludovic Courtès2009-11-161-4/+0
* Fix doc for inet-ntop: always produces a string...Thanks to Scott McPeak for reporting this. * libguile/socket.c (scm_inet_ntop): In docstring, add quotes around IPv6 address (+ reflow a bit). * doc/ref/posix.texi (Network Address Conversion): Corresponding change. * doc/maint/guile.texi: Corresponding change. Neil Jerram2009-10-011-2/+2
* Fix handling of IPv6 addresses...Thanks to Scott McPeak for reporting this and providing a patch. * libguile/socket.c (scm_to_ipv6): When address is the wrong type, provide more information in the exception message. (scm_to_sockaddr): scm_to_ipv6 expects just an address, not the whole vector. * test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): New set of tests. Neil Jerram2009-10-011-2/+3
* Merge commit 'origin/master'...Conflicts: libguile/unif.c Andy Wingo2009-08-251-8/+24
|\
| * Modify socket and time functions for wide strings...* libguile/socket.c (scm_recv): receive the message without holding the stringbuf writing lock (scm_send): try to narrow a string before using it * libguile/stime.c (strftime): convert string to UTF-8 so that it can be safely passed to strftime (strptime): convert input string to UTF-8 so that it can be safely passed through strptime * libguile/strings.c (narrow_stringbuf): new function (scm_i_try_narrow_string): new function * libguile/strings.h: new declaration for scm_i_try_narrow_string Michael Gran2009-08-231-8/+24
* | Merge wip-array refactor, up to cd43fdc5b7a7c...Conflicts: NEWS libguile/print.c Andy Wingo2009-08-251-2/+2
|\ \ | |/ |/|
| * rename unif.[ch] to arrays.[ch]...* libguile/Makefile.am: * libguile/unif.c: * libguile/unif.h: * libguile/arrays.c: * libguile/arrays.h: Rename unif.[ch] to arrays.[ch]. * libguile.h: * libguile/array-handle.c: * libguile/array-map.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/eq.c: * libguile/gc-card.c: * libguile/gc-malloc.c: * libguile/gc-mark.c: * libguile/gc.c: * libguile/init.c: * libguile/inline.h: * libguile/print.c: * libguile/random.c: * libguile/read.c: * libguile/socket.c: * libguile/sort.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/strports.c: * libguile/vectors.c: * libguile/vectors.h: Update includers. Andy Wingo2009-07-191-2/+2
* | Add Unicode strings and symbols...This adds full Unicode strings as a datatype, and it adds some minimal functionality. The terminal and port encoding is assumed to be ISO-8859-1. Non-ISO-8859-1 characters are written or input as string character escapes. The string character escapes now have 3 forms: \xXX \uXXXX and \UXXXXXX, for unprintable characters that have 2, 4 or 6 hex digits. The process for writing to strings has been modified. There is now a function scm_i_string_start_writing that does the copy-on-write conversion if necessary. To compile strings that may be wide, the VM storage of strings and string-likes has changed. Most string-using functions have not yet been updated and may break when used with wide strings. * module/language/assembly/compile-bytecode.scm (write-bytecode): use variable width string bytecode format * module/language/assembly.scm (byte-length): use variable width bytecode format * libguile/vm-i-loader.c (load-string, load-symbol): (load-keyword, define): use variable-width bytecode format * libguile/vm-engine.h (FETCH_WIDTH): new macro * libguile/strings.h: new declarations * libguile/strings.c (make_wide_stringbuf): new function (widen_stringbuf): new function (scm_i_make_wide_string): new function (scm_i_is_narrow_string): new function (scm_i_string_wide_chars): new function (scm_i_string_start_writing): new function (scm_i_string_ref): new function (scm_i_string_set_x): new function (scm_i_is_narrow_symbol): new function (scm_i_symbol_wide_chars, scm_i_symbol_ref): new function (scm_string_width): new function (unistring_escapes_to_guile_escapes): new function (scm_to_stringn): new function (scm_i_stringbuf_free): modify for wide strings (scm_i_substring_copy): modify for wide strings (scm_i_string_chars, scm_string_append): modify for wide strings (scm_i_make_symbol, scm_to_locale_stringn): modify for wide strings (scm_string_dump, scm_symbol_dump, scm_to_locale_stringbuf): (scm_string, scm_i_deprecated_string_chars): modify for wide strings (scm_from_locale_string, scm_from_locale_stringn): add null test * libguile/srfi-13.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing (scm_string_for_each): modify for wide strings * libguile/socket.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing * libguile/rw.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing * libguile/read.c (scm_read_string): allow reading of wide strings * libguile/print.h: add declaration for scm_charprint * libguile/print.c (iprin1): print wide strings and add new string escapes (scm_charprint): new function * libguile/ports.h: new declarations for scm_lfwrite_substr and scm_lfwrite_str * libguile/ports.c (update_port_lf): new function (scm_lfwrite): use update_port_lf (scm_lfwrite_substr): new function (scm_lfwrite_str): new function * test-suite/tests/asm-to-bytecode.test ("compiler"): add string width byte to sting-like asm tests Michael Gran2009-08-081-0/+3
|/
* Change Guile license to LGPLv3+...(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* ) Neil Jerram2009-06-171-6/+7
* Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès2008-09-131-1/+1
* Changes from arch/CVS synchronizationLudovic Courtès2007-12-041-1/+17
* Changes from arch/CVS synchronizationLudovic Courtès2007-09-021-57/+65