summaryrefslogtreecommitdiff
path: root/libguile/socket.c
AgeCommit message (Collapse)AuthorFilesLines
2013-07-16Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-1/+1
Conflicts: libguile/keywords.c libguile/vm.c
2013-06-16Define `AF_UNIX' only when Unix-domain sockets are supported.Ludovic Courtès1-1/+1
* libguile/socket.c (scm_init_socket): Defined `AF_UNIX' only when `HAVE_UNIX_DOMAIN_SOCKETS' is defined. Reported by Eli Zaretskii <eliz@gnu.org>.
2013-03-28Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-26/+25
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
2013-03-18Define the new Linux-specific `SO_REUSEPORT'.Ludovic Courtès1-0/+5
* 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'.
2013-03-09mingw include order for socket.cAndy Wingo1-17/+19
* libguile/socket.c: Reorder includes to fix include order on mingw.
2013-03-09squish remove some mingw-specific code that is covered by gnulibAndy Wingo1-14/+2
* 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.
2013-01-07Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-1/+7
Conflicts: GUILE-VERSION libguile/posix.c module/ice-9/eval.scm test-suite/tests/cse.test
2012-12-10Verify the value of `SHUT_RD' and related constants.Ludovic Courtès1-1/+7
* libguile/socket.c: Add `verify' clauses for the values of `SHUT_RD', `SHUT_WR', and `SHUT_RDWR'.
2012-02-08Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-4/+4
Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c
2012-02-02Improve the usage of variable names in C docstrings.Bake Timmons1-4/+4
* 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.
2011-05-13merge strictness branch from 2.0Andy Wingo1-5/+5
2011-05-13scm_is_false instead of == SCM_BOOL_F; also is_null, is_true, etcAndy Wingo1-2/+2
* 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.
2011-05-13scm_is_eq for SCM vals, not == or !=Andy Wingo1-3/+3
* 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 == / !=.
2011-05-12remove all deprecated codeAndy Wingo1-126/+31
* 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.
2011-03-20Make VM string literals immutable.Ludovic Courtès1-1/+1
* 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.
2011-02-13Set sockaddr_in.sin_len field when it exists.Noah Lavine1-1/+5
* 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.
2011-02-13zero newly allocated sockaddrsNoah Lavine1-0/+3
* libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Zero the sockaddrs, so we do not pass uninitialized memory to the kernel.
2011-01-29Make `inet-ntop' and `inet-pton' available even when !HAVE_IPV6.Ludovic Courtès1-37/+61
* 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>.
2011-01-29Have `recv!', `send', etc. accept a bytevector.Ludovic Courtès1-72/+162
* 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'.
2010-12-02scm_accept no longer leaves guile modeAndy Wingo1-17/+1
* 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.
2010-10-20Add support for more multicast sockopts.Tristan Colgate-McFarlane1-0/+18
* libguile/socket.c: Add support for IP_MULTICAST_TTL and IP_MILTICAST_IF sockopts.
2009-11-17Remove references to undefined macros.Ludovic Courtès1-4/+4
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.
2009-11-16Deprecate `inet-ntoa' and `inet-aton'.Ludovic Courtès1-47/+0
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.
2009-11-16Use Gnulib's `inet_ntop' and `inet_pton' modules.Ludovic Courtès1-4/+0
* 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>.
2009-10-01Fix doc for inet-ntop: always produces a stringNeil Jerram1-2/+2
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.
2009-10-01Fix handling of IPv6 addressesNeil Jerram1-2/+3
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.
2009-08-25Merge commit 'origin/master'Andy Wingo1-8/+24
Conflicts: libguile/unif.c
2009-08-25Merge wip-array refactor, up to cd43fdc5b7a7cAndy Wingo1-2/+2
Conflicts: NEWS libguile/print.c
2009-08-23Modify socket and time functions for wide stringsMichael Gran1-8/+24
* 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
2009-08-08Add Unicode strings and symbolsMichael Gran1-0/+3
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
2009-07-19rename unif.[ch] to arrays.[ch]Andy Wingo1-2/+2
* 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.
2009-06-17Change Guile license to LGPLv3+Neil Jerram1-6/+7
(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
2008-09-13Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès1-1/+1
2007-12-04Changes from arch/CVS synchronizationLudovic Courtès1-1/+17
2007-09-02Changes from arch/CVS synchronizationLudovic Courtès1-57/+65
2007-09-02Changes from arch/CVS synchronizationLudovic Courtès1-3/+7
2007-06-12Changes from arch/CVS synchronizationLudovic Courtès1-5/+17
2006-10-09merge from 1.8 branchKevin Ryde1-25/+33
2006-04-17merge from 1.8 branchKevin Ryde1-1/+1
2006-02-09(scm_c_make_socket_address): Pass address_size pointerNeil Jerram1-2/+1
on to scm_fill_sockaddr call.
2006-01-29Renamed the "frames" that are related to dynamic-wind to "dynamicMarius Vollmer1-3/+3
contexts. Renamed all functions from scm_frame_ to scm_dynwind_. Updated documentation.
2005-11-26(scm_fill_sockaddr): Remove SCM_C_INLINE_KEYWORD, this isKevin Ryde1-1/+1
much too big to want to inline.
2005-11-12(scm_setsockopt): Missing @defvar in docstring. ReportedKevin Ryde1-1/+2
by Ludovic Courtès.
2005-10-272005-10-27 Ludovic Courtès <ludovic.courtes@laas.fr>Kevin Ryde1-33/+265
* socket.c (scm_fill_sockaddr): No need to check NULL from scm_malloc. (scm_connect, scm_bind, scm_sendto): Accept sockaddr object. (scm_addr_vector): Renamed to _scm_from_sockaddr, update usages. (scm_from_sockaddr, scm_to_sockaddr, scm_make_socket_address, scm_c_make_socket_address): New functions.
2005-10-23(scm_getsockopt, scm_setsockopt): Update docstrings from posix.texi.Kevin Ryde1-18/+107
2005-10-23(scm_init_socket): Add IPPROTO_IP, IPPROTO_TCP,Kevin Ryde1-7/+14
IPPROTO_UDP. Remove SOL_IP, SOL_TCP, SOL_UDP. The former are in POSIX spec examples, the latter are not available on for instance NetBSD.
2005-07-10(scm_inet_pton, scm_inet_ntop): Pointer cast to scm_t_uint8Kevin Ryde1-8/+8
for scm ipv6 funcs, gcc 4 is picky about char* vs uchar*. (scm_getsockopt, scm_accept, scm_getsockname, scm_getpeername, scm_recvfrom) Use socklen_t, gcc 4 is picky about int* vs socklen_t*.
2005-06-05* hashtab.h: Bugfix: use SCM_API (WAS: extern).Marius Vollmer1-4/+5
* socket.c: Remove obsolete comment about socklen_t. (s_scm_setsockopt)[!HAVE_IP_MREQ]: Do not use ip_mreq code. * numbers.h (isnan)[__MINGW32__]: Remove. * Makefile.am (gen_scmconfig_SOURCES): Bugfix: Add DEFAULT_INCLUDES when cross compiling. * threads.c (ETIMEDOUT, pipe)[__MINGW32__]: Add defines. * stime.c (s_scm_strftime)[!HAVE_TM_ZONE]: Use SCM_SIMPLE_VECTOR_REF instead of SCM_VELTS. (Changed slightly from Jan's patch.)
2005-05-23The FSF has a new address.Marius Vollmer1-1/+1
2005-02-27(scm_setsockopt): Handle IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIPMarius Vollmer1-40/+43
options. Also, reorganized the code a bit for cleanliness. Thanks to Greg Troxel!