1. 01 Jan, 2013 1 commit
  2. 06 Dec, 2012 1 commit
    • Paul Eggert's avatar
      Fix a recently-introduced delete-process race condition. · 35fb8050
      Paul Eggert authored
      * callproc.c, process.h (record_kill_process):
      New function, containing part of the old call_process_kill.
      (call_process_kill): Use it.
      This does not change call_process_kill's behavior.
      * process.c (Fdelete_process): Use record_kill_process to fix a
      race condition that could cause Emacs to lose track of a child.
      35fb8050
  3. 03 Dec, 2012 1 commit
    • Paul Eggert's avatar
      Don't let call-process be a zombie factory. · bb5f74ee
      Paul Eggert authored
      Fixing this bug required some cleanup of the signal-handling code.
      As a side effect, this change also fixes a longstanding rare race
      condition whereby Emacs could mistakenly kill unrelated processes,
      and it fixes a bug where a second C-g does not kill a recalcitrant
      synchronous process in GNU/Linux and similar platforms.
      The patch should also fix the last vestiges of Bug#9488,
      a bug which has mostly been fixed on the trunk by other changes.
      * callproc.c, process.h (synch_process_alive, synch_process_death)
      (synch_process_termsig, sync_process_retcode):
      Remove.  All uses removed, to simplify analysis and so that
      less consing is done inside critical sections.
      * callproc.c (call_process_exited): Remove.  All uses replaced
      with !synch_process_pid.
      * callproc.c (synch_process_pid, synch_process_fd): New static vars.
      These take the role of what used to be in unwind-protect arg.
      All uses changed.
      (block_child_signal, unblock_child_signal):
      New functions, to avoid races that could kill innocent-victim processes.
      (call_process_kill, call_process_cleanup, Fcall_process): Use them.
      (call_process_kill): Record killed processes as deleted, so that
      zombies do not clutter up the system.  Do this inside a critical
      section, to avoid a race that would allow the clutter.
      (call_process_cleanup): Fix code so that the second C-g works again
      on common platforms such as GNU/Linux.
      (Fcall_process): Create the child process in a critical section,
      to fix a race condition.  If creating an asynchronous process,
      record it as deleted so that zombies do not clutter up the system.
      Do unwind-protect for WINDOWSNT too, as that's simpler in the
      light of these changes.  Omit unnecessary call to emacs_close
      before failure, as the unwind-protect code does that.
      * callproc.c (call_process_cleanup):
      * w32proc.c (waitpid): Simplify now that synch_process_alive is gone.
      * process.c (record_deleted_pid): New function, containing
      code refactored out of Fdelete_process.
      (Fdelete_process): Use it.
      (process_status_retrieved): Remove.  All callers changed to use
      child_status_change.
      (record_child_status_change): Remove, folding its contents into ...
      (handle_child_signal): ... this signal handler.  Now, this
      function is purely a handler for SIGCHLD, and is not called after
      a synchronous waitpid returns; the synchronous code is moved to
      wait_for_termination.  There is no need to worry about reaping
      more than one child now.
      * sysdep.c (get_child_status, child_status_changed): New functions.
      (wait_for_termination): Now takes int * status and bool
      interruptible arguments, too.  Do not record child status change;
      that's now the caller's responsibility.  All callers changed.
      Reimplement in terms of get_child_status.
      (wait_for_termination_1, interruptible_wait_for_termination):
      Remove.  All callers changed to use wait_for_termination.
      * syswait.h: Include <stdbool.h>, for bool.
      (record_child_status_change, interruptible_wait_for_termination):
      Remove decls.
      (record_deleted_pid, child_status_changed): New decls.
      (wait_for_termination): Adjust to API changes noted above.
      
      Fixes: debbugs:12980
      bb5f74ee
  4. 24 Nov, 2012 1 commit
  5. 23 Nov, 2012 1 commit
    • Paul Eggert's avatar
      Fix a race condition with glib (Bug#8855). · 6d4e8f62
      Paul Eggert authored
      This is a backport from the trunk, consisting of:
      
      2012-11-17  Eli Zaretskii  <eliz@gnu.org>
      
      * nt/inc/sys/wait.h: New file, with prototype of waitpid and
      definitions of macros it needs.
      * nt/inc/ms-w32.h (wait): Don't define, 'wait' is not used anymore.
      (sys_wait): Remove prototype.
      * nt/config.nt (HAVE_SYS_WAIT_H): Define to 1.
      * src/w32proc.c (create_child): Don't clip the PID of the child
      process to fit into an Emacs integer, as this is no longer a
      restriction.
      (waitpid): Rename from sys_wait.  Emulate a Posix 'waitpid' by
      reaping only the process specified by PID argument, if that is
      positive.  Use PID instead of dead_child to know which process to
      reap.  Wait for the child to die only if WNOHANG is not in
      OPTIONS.
      (sys_select): Don't set dead_child.
      * src/sysdep.c (wait_for_termination_1): Remove the WINDOWSNT portion,
      as it is no longer needed.
      * src/process.c (waitpid, WUNTRACED) [!WNOHANG]: Remove definitions,
      no longer needed.
      (record_child_status_change): Remove the setting of
      record_at_most_one_child for the !WNOHANG case.
      
      2012-11-03  Paul Eggert  <eggert@cs.ucla.edu>
      
      Fix a race condition that causes Emacs to mess up glib (Bug#8855).
      This is a backport from the trunk.
      The symptom is a diagnostic "GLib-WARNING **: In call to
      g_spawn_sync(), exit status of a child process was requested but
      SIGCHLD action was set to SIG_IGN and ECHILD was received by
      waitpid(), so exit status can't be returned."  The diagnostic
      is partly wrong, as the SIGCHLD action is not set to SIG_IGN.
      The real bug is a race condition between Emacs and glib: Emacs
      does a waitpid (-1, ...) and reaps glib's subprocess by mistake,
      so that glib can't find it.  Work around the bug by invoking
      waitpid only on subprocesses that Emacs itself creates.
      * src/process.c (create_process, record_child_status_change):
      Don't use special value -1 in pid field, as the caller now must
      know the pid rather than having the callee infer it.  The
      inference was sometimes incorrect anyway, due to another race.
      (create_process): Set new 'alive' member if child is created.
      (process_status_retrieved): New function.
      (record_child_status_change): Use it.
      Accept negative 1st argument, which means to wait for the
      processes that Emacs already knows about.  Move special-case code
      for DOS_NT (which lacks WNOHANG) here, from caller.  Keep track of
      processes that have already been waited for, by testing and
      clearing new 'alive' member.
      (CAN_HANDLE_MULTIPLE_CHILDREN): Remove, as record_child_status_change
      now does this internally.
      (handle_child_signal): Let record_child_status_change do all
      the work, since we do not want to reap all exited child processes,
      only the child processes that Emacs itself created.
      * src/process.h (Lisp_Process): New boolean member 'alive'.
      6d4e8f62
  6. 03 Nov, 2012 1 commit
    • Paul Eggert's avatar
      Fix a race condition that causes Emacs to mess up glib. · 0b3d4a47
      Paul Eggert authored
      The symptom is a diagnostic "GLib-WARNING **: In call to
      g_spawn_sync(), exit status of a child process was requested but
      SIGCHLD action was set to SIG_IGN and ECHILD was received by
      waitpid(), so exit status can't be returned."  The diagnostic
      is partly wrong, as the SIGCHLD action is not set to SIG_IGN.
      The real bug is a race condition between Emacs and glib: Emacs
      does a waitpid (-1, ...) and reaps glib's subprocess by mistake,
      so that glib can't find it.  Work around the bug by invoking
      waitpid only on subprocesses that Emacs itself creates.
      * process.c (create_process, record_child_status_change):
      Don't use special value -1 in pid field, as the caller now must
      know the pid rather than having the callee infer it.  The
      inference was sometimes incorrect anyway, due to another race.
      (create_process): Set new 'alive' member if child is created.
      (process_status_retrieved): New function.
      (record_child_status_change): Use it.
      Accept negative 1st argument, which means to wait for the
      processes that Emacs already knows about.  Move special-case code
      for DOS_NT (which lacks WNOHANG) here, from caller.  Keep track of
      processes that have already been waited for, by testing and
      clearing new 'alive' member.
      (CAN_HANDLE_MULTIPLE_CHILDREN): Remove, as record_child_status_change
      now does this internally.
      (handle_child_signal): Let record_child_status_change do all
      the work, since we do not want to reap all exited child processes,
      only the child processes that Emacs itself created.
      * process.h (Lisp_Process): New boolean member 'alive'.
      
      Fixes: debbugs:8855
      0b3d4a47
  7. 27 Aug, 2012 1 commit
    • Paul Eggert's avatar
      * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans. · de1339b0
      Paul Eggert authored
      * composite.c (find_composition, composition_gstring_p)
      (composition_reseat_it, find_automatic_composition):
      * data.c (let_shadows_buffer_binding_p)
      (let_shadows_global_binding_p, set_internal, make_blv)
      (Fmake_variable_buffer_local, Fmake_local_variable)
      (Fmake_variable_frame_local, arithcompare, cons_to_unsigned)
      (cons_to_signed, arith_driver):
      * dbusbind.c (xd_in_read_queued_messages):
      * dired.c (directory_files_internal, file_name_completion):
      Use bool for booleans.
      * dired.c (file_name_completion):
      * process.h (fd_callback):
      Omit int (actually boolean) argument.  It wasn't being used.
      All uses changed.
      * composite.h, lisp.h: Reflect above API changes.
      de1339b0
  8. 25 Aug, 2012 1 commit
    • Paul Eggert's avatar
      * bytecode.c, callint.c, callproc.c: Use bool for boolean. · 2f221583
      Paul Eggert authored
      * bytecode.c (exec_byte_code):
      * callint.c (check_mark, Fcall_interactively):
      * callproc.c (Fcall_process, add_env, child_setup, getenv_internal_1)
      (getenv_internal, sync_process_alive, call_process_exited):
      * lisp.h (USE_SAFE_ALLOCA):
      Use bool for booleans, instead of int.
      * lisp.h, process.h: Adjust prototypes to match above changes.
      * callint.c (Fcall_interactively): Don't assume the mark's
      offset fits in 'int'.
      2f221583
  9. 18 Aug, 2012 1 commit
    • Paul Eggert's avatar
      * process.h (PSET): Remove. · 6a09a33b
      Paul Eggert authored
      Replace all uses with calls to new setter functions.
      Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
      (PROCESS_INLINE): New macro.
      (pset_childp): New setter function.
      (pset_gnutls_cred_type) [HAVE_GNUTLS]: New setter function.
      * process.c (PROCESS_INLINE):
      Define to EXTERN_INLINE, so that the corresponding functions
      are compiled into code.
      (pset_buffer, pset_command, pset_decode_coding_system)
      (pset_decoding_buf, pset_encode_coding_system)
      (pset_encoding_buf, pset_filter, pset_log, pset_mark, pset_name)
      (pset_plist, pset_sentinel, pset_status, pset_tty_name)
      (pset_type, pset_write_queue): New setter functions.
      
      Fixes: debbugs:12215
      6a09a33b
  10. 07 Aug, 2012 1 commit
  11. 06 Aug, 2012 1 commit
  12. 01 Aug, 2012 1 commit
    • Dmitry Antipov's avatar
      Use INTERNAL_FIELD for processes. · 3193acd2
      Dmitry Antipov authored
      * src/process.h (PVAR): New macro.  Adjust style.
      (struct Lisp_Process): Change Lisp_Object members to INTERNAL_FIELD.
      * src/print.c, src/process.c, src/sysdep.c, src/w32.c:
      * src/xdisp.c: Users changed.
      * admin/coccinelle/process.cocci: Semantic patch to replace direct
      access to Lisp_Object members of struct Lisp_Process to PVAR.
      3193acd2
  13. 31 Jul, 2012 1 commit
  14. 22 Jun, 2012 1 commit
  15. 17 Jun, 2012 1 commit
    • Troels Nielsen's avatar
      Ensure correct ordering of process writes. · 20ca2e94
      Troels Nielsen authored
      * process.c (make_process): Initialize write_queue.
      (write_queue_push, write_queue_pop): New functions.
      (send_process): Use them to maintain correct ordering of process writes.
      
      Fixes: debbugs:10815
      20ca2e94
  16. 22 Apr, 2012 1 commit
  17. 09 Apr, 2012 1 commit
    • Ted Zlatanov's avatar
      Limit number of GnuTLS handshakes per connection. · a18ecafa
      Ted Zlatanov authored
      * gnutls.c (gnutls_log_function2i): Convenience log function.
      (emacs_gnutls_read): Use new log functions,
      `gnutls_handshakes_tried' process member, and
      `GNUTLS_EMACS_HANDSHAKES_LIMIT' to limit the number of handshake
      attempts per process (connection).
      
      * gnutls.h: Add `GNUTLS_EMACS_HANDSHAKES_LIMIT' upper limit.  Add
      convenience `GNUTLS_LOG2i' macro.
      
      * process.c (make_process):
      * process.h: Add integer `gnutls_handshakes_tried' member to
      process struct.
      a18ecafa
  18. 11 Jan, 2012 1 commit
  19. 05 Jan, 2012 1 commit
  20. 18 Jul, 2011 1 commit
  21. 09 May, 2011 1 commit
    • Eli Zaretskii's avatar
      Backport revisions... · 14fe7b53
      Eli Zaretskii authored
      Backport revisions 2011-04-24T05:30:24Z!eggert@cs.ucla.edu..2011-04-25T19:40:22Z!eggert@cs.ucla.edu (inclusive) from trunk (bug#8623)
      
      	The next log entry shows the actual changes by Paul Eggert.
      
       Fix a problem with aliasing and vector headers.
       GCC 4.6.0 optimizes based on type-based alias analysis.  For
       example, if b is of type struct buffer * and v of type struct
       Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
       != &v->size, and therefore "v->size = 1; b->size = 2; return
       v->size;" must therefore return 1.  This assumption is incorrect
       for Emacs, since it type-puns struct Lisp_Vector * with many other
       types.  To fix this problem, this patch adds a new type struct
       vector_header that documents the constraints on layout of vectors
       and pseudovectors, and helps optimizing compilers not get fooled
       by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
       XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
       src/lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
       XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
       of writing XVECTOR (foo)->header.size.
       src/lisp.h: Say "vectorlike header" rather than "vector header.
       (struct vectorlike_header): Rename from struct vector_header.
       (XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE.
       All uses changed.
       (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
       (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
       member.
       (XSETPVECTYPE): Rewrite in terms of new macro.
       (XSETPVECTYPESIZE): New macro, specifying both type and size.
       This is a bit clearer, and further avoids the possibility of
       undesirable aliasing.
       (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
       (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
       and XVECTOR_HEADER_SIZE.
       (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
       since Lisp_Subr is a special case (no "next" field).
       (ASIZE): Rewrite in terms of XVECTOR_SIZE.
       (struct vector_header): New type.
       (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
       object, to help avoid aliasing.
       (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
       (SUBRP): Likewise, since Lisp_Subr is a special case.
       src/lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
       (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
       (struct Lisp_Hash_Table): Combine first two members into a single
       struct vector_header member.  All uses of "size" and "next" members
       changed to be "header.size" and "header.next".
       src/buffer.h (struct buffer): Likewise.
       src/font.h (struct font_spec, struct font_entity, struct font): Likewise.
       src/frame.h (struct frame): Likewise.
       src/process.h (struct Lisp_Process): Likewise.
       src/termhooks.h (struct terminal): Likewise.
       src/window.c (struct save_window_data, struct saved_window): Likewise.
       src/window.h (struct window): Likewise.
       src/alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
       Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
       src/buffer.c (init_buffer_once): Likewise.
       src/lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
       special case.
       src/process.c (Fformat_network_address): Use local var for size,
       for brevity.
       src/fns.c (vector): Remove; this old hack is no longer needed.
       src/bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
      14fe7b53
  22. 25 Apr, 2011 2 commits
    • Paul Eggert's avatar
      * lisp.h: Say "vectorlike header" rather than "vector header. · b102ceb1
      Paul Eggert authored
      (struct vectorlike_header): Rename from struct vector_header.
      (XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE.
      All uses changed.
      b102ceb1
    • Paul Eggert's avatar
      lisp.h: Fix a problem with aliasing and vector headers. · eab3844f
      Paul Eggert authored
      GCC 4.6.0 optimizes based on type-based alias analysis.  For
      example, if b is of type struct buffer * and v of type struct
      Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
      != &v->size, and therefore "v->size = 1; b->size = 2; return
      v->size;" must therefore return 1.  This assumption is incorrect
      for Emacs, since it type-puns struct Lisp_Vector * with many other
      types.  To fix this problem, this patch adds a new type struct
      vector_header that documents the constraints on layout of vectors
      and pseudovectors, and helps optimizing compilers not get fooled
      by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
      XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
      * lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
      XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
      of writing XVECTOR (foo)->header.size.
      (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
      (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
      member.
      (XSETPVECTYPE): Rewrite in terms of new macro.
      (XSETPVECTYPESIZE): New macro, specifying both type and size.
      This is a bit clearer, and further avoids the possibility of
      undesirable aliasing.
      (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
      (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
      and XVECTOR_HEADER_SIZE.
      (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
      since Lisp_Subr is a special case (no "next" field).
      (ASIZE): Rewrite in terms of XVECTOR_SIZE.
      (struct vector_header): New type.
      (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
      object, to help avoid aliasing.
      (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
      (SUBRP): Likewise, since Lisp_Subr is a special case.
      * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
      (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
      (struct Lisp_Hash_Table): Combine first two members into a single
      struct vector_header member.  All uses of "size" and "next" members
      changed to be "header.size" and "header.next".
      * buffer.h (struct buffer): Likewise.
      * font.h (struct font_spec, struct font_entity, struct font): Likewise.
      * frame.h (struct frame): Likewise.
      * process.h (struct Lisp_Process): Likewise.
      * termhooks.h (struct terminal): Likewise.
      * window.c (struct save_window_data, struct saved_window): Likewise.
      * window.h (struct window): Likewise.
      * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
      Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
      * buffer.c (init_buffer_once): Likewise.
      * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
      special case.
      * process.c (Fformat_network_address): Use local var for size,
      for brevity.
      eab3844f
  23. 14 Apr, 2011 1 commit
    • Paul Eggert's avatar
      * process.c: Make symbols static if they're not exported. · 40ccffa6
      Paul Eggert authored
      (process_tick, update_tick, create_process, chan_process):
      (Vprocess_alist, proc_buffered_char, datagram_access):
      (fd_callback_data, send_process_frame, process_sent_to): Now static.
      (deactivate_process): Mark defn as static, as well as decl.
      * lisp.h (create_process): Remove decl.
      * process.h (chan_process, Vprocess_alist): Remove decls.
      40ccffa6
  24. 11 Apr, 2011 1 commit
    • Paul Eggert's avatar
      Declare Lisp_Object Q* variables to be 'static' if not exproted. · 955cbe7b
      Paul Eggert authored
      This makes it easier for human readers (and static analyzers)
      to see whether these variables are used from other modules.
      * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c:
      * ccl.c, character.c, charset.c, cmds.c, coding.c, composite.c:
      * data.c, dbusbind.c, dired.c, editfns.c, eval.c, fileio.c, fns.c:
      * font.c, frame.c, fringe.c, ftfont.c, image.c, keyboard.c, keymap.c:
      * lread.c, macros.c, minibuf.c, print.c, process.c, search.c:
      * sound.c, syntax.c, textprop.c, window.c, xdisp.c, xfaces.c, xfns.c:
      * xmenu.c, xselect.c:
      Declare Q* vars static if they are not used in other modules.
      * ccl.h, character.h, charset.h, coding.h, composite.h, font.h:
      * frame.h, intervals.h, keyboard.h, lisp.h, process.h, syntax.h:
      Remove decls of unexported vars.
      * keyboard.h (EVENT_HEAD_UNMODIFIED): Remove now-unused macro.
      955cbe7b
  25. 25 Jan, 2011 1 commit
  26. 15 Jan, 2011 1 commit
  27. 09 Jan, 2011 1 commit
  28. 02 Jan, 2011 1 commit
  29. 01 Nov, 2010 1 commit
    • Jan Djärv's avatar
      Backport fix for Bug#6571 from trunk. NOTE: May cause merge conflicts. · 3649d303
      Jan Djärv authored
      * src/keyboard.c (input_available_signal): Declare.
      (kbd_buffer_nr_stored): New function.
      (kbd_buffer_store_event_hold): If kbd_buffer_nr_stored returns
      more than KBD_BUFFER_SIZE/2, stop reding input (Bug#6571).
      (kbd_buffer_get_event): If input is suspended and kbd_buffer_nr_stored
      returns less than KBD_BUFFER_SIZE/4, resume reding input (Bug#6571).
      (tty_read_avail_input): If input is on hold, return.
      Don't read more that free slots in kbd_buffer (Bug#6571).
      
      * src/process.c (kbd_is_on_hold): New variable.
      (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p):
      New functions.
      (wait_reading_process_output): If kbd_on_hold_p returns non-zero,
      select on empty input mask.
      (init_process): Initialize kbd_is_on_hold to 0.
      
      * src/process.h (hold_keyboard_input, unhold_keyboard_input)
      (kbd_on_hold_p): Declare.
      3649d303
  30. 29 Sep, 2010 1 commit
  31. 27 Sep, 2010 1 commit
  32. 26 Sep, 2010 2 commits
    • Jan D's avatar
      Add fd handling with callbacks to select, dbus needs it for async operation. · 3fad2ad2
      Jan D authored
      * src/dbusbind.c: Include process.h.
      (dbus_fd_cb, xd_find_watch_fd, xd_toggle_watch)
      (xd_read_message_1): New functions.
      (xd_add_watch, xd_remove_watch): Call xd_find_watch_fd.  Handle
      watch for both read and write.
      (Fdbus_init_bus): Also register xd_toggle_watch.
      (Fdbus_call_method_asynchronously, Fdbus_method_return_internal)
      (Fdbus_method_error_internal, Fdbus_send_signal): Remove call
      to dbus_connection_flush.
      (xd_read_message):  Move most of the code to xd_read_message_1.
      Call xd_read_message_1 until status is COMPLETE.
      
      * src/keyboard.c (readable_events, gobble_input): Remove DBUS code.
      
      * src/process.c (gpm_wait_mask, max_gpm_desc): Remove.
      (write_mask): New variable.
      (max_input_desc): Renamed from max_keyboard_desc.
      (fd_callback_info): New variable.
      (add_read_fd, delete_read_fd, add_write_fd, delete_write_fd): New
      functions.
      (Fmake_network_process): FD_SET write_mask.
      (deactivate_process): FD_CLR write_mask.
      (wait_reading_process_output): Connecting renamed to Writeok.
      check_connect removed.  check_write is new.  Remove references to
      gpm.  Use Writeok/check_write unconditionally (i.e. no #ifdef
      NON_BLOCKING_CONNECT) instead of Connecting.
      Loop over file descriptors and call callbacks in fd_callback_info
      if file descriptor is ready for I/O.
      (add_gpm_wait_descriptor): Just call add_keyboard_wait_descriptor.
      (delete_gpm_wait_descriptor): Just call delete_keyboard_wait_descriptor.
      (keyboard_bit_set): Use max_input_desc.
      (add_keyboard_wait_descriptor, delete_keyboard_wait_descriptor): Remove
      #ifdef subprocesses. Use max_input_desc.
      (init_process): Initialize write_mask and fd_callback_info.
      
      * src/process.h (add_read_fd, delete_read_fd, add_write_fd)
      (delete_write_fd): Declare.
      3fad2ad2
    • Ted Zlatanov's avatar
      Set up GnuTLS support. · 8af55556
      Ted Zlatanov authored
      * configure.in: Set up GnuTLS.
      
      * lisp/net/gnutls.el: GnuTLS glue code to set up a connection.
      
      * src/Makefile.in (LIBGNUTLS_LIBS, LIBGNUTLS_CFLAGS, ALL_CFLAGS)
      (obj, LIBES): Set up GnuTLS support.
      
      * src/config.in: Set up GnuTLS support.
      
      * src/emacs.c: Set up GnuTLS support and call syms_of_gnutls.
      
      * src/gnutls.c: The source code for GnuTLS support in Emacs.
      
      * src/gnutls.h: The GnuTLS glue for Emacs, macros and enums.
      
      * src/process.c (make_process, Fstart_process)
      (read_process_output, send_process): Set up GnuTLS support for
      process input/output file descriptors.
      
      * src/process.h: Set up GnuTLS support.
      8af55556
  33. 11 Aug, 2010 1 commit
    • Jan D's avatar
      Fix -Wwrite_strings in general and for Gtk+ specific code. · 42ca4633
      Jan D authored
      * callproc.c (synch_process_death): Make const.
      (Fcall_process): Make signame const.
      
      * emacs.c (main): Pass char[] to putenv instead of literal.
      
      * floatfns.c (matherr): Use a const char* variable for x->name.
      
      * font.c (font_open_by_name): Make name const.
      
      * font.h (font_open_by_name): Make name const.
      
      * gtkutil.c (get_utf8_string): Always return an allocated string.
      Parameter is const.
      (create_dialog, xg_create_one_menuitem, create_menus)
      (xg_item_label_same_p, xg_update_menu_item): Free result from
      get_utf8_string.
      (xg_separator_p, xg_item_label_same_p): label is const.
      
      * gtkutil.h: Replace widget_value with struct _widget_value.
      (enum button_type, struct _widget_value): Remove and use the one from
      keyboard.h.
      
      * keyboard.h (_widget_value): Add defined USE_GTK.  Replace Boolean
      with unsigned char and XtPointer with void *.
      
      * menu.c (Fx_popup_menu): error_name is const.
      
      * menu.h (w32_menu_show, ns_menu_show, xmenu_show): error parameter
      is const char **.
      
      * w32menu.c (w32_menu_show):
      * nsmenu.m (ns_menu_show): error parameter is const char **.
      
      * process.h (synch_process_death): Is const char*.
      
      * xmenu.c (Fx_popup_dialog): error_name is const char*.
      (xmenu_show): error parameter is const char **. pane_string is const
      char *.
      (button_names): Is const char *.
      (xdialog_show): error_name and pane_string is const.
      
      * xrdb.c (get_system_app): Make path const and use char *p for non-const
      char.
      
      * xselect.c (Fx_get_atom_name): Use char empty[] instead of literal "".
      
      * xsmfns.c (NOSPLASH_OPT): Change to char[].
      (smc_save_yourself_CB): Do xstrdup on all ->type and ->name for
      props.  Free them at the end.
      
      * xterm.c (emacs_class): New char[] for EMACS_CLASS.
      (xim_open_dpy, xim_initialize, xim_close_dpy): Use emacs_class.
      (x_term_init): Use char[] display_opt and name_opt instead of
      string literal. file is const char*.
      42ca4633
  34. 06 Aug, 2010 1 commit
    • Dan Nicolaescu's avatar
      Move declarations to header files. · 3ef1d108
      Dan Nicolaescu authored
      * src/keyboard.h (quit_char): Add declaration.
      * src/process.h (QCport, QCspeed, QCprocess, QCbytesize, QCstopbits)
      (QCparity, Qodd, Qeven, QCflowcontrol, Qhw, Qsw, QCsummary): Add
      declarations.
      * sysdep.c:
      * src/w32.c: Remove the above declarations.
      3ef1d108
  35. 07 Jul, 2010 1 commit
    • Jan D's avatar
      If kbd_buffer is becoming full, stop reading until it drains (Bug#6571). · cb768704
      Jan D authored
      * keyboard.c (input_available_signal): Declare.
      (kbd_buffer_nr_stored): New function.
      (kbd_buffer_store_event_hold): If kbd_buffer_nr_stored returns
      more than KBD_BUFFER_SIZE/2, stop reding input (Bug#6571).
      (kbd_buffer_get_event): If input is suspended and kbd_buffer_nr_stored
      returns less than KBD_BUFFER_SIZE/4, resume reding input (Bug#6571).
      (tty_read_avail_input): If input is on hold, return.
      Don't read more that free slots in kbd_buffer (Bug#6571).
      
      * process.h (hold_keyboard_input, unhold_keyboard_input)
      (kbd_on_hold_p): Declare.
      
      * process.c (kbd_is_on_hold): New variable.
      (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p): New
      functions.
      (wait_reading_process_output): If kbd_on_hold_p returns non-zero,
      select on empty input mask.
      (init_process): Initialize kbd_is_on_hold to 0.
      cb768704
  36. 13 Jan, 2010 1 commit
  37. 08 Jan, 2009 1 commit
  38. 02 Jan, 2009 1 commit