1. 18 Apr, 2016 1 commit
    • Paul Eggert's avatar
      Minor fixups for external socket launching · 531c9a43
      Paul Eggert authored
      * configure.ac (HAVE_LIBSYSTEMD): Change earliest version to 222.
      * doc/emacs/misc.texi (Emacs Server):
      * etc/NEWS: Spelling and doc fixes.
      * src/emacs.c (main) [HAVE_LIBSYSTEMD]:
      Check for sd_is_socket returning positive, not zero.
      * src/process.c (external_sock_fd): Instead of initializing here ...
      (init_process_emacs): ... initialize it here, so that it does the
      right thing after dump/restore.
      (connect_network_socket): Simplify socket_to_use test.
  2. 16 Apr, 2016 1 commit
    • Matthew Leach's avatar
      Add external socket launching support · e390b7b5
      Matthew Leach authored
      * src/process.c (connect_network_socket): Allow a pre-allocated socket
      descriptor to be used if passed to Emacs, avoiding the call to
      'socket' and 'bind'.
      (Fmake_network_process): Allow users to pass ':use-external-socket' in
      the parameter plist to use any sockets that have been passed to Emacs.
      (wait_reading_process_output): Call 'socket' and 'bind' every time.
      (syms_of_process): New symbol ':use-external-socket'.
      (set_external_socket_descriptor): New function.
      (external_sock_fd): New variable.
      * src/lisp.h: (set_external_socket_descriptor): New declaration.
      * src/emacs.c (main): Call 'sd_listen_fds' to read the number of sockets
      passed and call 'set_external_socket_descriptor' to set the external
      * src/Makefile.in: Add libsystemd library and C flags to the Emacs
      compilation options.
      * configure.ac: Add new default-on option "systemd" and check for
      libsystemd at configure time.
      * lisp/server.el (server-start): Set ':use-external-socket' to 't' when
      calling 'make-network-process'.
      * etc/NEWS: Document new socket-passing functionality and the configure
      option to disable systemd interaction.
      * doc/emacs/misc.texi (Emacs Server): Document systemd socket passing
      functionality and provide systemd unit examples.
      * doc/lispref/processes.texi (Network Processes): Document new
      'make-network-process' option ':use-external-socket'.
  3. 05 Apr, 2016 1 commit
    • Paul Eggert's avatar
      Prefer AUTO_STRING_WITH_LEN to make_formatted_string · b4c7869e
      Paul Eggert authored
      * src/buffer.c (Fgenerate_new_buffer_name):
      * src/filelock.c (get_boot_time):
      * src/minibuf.c (get_minibuffer):
      * src/process.c (make_process):
      * src/xdisp.c (ensure_echo_area_buffers):
      Prefer AUTO_STRING_WITH_LEN + sprintf to make_formatted_string
      when either will do.
  4. 04 Apr, 2016 1 commit
  5. 22 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Assume NON_BLOCKING_CONNECT (Bug#22946) · 780a605e
      Paul Eggert authored
      * lisp/proced.el (proced-signal-list): Omit comment about
      obsolete systems that do not support POSIX 1003.1-2001 signals.
      * src/process.c (NON_BLOCKING_CONNECT): Remove, since we can now
      assume POSIX 1003.1-2001 or better here.  Assume it’s defined.
      (connect_network_socket): Assume EINPROGRESS is defined,
      as that’s portable too now.
      (Fmake_network_process): Use bool for boolean.
  6. 10 Mar, 2016 2 commits
    • Paul Eggert's avatar
      Rework C source files to avoid ^( · 7352c6c6
      Paul Eggert authored
      Work around Bug#22884 by rewording comments and strings to avoid ‘(’
      at the start of a line unless it starts a function.  This change
      is a short-term hack; in the longer run we plan to fix cc-mode’s
      performance for C files that have ‘(’ at the start of a line in a
      comment or string.
    • Paul Eggert's avatar
      Minor fixes for getaddrinfo_a usage · f0b31080
      Paul Eggert authored
      * src/process.c (Fdelete_process): Check gai_cancel return value.
      That way, there’s no need to invoke gai_error.  Check gai_suspend
      return value.
      (Fmake_network_process): Don’t assume gai_strerror returns a UTF-8
      string.  Simplify call to connect_network_socket.
      (check_for_dns): Avoid unnecessary initialization of local.
  7. 08 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Assume getaddrinfo in C code · 59c7a5d7
      Paul Eggert authored
      * admin/CPP-DEFINES, configure.ac: Remove HAVE_GETADDRINFO, HAVE_H_ERRNO.
      All uses removed.
      * doc/lispref/processes.texi (Network, Network Processes), etc/NEWS:
      Say that port numbers can be integer strings.
      * lib-src/pop.c (h_errno) [!WINDOWSNT && !HAVE_H_ERRNO]: Remove decl.
      (socket_connection): Assume HAVE_GETADDRINFO.
      * lisp/mpc.el (mpc--proc-connect):
      * lisp/net/network-stream.el (open-network-stream):
      It’s now OK to use integer strings as port numbers.
      * src/process.c (conv_numerical_to_lisp) [!HAVE_GETADDRINFO]: Remove.
      (Fmake_network_process): Assume HAVE_GETADDRINFO.
  8. 07 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Remove support for IRIX · 6bc8689c
      Paul Eggert authored
      The IRIX port wasn’t really working anyway, and the code was
      getting in the way of other changes (e.g., getaddrinfo fixes).
      IRIX’s supplier dropped support for IRIX in 2013.
      * admin/CPP-DEFINES:
      * configure.ac (opsys):
      * doc/lispref/os.texi (System Environment):
      * etc/MACHINES, etc/PROBLEMS:
      * lisp/find-dired.el (find-grep-options):
      * lisp/lpr.el (lpr-lp-system):
      * lisp/ls-lisp.el (ls-lisp-emulation):
      * lisp/mail/rmail.el (rmail-spool-directory):
      * lisp/net/net-utils.el (ping-program-options):
      * lisp/progmodes/gud.el (gud-irix-p, gud-dbx-use-stopformat-p):
      * lisp/progmodes/ps-mode.el (ps-mode-print-function):
      * src/conf_post.h [IRIX6_5]:
      * src/emacs.c (Vsystem_type):
      * src/filelock.c (get_boot_time_1):
      * src/process.c (process_send_signal):
      * src/unexelf.c (unexec):
      Omit IRIX-specific code and/or documentation.
      * configure.ac (NON_GCC_TEST_OPTIONS, IRIX6_5, PREFER_VSUSP):
      Remove.  All uses removed.
      * etc/NEWS: Document the change.
  9. 03 Mar, 2016 1 commit
    • Lars Ingebrigtsen's avatar
      Ensure TLS negotiation progress · 0c5c04d5
      Lars Ingebrigtsen authored
      * src/gnutls.h (GNUTLS_EMACS_HANDSHAKES_LIMIT): Increase the
      number of retries so that we try for about a minute.
      * src/process.c (wait_reading_process_output): Ensure progress
      for DNS resolution and TLS negotiation.
  10. 29 Feb, 2016 3 commits
  11. 25 Feb, 2016 2 commits
    • Paul Eggert's avatar
      Integer overflow cleanups for ports and socklen · c1415cc9
      Paul Eggert authored
      * src/process.c (struct sockaddr_and_len, conv_sockaddr_to_lisp)
      (get_lisp_to_sockaddr_size, Fset_process_datagram_address)
      Use ptrdiff_t, not int, for signed object sizes.
      This addresses only a theoretical problem, as in practice these
      object sizes are less than 2**31, but we might as well use the
      same style here as elsewhere in Emacs.
      (string_integer_p): Remove; all uses removed.
      (Fmake_network_process): Check that port number is in range.
      When converting an integer-string service, rely on strtol
      rather than rechecking the string by hand.
      * src/process.h, src/w32.c (conv_sockaddr_to_lisp):
      Adjust prototypes to match.
    • Lars Ingebrigtsen's avatar
      Allow using "number strings" as services on non-GNU systems · e7650ba6
      Lars Ingebrigtsen authored
      * src/process.c (string_integer_p): New function.
      (Fmake_network_process): Use it to allow connecting to
      services specified as "993" even when getaddrbyname isn't
  12. 24 Feb, 2016 1 commit
  13. 23 Feb, 2016 2 commits
    • Paul Eggert's avatar
      Port to --enable-gcc-warnings sans getaddrinfo_a · c7b8194c
      Paul Eggert authored
      * src/process.c (Fmake_network_process): Add ATTRIBUTE_UNUSED
      to a local unused when getaddrinfo_a is missing.
      Resize portbuf to size needed.  Do cheap test first.
      Move local to block where it’s needed.
    • Paul Eggert's avatar
      Minor cleanups for async DNS etc. · 82848cf6
      Paul Eggert authored
      Omit unnecessary parens.
      * src/gnutls.c (gnutls_try_handshake, emacs_gnutls_deinit)
      Use bool for boolean.
      (ATTRIBUTE_FORMAT_PRINTF): Add printf attribute.
      * src/process.c (free_dns_request, Fmake_network_process):
      Allocate and free async request control block all in one go.
      (set_network_socket_coding_system, finish_after_tls_connection)
      Now static.
      (conv_numerical_to_lisp): 2nd arg is now int, not unsigned.
      (Fmake_network_process): Use list1 for brevity.
      (wait_for_socket_fds): 2nd arg is now const ptr.
      * src/process.h (struct Lisp_Process.dns_request):
      Now struct gaicb *, not struct gaicb **, since there was always
      exactly one.  All uses changed.
      * src/window.c, src/window.h (run_window_configuration_change_hook):
      Now static.
  14. 22 Feb, 2016 5 commits
  15. 21 Feb, 2016 1 commit
    • Alain Schneble's avatar
      Respect DNS timeouts · 79936792
      Alain Schneble authored
      * src/process.c (check_for_dns): If the async DNS request
      failed and the associated process is still in "connect" state,
      deactivate the process and set status to "failed".
  16. 19 Feb, 2016 1 commit
  17. 18 Feb, 2016 1 commit
    • Lars Ingebrigtsen's avatar
      Verify the TLS connection asynchronously · e96df838
      Lars Ingebrigtsen authored
      * src/gnutls.c (gnutls_verify_boot): Refactor out into its own
      function so that we can call it asynchronously.
      (Fgnutls_boot): Use it.
      * src/process.c (wait_reading_process_output): Verify the TLS
  18. 16 Feb, 2016 8 commits
    • Lars Ingebrigtsen's avatar
      Deactivate the correct process · d4bb0b92
      Lars Ingebrigtsen authored
      * src/process.c (wait_reading_process_output): Deactivate the
      correct process on failure.
    • Lars Ingebrigtsen's avatar
      Implement asynch TLS negotiation · ac6e085c
      Lars Ingebrigtsen authored
      * src/gnutls.c (gnutls_try_handshake): Factor out into its own
      (emacs_gnutls_handshake): Use it.
      (emacs_gnutls_read): Just return instead of retrying the handshake.
      * src/process.c (finish_after_tls_connection): Factor out
      into its own function.
      (connect_network_socket): Use it.
      (wait_reading_process_output): Retry TLS handshakes.
      (wait_reading_process_output): Defer sentinel until TLS completes.
    • Lars Ingebrigtsen's avatar
      Simplify the DNS resolution loop a bit · c43bb7f1
      Lars Ingebrigtsen authored
      * src/process.c (wait_reading_process_output): Simplify the
      DNS resolution loop a bit.
    • Alain Schneble's avatar
      Loop over the process list instead of maintaining a separate list · d1fc5a54
      Alain Schneble authored
      * src/process.c: Remove declaration/definition of dns_processes list.
      * src/process.c (wait_reading_process_output): Loop over all processes in
      Vprocess_alist instead of dns_processes, to check for completed DNS
    • Lars Ingebrigtsen's avatar
      Allow setting the filter masks later · 9755b753
      Lars Ingebrigtsen authored
      * src/process.c (Fset_process_filter): Don't set the socket
      masks here, because we may not have a socket yet.
      (set_process_filter_masks): New function.
      (connect_network_socket): Set the filter masks here.
    • Lars Ingebrigtsen's avatar
      Ensure we always free DNS resources when deleting a process · df911734
      Lars Ingebrigtsen authored
      * src/process.c (free_dns_request): Factor out into own function.
      (Fdelete_process): When deleting a process, free any DNS
      structures associated with it.
      (check_for_dns): Always free all DNS resources.
    • Alain Schneble's avatar
      Don't block in set-process-window-size · e4324bdf
      Alain Schneble authored
      * src/process.c (set-process-window-size): Explicitly return Qnil when
      called with network processes as set_window_size won't work anyway on
      socket fds.  As a welcome side effect, this makes the blocking
      wait_for_socket_fds call obsolete.
    • Lars Ingebrigtsen's avatar
      Do most of the coding system setup earlier · 7f3441cc
      Lars Ingebrigtsen authored
      * src/process.c (Fmake_network_process): Set the read/write
      coding systems here, so that special bindings work.
      (Fmake_network_process): Complete the coding system setup here.
  19. 15 Feb, 2016 4 commits
    • Lars Ingebrigtsen's avatar
      Protect against initial handshake failures · 2d7af7e2
      Lars Ingebrigtsen authored
      * src/process.c (connect_network_socket): Mark the connection
      as failed if the handshake didn't succeed yet.  This should be
      reworked later.
    • Lars Ingebrigtsen's avatar
      Call the network security manager after doing TLS negotiation · 9c74f2fe
      Lars Ingebrigtsen authored
      * lisp/net/network-stream.el (network-stream-open-tls):
      Postpone NSM verification when running async.
      * src/process.c (Fset_process_filter): This function doesn't
      need to wait.
      (connect_network_socket): Set the process status to "run" only
      after TLS negotiation.
      (wait_for_socket_fds): Take a name parameter for more debugging.
      (wait_reading_process_output): Don't change status to "run"
      unless TLS negotiation has finished.
      (send_process): Wait for the process here instead of
      (connect_network_socket): Call the network security manager.
    • Lars Ingebrigtsen's avatar
      Remove some #ifdefs and update documentation · 40155283
      Lars Ingebrigtsen authored
      * doc/lispref/processes.texi (Network Processes): Remove
      mention of `dns'.
      * lisp/net/network-stream.el (open-network-stream): Remove
      mention of `dns'.
      * src/process.c (Fset_process_filter)
      (Fset_process_window_size, Fprocess_contact)
      (Fprocess_datagram_address, Fset_process_datagram_address)
      (Fset_network_process_option, Fprocess_send_region)
      (Fprocess_send_string, Fset_process_coding_system)
      (Fset_process_filter_multibyte): Remove the #ifdef
      HAVE_GETADDRINFO_A checks.
      (Fprocess_send_string): Wait for TLS negotiation.
      (wait_for_tls_negotiation): New function.
      (send_process): Remove the TLS boot check.
      * src/process.c (Fmake_network_process): Ditto.
    • Alain Schneble's avatar
      Add blockers to process functions · c740d190
      Alain Schneble authored
      * src/process.c (set-process-filter, set-process-window-size,
      process-contact, process-datagram-address, set-process-datagram-address,
      set-network-process-option): Make functions wait (block) on network
      process until pending DNS requests have been processed and associated
      socket initialized.
      * src/process.c (process-send-region, process-send-string,
      process-send-eof): Make functions wait (block) while network process is
      in connect state.
  20. 09 Feb, 2016 1 commit
    • David Edmondson's avatar
      src/process.c Correctly convert AF_INET6 addresses · 51d728c8
      David Edmondson authored
      * src/process.c (conv_lisp_to_sockaddr): AF_INET6 addresses are
      converted to a list of 16 bit quantities by
      conv_sockaddr_to_lisp(). conv_lisp_to_sockaddr() should follow the
      same scheme rather than expecting a (longer) list of 8 bit
  21. 07 Feb, 2016 1 commit
    • David Edmondson's avatar
      src/process.c Correctly convert AF_INET6 addresses · 35cbe209
      David Edmondson authored
      * src/process.c (conv_lisp_to_sockaddr): AF_INET6 addresses are
      converted to a list of 16 bit quantities by
      conv_sockaddr_to_lisp(). conv_lisp_to_sockaddr() should follow the
      same scheme rather than expecting a (longer) list of 8 bit
      (cherry picked from commit 55ce3c30)