1. 18 Jun, 2013 1 commit
    • Paul Eggert's avatar
      Porting fixes for merged specpdl and backtrace stacks. · 9349e5f7
      Paul Eggert authored
      In particular this ports to 32-bit sparc Sun cc.
      * eval.c (init_eval_once, grow_specpdl): Allocate a specbinding
      array with a dummy element at specpdl[-1], so that its address can
      be taken portably.
      (unbind_to): Do not copy the binding; not needed, now that we
      copy old_value in the one place where the copy is needed.
      * fileio.c (Fwrite_region): Use ptrdiff_t, not int, for specpdl count.
      * lisp.h (BITS_PER_PTRDIFF_T): Remove; no longer needed.
      (union specbinding): Rename from struct specbinding.  Redo layout
      to avoid the need for 'ptrdiff_t nargs : BITS_PER_PTRDIFF_T - 1;',
      which is not portable.  With Sun C 5.12 32-bit sparc, the
      declaration causes nargs to be an unsigned bitfield, a behavior
      that the C standard allows; but Emacs wants nargs to be signed.
      The overall type is now a union of structures rather than a
      structure of union of structures, and the 'kind' member is now a
      bitfield, so that the overall type doesn't grow.  All uses changed.
      * process.c (Fmake_serial_process): Remove unnecessary initialization.
      
      Fixes: debbugs:14643
      9349e5f7
  2. 11 Jun, 2013 1 commit
  3. 08 Jun, 2013 1 commit
    • Jan Djärv's avatar
      Fix compilation issues for GNUStep and GLIB conflicts. · b33f93ee
      Jan Djärv authored
      * configure.ac (HAVE_GLIB): Only set XGSELOBJ if HAVE_NS = no.
      (with_file_notification): Don't set to gfile if with_ns = yes.
      
      * src/process.c (wait_reading_process_output): Check for NS before GLIB.
      GLIB may be linked in due to rsvg, but ns_select must be called.
      
      * src/xgselect.c (xg_select): Remove call to window_system_available
      and g_main_context_pending at the top, so Gdk events (i.e. file
      notify) are processed when Emacs is started with -nw.
      
      * src/xgselect.c: Remove unneeded include xterm.h
      b33f93ee
  4. 05 Jun, 2013 1 commit
    • Paul Eggert's avatar
      Chain glib's SIGCHLD handler from Emacs's (Bug#14474). · f019a684
      Paul Eggert authored
      * process.c (dummy_handler): New function.
      (lib_child_handler): New static var.
      (handle_child_signal): Invoke it.
      (catch_child_signal): If a library has set up a signal handler,
      save it into lib_child_handler.
      (init_process_emacs): If using glib and not on Windows, tickle glib's
      child-handling code so that it initializes its private SIGCHLD handler.
      * syssignal.h (SA_SIGINFO): Default to 0.
      * xterm.c (x_term_init): Remove D-bus hack that I installed on May
      31; it should no longer be needed now.
      f019a684
  5. 03 Jun, 2013 2 commits
    • Jan Djärv's avatar
      Add HAVE_GLIB check instead of checking individual libraries that use GLib. · 55a87246
      Jan Djärv authored
      * configure.ac (HAVE_GLIB): Add GLib check.  Set XGSELOBJ if GLib is
      used.  Remove xgselect.o from XOBJ.
      
      * src/Makefile.in (XGSELOBJ): New, xgselect.o if GLib is used, or empty.
      
      * src/process.c (wait_reading_process_output): Call xg_select if HAVE_GLIB.
      
      * src/xgselect.c: Replace #if defined ... with #ifdef HAVE_GLIB.
      55a87246
    • Paul Eggert's avatar
      Fix minor problems found by static checking. · 3d5ee10a
      Paul Eggert authored
      * data.c (pure_write_error):
      Use xsignal2, not Fsignal, as Fsignal might return.
      * eval.c (set_backtrace_debug_on_exit): Now static.
      (backtrace_p, backtrace_top, backtrace_next, record_in_backtrace):
      No longer inline.  EXTERN_INLINE is needed only for functions
      defined in .h files.  Reindent function header as per GNU style.
      (backtrace_p, backtrace_top, backtrace_next):
      Mark EXTERNALLY_VISIBLE so they don't get optimized away by the
      compiler or linker.  Add extern decls to pacify gcc -Wall.
      * frame.c, frame.h (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource):
      Now static.
      * frame.c (free_monitors): Define only on platforms that need it.
      * nsterm.m (ns_term_init):
      * process.c (catch_child_signal):
      Don't worry about whether SIGCHLD is defined, as SIGCHLD is
      defined on all porting targets these days.
      * process.c, process.h (catch_child_signal):
      Make it extern only if NS_IMPL_GNUSTEP is defined.
      3d5ee10a
  6. 02 Jun, 2013 1 commit
    • Jan Djärv's avatar
      Update the GNUStep port so it works OK. Redraw and sizing bugs remain. · c0342369
      Jan Djärv authored
      * nextstep/templates/Info-gnustep.plist.in: Add NSDocumentClass EmacsDocument.
      
      * src/nsfns.m (x_set_foreground_color, x_set_background_color): Use
      EmacsCGFloat.
      (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove
      unused variables.
      (Fns_read_file_name): Keep track if panel is for save.  Use
      ns_filename_from_panel/ns_directory_from_panel.
      (Fns_list_services): delegate only used for COCOA.
      (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep.  Just
      return the input if GNUStep.
      (x_screen_planes): Remove.
      (Fxw_color_values): Use EmacsCGFloat
      (Fns_display_monitor_attributes_list): Only get screen number for
      Cocoa.
      (getDirectory, getFilename): Removed from EmacsOpenPanel and
      EmacsSavePanel.
      (EmacsOpenPanel:ok:): Use ns_filename_from_panel and
      ns_directory_from_panel.
      
      * src/nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor)
      (ns_charset_covers, ns_get_covering_families, nsfont_open):
      Use F suffix on floats.
      (ns_char_width): Returns CGFloat.
      (ns_ascii_average_width): w is CGFloat instead of float.
      (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to
      DPSxshow.
      (ns_glyph_metrics): CGFloat instead of float.
      
      * src/nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat.
      
      * src/nsmenu.m (ns_update_menubar): Make static.
      (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA
      (fillWithWidgetValue:): Add cast to SEL for setAction.
      (addSubmenuWithTitle:forFrame:): Add cast to SEL for action.
      (update_frame_tool_bar): Update code for GNUStep.
      (clearAll): New method.
      (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag
      argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. Move
      identifierToItem setObject and activeIdentifiers addObject before
      call to insertItemWithItemIdentifier.
      (validateVisibleItems): Fix indentation.
      (toolbarAllowedItemIdentifiers:): Return activeIdentifiers.
      (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and
      UtilityWindow to aStyle, remove call to setStyleMask.
      
      * src/nsselect.m (ns_get_local_selection): Remove unused variable type.
      
      * src/nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size
      of CGFloat differs.
      (EmacsApp): New variable nextappdefined.  Declare sendFromMainThread
      when NS_IMPL_GNUSTEP.
      (EmacsDocument): Declare when NS_IMPL_GNUSTEP.
      (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove.
      (EmacsToolbar): Add clearAll.  Add tag argument to
      addDisplayItemWithImage.
      (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory.
      
      * src/nsterm.m: Include src/process.h if NS_IMPL_GNUSTEP.
      (ns_menu_bar_is_hidden, menu_will_open_state): Define only if
      NS_IMPL_COCOA.
      (x_set_cursor_type): Remove declaration.
      (ns_update_begin): Only use r and bp if NS_IMPL_COCOA.
      (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code.
      (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP.
      (ns_get_color): Use F suffix on float.
      (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat.
      (ns_get_rgb_color): Remove.
      (x_set_frame_alpha): Move view inside NS_IMPL_COCOA.
      (note_mouse_movement): x and y are CGFloat.
      (ns_draw_fringe_bitmap): Remove unused rowY.
      Change #if to COCOA && >= 10_6.
      (ns_draw_window_cursor): Remove unused overspill.
      (ns_draw_underwave): width and x are EamcsCGFloat.
      (ns_draw_box): thickness is CGFloat.
      (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6.
      (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread
      if not in main thread.
      (ns_get_pending_menu_title, ns_check_menu_open)
      (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5.
      (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD.
      (sendFromMainThread:): New method.
      (changeFont:): size is CGFloat.
      (keyDown:): Check for Delete when NS_IMPL_GNUSTEP.
      Disable warning about permanent text.
      (characterIndexForPoint:): Adjust return type depending on GNUStep
      version.
      (mouseDown:): delta is CGFloat.
      (updateFrameSize): Remove unised variable f.
      (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA.
      Cast float to EmacsCGFloat.
      (windowWillUseStandardFrame:defaultFrame:): Set maximized_height
      also to -1 when restoring.
      (windowDidExitFullScreen:): Put call to updateCollectionBehaviour
      inside NS_IMPL_COCOA.
      (toggleFullScreen:): Put call to toggleFullScreen inside
      NS_IMPL_COCOA.  Cast float to EmacsCGFloat.
      (setPosition:portion:whole:): por is CGFloat.
      (getMouseMotionPart:window:x:y:): Add F suffix to float.
      (mouseDown:): Use CGFloat.
      (mouseDragged:): Remove unised variable edge.
      (EmacsDocument): Implement for NS_IMPL_GNUSTEP.
      
      * src/process.c (catch_child_signal): New function.
      (init_process_emacs): Call it.
      
      * src/process.h (catch_child_signal): Declare.
      c0342369
  7. 01 Jun, 2013 1 commit
  8. 15 May, 2013 1 commit
    • Stefan Monnier's avatar
      * src/process.c: Export default filters and sentinels to Elisp. · 1aa8d505
      Stefan Monnier authored
      (Qinternal_default_process_sentinel, Qinternal_default_process_filter):
      New constants.
      (pset_filter, pset_sentinel, make_process, Fset_process_filter)
      (Fset_process_sentinel, Fformat_network_address):
      Default to them instead of nil.
      (server_accept_connection): Sentinels can't be nil any more.
      (read_and_dispose_of_process_output): New function, extracted from
      read_process_output.
      (read_process_output): Use it; filters can't be nil.
      (Finternal_default_process_filter): New function, extracted from
      read_process_output.
      (exec_sentinel_unwind): Remove function.
      (exec_sentinel): Don't zilch sentinel while running.
      (status_notify): Sentinels can't be nil.
      (Finternal_default_process_sentinel): New function extracted from
      status_notify.
      (setup_process_coding_systems): Default filter is not nil any more.
      (syms_of_process): Export new Elisp functions and initialize
      new constants.
      * src/lisp.h (make_lisp_proc): New function.
      1aa8d505
  9. 02 Apr, 2013 1 commit
    • Paul Eggert's avatar
      Prefer < to > in range checks such as 0 <= i && i < N. · 7216e43b
      Paul Eggert authored
      This makes it easier to visualize quantities on a number line.
      This patch doesn't apply to all such range checks,
      only to the range checks affected by the 2013-03-24 change.
      This patch reverts most of the 2013-03-24 change.
      * alloc.c (xpalloc, Fgarbage_collect):
      * ccl.c (ccl_driver, resolve_symbol_ccl_program):
      * character.c (string_escape_byte8):
      * charset.c (read_hex):
      * data.c (cons_to_unsigned):
      * dispnew.c (update_frame_1):
      * doc.c (Fsubstitute_command_keys):
      * doprnt.c (doprnt):
      * editfns.c (hi_time, decode_time_components):
      * fileio.c (file_offset):
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      * font.c (font_intern_prop):
      * frame.c (x_set_alpha):
      * gtkutil.c (get_utf8_string):
      * indent.c (check_display_width):
      * keymap.c (Fkey_description):
      * lisp.h (FIXNUM_OVERFLOW_P, vcopy):
      * lread.c (read1):
      * minibuf.c (read_minibuf_noninteractive):
      * process.c (wait_reading_process_output):
      * search.c (Freplace_match):
      * window.c (get_phys_cursor_glyph):
      * xdisp.c (redisplay_internal):
      * xsmfns.c (smc_save_yourself_CB):
      Prefer < to > for range checks.
      * dispnew.c (sit_for): Don't mishandle NaNs.
      This fixes a bug introduced in the 2013-03-24 change.
      * editfns.c (decode_time_components): Don't hoist comparison.
      This fixes another bug introduced in the 2013-03-24 change.
      7216e43b
  10. 24 Mar, 2013 2 commits
    • Andreas Schwab's avatar
      Reorder conditions that are written backwards · 908589fd
      Andreas Schwab authored
      * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are
      written backwards.
      * blockinput.h (input_blocked_p): Likewise.
      * bytecode.c (exec_byte_code): Likewise.
      * callproc.c (call_process_kill, call_process_cleanup)
      (Fcall_process): Likewise.
      * ccl.c (ccl_driver, resolve_symbol_ccl_program)
      (Fccl_execute_on_string): Likewise.
      * character.c (string_escape_byte8): Likewise.
      * charset.c (read_hex): Likewise.
      * cm.c (calccost): Likewise.
      * data.c (cons_to_unsigned): Likewise.
      * dired.c (directory_files_internal, file_name_completion):
      Likewise.
      * dispnew.c (scrolling_window, update_frame_1, Fsleep_for)
      (sit_for): Likewise.
      * doc.c (Fsubstitute_command_keys): Likewise.
      * doprnt.c (doprnt): Likewise.
      * editfns.c (hi_time, decode_time_components, Fformat): Likewise.
      * emacsgtkfixed.c: Likewise.
      * fileio.c (file_offset, Fwrite_region): Likewise.
      * floatfns.c (Fexpt, fmod_float): Likewise.
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      Likewise.
      * font.c (font_intern_prop): Likewise.
      * frame.c (x_set_alpha): Likewise.
      * gtkutil.c (get_utf8_string): Likewise.
      * indent.c (check_display_width): Likewise.
      * intervals.c (create_root_interval, rotate_right, rotate_left)
      (split_interval_right, split_interval_left)
      (adjust_intervals_for_insertion, delete_node)
      (interval_deletion_adjustment, adjust_intervals_for_deletion)
      (merge_interval_right, merge_interval_left, copy_intervals)
      (set_intervals_multibyte_1): Likewise.
      * keyboard.c (gobble_input, append_tool_bar_item): Likewise.
      * keymap.c (Fkey_description): Likewise.
      * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise.
      * lread.c (openp, read_integer, read1, string_to_number):
      Likewise.
      * menu.c (ensure_menu_items): Likewise.
      * minibuf.c (read_minibuf_noninteractive): Likewise.
      * print.c (printchar, strout): Likewise.
      * process.c (create_process, Faccept_process_output)
      (wait_reading_process_output, read_process_output, send_process)
      (wait_reading_process_output): Likewise.
      * profiler.c (make_log, handle_profiler_signal): Likewise.
      * regex.c (re_exec): Likewise.
      * regex.h: Likewise.
      * search.c (looking_at_1, Freplace_match): Likewise.
      * sysdep.c (get_child_status, procfs_ttyname)
      (procfs_get_total_memory): Likewise.
      * systime.h (EMACS_TIME_VALID_P): Likewise.
      * term.c (dissociate_if_controlling_tty): Likewise.
      * window.c (get_phys_cursor_glyph): Likewise.
      * xdisp.c (init_iterator, redisplay_internal, redisplay_window)
      (try_window_reusing_current_matrix, try_window_id, pint2hrstr):
      Likewise.
      * xfns.c (Fx_window_property): Likewise.
      * xmenu.c (set_frame_menubar): Likewise.
      * xselect.c (x_get_window_property, x_handle_dnd_message):
      Likewise.
      * xsmfns.c (smc_save_yourself_CB): Likewise.
      * xterm.c (x_scroll_bar_set_handle): Likewise.
      908589fd
    • Paul Eggert's avatar
      Static checking by GCC 4.8-20130319. · a9ebfa0b
      Paul Eggert authored
      * image.c (gif_load): Assume pass < 3 to pacify GCC.
      * process.c (Fset_process_datagram_address)
      (Fmake_network_process): Check get_lisp_to_sockaddr_size return value.
      * xdisp.c (get_char_face_and_encoding):
      (get_glyph_face_and_encoding): Ensure that *CHAR2B is initialized.
      (get_glyph_face_and_encoding): Prepare face before possibly using it.
      (get_per_char_metric): Don't use CHAR2B if it might not be initialized.
      a9ebfa0b
  11. 08 Mar, 2013 1 commit
    • Paul Eggert's avatar
      print.c, process.c: Use bool for booleans. · 0bce5d9e
      Paul Eggert authored
      * lisp.h (wait_reading_process_output):
      * print.c (print_output_debug_flag, PRINTDECLARE, printchar)
      (strout, debug_output_compilation_hack, float_to_string, print)
      (print_object):
      * process.c (kbd_is_on_hold, inhibit_sentinels, process_output_skip)
      (decode_status, status_message, create_process, create_pty)
      (Fmake_network_process, Fnetwork_interface_info)
      (wait_reading_process_output, read_process_output)
      (write_queue_push, write_queue_pop, process_send_signal)
      (handle_child_signal, keyboard_bit_set, kbd_on_hold_p):
      * process.h (struct Lisp_Process, inhibit_sentinels, kbd_on_hold_p):
      Use bool for booleans.
      * process.c (Fnetwork_interface_list): Remove unused local.
      (connect_counter): Now EMACS_INT, not int.
      0bce5d9e
  12. 17 Feb, 2013 1 commit
    • Stefan Monnier's avatar
      Prefer `message1' over `message'. · 2f73da9c
      Stefan Monnier authored
      * src/xml.c (init_libxml2_functions):
      * src/sound.c (sound_warning):
      * src/sheap.c (report_sheap_usage):
      * src/process.c (wait_reading_process_output):
      * src/msdos.c (XMenuActivate):
      * src/macros.c (Fstart_kbd_macro, Fend_kbd_macro):
      * src/keyboard.c (top_level_1):
      * src/editfns.c (Fmessage, Fmessage_box):
      * src/callint.c (Fcall_interactively):
      * src/fns.c (Fyes_or_no_p): Prefer `message1' over `message'.
      2f73da9c
  13. 15 Feb, 2013 1 commit
  14. 01 Jan, 2013 1 commit
  15. 20 Dec, 2012 1 commit
    • Dmitry Antipov's avatar
      Avoid calls to CHAR_TO_BYTE if byte position is known. · 13002885
      Dmitry Antipov authored
      * editfns.c (make_buffer_string_both): Use move_gap_both.
      (Fbuffer_string): Use make_buffer_string_both.
      * marker.c (buf_charpos_to_bytepos): Convert to eassert.
      Adjust comment.
      (buf_bytepos_to_charpos): Likewise.
      (charpos_to_bytepos): Remove.
      * fileio.c (Finsert_file_contents): Use move_gap_both.
      * search.c (Freplace_match): Likewise.
      * process.c (process_send_region): Likewise. Use convenient
      names for byte positions.
      * lisp.h (charpos_to_bytepos): Remove prototype.
      * indent.c (scan_for_column): Use CHAR_TO_BYTE.
      * insdel.c (move_gap): Likewise.
      13002885
  16. 17 Dec, 2012 1 commit
    • Paul Eggert's avatar
      Don't reraise SIGCHLD, as that can now lose. · 207a7ef0
      Paul Eggert authored
      With the 2012-12-03 fix for Bug#12980 in place, an old workaround
      for some of that bug's symptoms can now cause Emacs to abort.
      Remove the workaround.
      * process.c (wait_reading_process_output): Don't reraise SIGCHLD.
      The bug that caused SIGCHLD to get lost has been fixed, and the
      workaround for it can now cause Emacs to abort.
      
      Fixes: debbugs:13192
      207a7ef0
  17. 08 Dec, 2012 1 commit
    • Paul Eggert's avatar
      Assume POSIX 1003.1-1988 or later for signal.h. · d983a10b
      Paul Eggert authored
      Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN,
      SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these.
      * admin/CPP-DEFINES (SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, SIGQUIT):
      Remove.
      (SIGTRAP): Remove this one too, as config.h no longer defines it.
      * admin/merge-gnulib (GNULIB_MODULES): Add sig2str.
      * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
      Use SIGCHLD rather than SIGCLD.
      * lib/sig2str.c, lib/sig2str.h, m4/sig2str.m4: New files, from gnulib.
      * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
      * lib/makefile.w32-in (GNULIBOBJS): Add $(BUILD)/sig2str.$(O).
      * src/process.c [subprocesses]: Include <c-ctype.h>, <sig2str.h>.
      (deleted_pid_list, Fdelete_process, create_process)
      (record_child_status_change, handle_child_signal, deliver_child_signal)
      (init_process_emacs, syms_of_process):
      Assume SIGCHLD is defined.
      (parse_signal): Remove.  All uses removed.
      (abbr_to_signal): New static function.
      (Fsignal_process): Use it to convert signal names to ints.
      * src/sysdep.c (sys_suspend) [!DOS_NT]: Use kill (0, ...) rather than
      kill (getpgrp (), ...).
      (emacs_sigaction_init): Assume SIGCHLD is defined.
      (init_signals): Assume SIGALRM, SIGCHLD, SIGHUP, SIGKILL,
      SIGPIPE, and SIGQUIT are defined.  Do not worry about SIGCLD any more.
      * src/syssignal.h (EMACS_KILLPG): Remove.
      All uses replaced by 'kill' with a negative pid.
      (SIGCHLD): Remove definition, as we now assume SIGCHLD.
      * src/w32proc.c (sys_kill): Support negative pids compatibly with POSIX.
      
      Fixes: debbugs:13026
      d983a10b
  18. 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
  19. 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
  20. 02 Dec, 2012 1 commit
    • Paul Eggert's avatar
      Use execve to avoid need to munge environ. · 21e54a94
      Paul Eggert authored
      * callproc.c (Fcall_process):
      * process.c (create_process):
      Don't save and restore environ;	no longer needed.
      * callproc.c (child_setup):
      Use execve, not execvp, to preserve environ.
      
      Fixes: debbugs:13054
      21e54a94
  21. 27 Nov, 2012 1 commit
    • Paul Eggert's avatar
      Assume POSIX 1003.1-1988 or later for errno.h. · 22626a85
      Paul Eggert authored
      * lib-src/movemail.c (main): Assume EAGAIN and EBUSY.
      * src/dired.c (directory_files_internal, file_name_completion):
      Assume EAGAIN and EINTR are defined.
      * src/fileio.c (Fcopy_file): Assume EISDIR is defined.
      * src/gmalloc.c (ENOMEM, EINVAL): Assume they're defined.
      * src/gnutls.c (emacs_gnutls_write): Assume EAGAIN is defined.
      * src/lread.c (readbyte_from_file): Assume EINTR is defined.
      * src/process.c (wait_reading_process_output, send_process) [subprocesses]:
      Assume EIO and EAGAIN are defined.
      * src/unexcoff.c (write_segment): Assume EFAULT is defined.
      
      Fixes: debbugs:12968
      22626a85
  22. 24 Nov, 2012 1 commit
  23. 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
  24. 17 Nov, 2012 3 commits
    • Paul Eggert's avatar
      Assume POSIX 1003.1-1988 or later for fcntl.h. · 49cdacda
      Paul Eggert authored
      * admin/CPP-DEFINES (O_RDONLY, O_RDWR, HAVE_FCNTL_H): Remove.
      * admin/merge-gnulib (GNULIB_MODULES): Add fcntl-h.
      * configure.ac: Do not check for fcntl.h.
      * lib/gnulib.mk: Regenerate.
      * lib-src/movemail.c, lib-src/update-game-score.c: Assume <fcntl.h> exists.
      * nt/inc/sys/socket.h (O_NONBLOCK): Rename from O_NDELAY, since the
      POSIX name for this flag is O_NONBLOCK.  All uses changed.
      * nt/inc/unistd.h (O_RDWR, O_NOCTTY): New macros.  Like AT_FDCWD etc.
      these really should be moved to a replacement <fcntl.h> if and
      when that gets implemented.  In the meantime, include <fcntl.h>
      to make sure we don't override its definitions.
      * src/callproc.c (relocate_fd): Assume F_DUPFD.
      * src/emacs.c, src/term.c (O_RDWR): Remove.
      * src/keyboard.c (tty_read_avail_input): Use O_NONBLOCK rather than
      O_NDELAY, since O_NONBLOCK is the standard name for this flag.
      * src/nsterm.m: Assume <fcntl.h> exists.
      * src/process.c (NON_BLOCKING_CONNECT, allocate_pty, create_process)
      (create_pty, Fmake_network_process, server_accept_connection)
      (wait_reading_process_output, init_process_emacs):
      Assume O_NONBLOCK.
      (wait_reading_process_output): Put in a special case for WINDOWSNT
      to mimick the older behavior where it had O_NDELAY but not O_NONBLOCK.
      It's not clear this is needed, but it's a more-conservative change.
      (create_process): Assume FD_CLOEXEC.
      (create_process, create_pty): Assume O_NOCTTY.
      * src/sysdep.c (init_sys_modes, reset_sys_modes): Assume F_SETFL.
      (reset_sys_modes): Use O_NONBLOCK rather than O_NDELAY.
      Omit if not DOS_NT, since F_GETFL is not defined there.
      (serial_open): Assume O_NONBLOCK and O_NOCTTY.
      * src/term.c: Include <fcntl.h>, for flags like O_NOCTTY.
      (O_NOCTTY): Remove.
      (init_tty): Assume O_IGNORE_CTTY is defined to 0 on platforms that
      lack it, since gnulib guarantees this.
      * src/w32.c (fcntl): Test for O_NONBLOCK rather than O_NDELAY.
      
      Fixes: debbugs:12881
      49cdacda
    • Paul Eggert's avatar
      Update comment to match recent change. · 9fa3ccd9
      Paul Eggert authored
      9fa3ccd9
    • Eli Zaretskii's avatar
      Fix bug #12829 with aborts on MS-Windows when several child processes die. · 22bae83f
      Eli Zaretskii authored
       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.
      22bae83f
  25. 16 Nov, 2012 1 commit
    • Paul Eggert's avatar
      Remove no-longer-used pty_max_bytes variable. · 3d082a26
      Paul Eggert authored
      * configure.ac (fpathconf): Remove unnecessary check.
      * admin/CPP-DEFINES (HAVE_FPATHCONF): Remove.
      * src/process.c (pty_max_bytes): Remove; unused.
      (send_process): Do not set it.
      3d082a26
  26. 14 Nov, 2012 1 commit
    • Paul Eggert's avatar
      Use faccessat, not access, when checking file permissions. · 73dcdb9f
      Paul Eggert authored
      This fixes a bug that has been present in Emacs since its creation.
      It was reported by Chris Torek in 1983 even before GNU Emacs existed,
      which must set some sort of record.  (Torek's bug report was against
      a predecessor of GNU Emacs, but GNU Emacs happened to have the
      same common flaw.)  See Torek's Usenet posting
      "setuid/setgid programs & Emacs" Article-I.D.: sri-arpa.858
      Posted: Fri Apr  8 14:18:56 1983.
      * .bzrignore: Add lib/fcntl.h.
      * configure.ac (euidaccess): Remove check; gnulib does this for us now.
      (gl_FCNTL_O_FLAGS): Define a dummy version.
      * lib/at-func.c, lib/euidaccess.c, lib/faccessat.c, lib/fcntl.in.h:
      * lib/getgroups.c, lib/group-member.c, lib/root-uid.h:
      * lib/xalloc-oversized.h, m4/euidaccess.m4, m4/faccessat.m4:
      * m4/fcntl_h.m4, m4/getgroups.m4, m4/group-member.m4:
      New files, from gnulib.
      * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
      * admin/merge-gnulib (GNULIB_MODULES): Add faccessat.
      (GNULIB_TOOL_FLAGS): Avoid at-internal, fchdir, malloc-posix,
      openat-die, openat-h, save-cwd.  Do not avoid fcntl-h.
      Omit gnulib's m4/fcntl-o.m4.
      * nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS): New symbols.
      (access): Remove.
      (faccessat): New macro.
      * src/Makefile.in (LIB_EACCESS): New macro.
      (LIBES): Use it.
      * src/callproc.c (init_callproc):
      * src/charset.c (init_charset):
      * src/fileio.c (check_existing, check_executable, check_writable)
      (Ffile_readable_p):
      * src/lread.c (openp, load_path_check):
      * src/process.c (allocate_pty):
      * src/xrdb.c (file_p):
      Use effective UID when checking permissions, not real UID.
      * src/callproc.c (init_callproc):
      * src/charset.c (init_charset):
      * src/lread.c (load_path_check, init_lread):
      Test whether directories are accessible, not merely whether they exist.
      * src/conf_post.h (GNULIB_SUPPORT_ONLY_AT_FDCWD): New macro.
      * src/fileio.c (check_existing, check_executable, check_writable)
      (Ffile_readable_p):
      Use symbolic names instead of integers for the flags, as they're
      portable now.
      (check_writable): New arg AMODE.  All uses changed.
      Set errno on failure.
      (Ffile_readable_p): Use faccessat, not stat + open + close.
      (Ffile_writable_p): No need to call check_existing + check_writable.
      Just call check_writable and then look at errno.  This saves a syscall.
      dir should never be nil; replace an unnecessary runtime check
      with an eassert.  When checking the parent directory of a nonexistent
      file, check that the directory is searchable as well as writable, as
      we can't create files in unsearchable directories.
      (file_directory_p): New function, which uses 'stat' on most platforms
      but faccessat with D_OK (for efficiency) if WINDOWSNT.
      (Ffile_directory_p, Fset_file_times): Use it.
      (file_accessible_directory_p): New function, which uses a single
      syscall for efficiency.
      (Ffile_accessible_directory_p): Use it.
      * src/xrdb.c (file_p): Use file_directory_p.
      * src/lisp.h (file_directory_p, file_accessible_directory_p): New decls.
      * src/lread.c (openp): When opening a file, use fstat rather than
      stat, as that avoids a permissions race.  When not opening a file,
      use file_directory_p rather than stat.
      (dir_warning): First arg is now a usage string, not a format.
      Use errno.  All uses changed.
      * src/nsterm.m (ns_term_init): Remove unnecessary call to file-readable
      that merely introduced a race.
      * src/process.c, src/sysdep.c, src/term.c: All uses of '#ifdef O_NONBLOCK'
      changed to '#if O_NONBLOCK', to accommodate gnulib O_* style,
      and similarly for the other O_* flags.
      * src/w32.c (sys_faccessat): Rename from sys_access and switch to
      faccessat's API.  All uses changed.
      * src/xrdb.c: Do not include <sys/stat.h>; no longer needed.
      (magic_db): Rename from magic_file_p.
      (magic_db, search_magic_path): Return an XrmDatabase rather than a
      char *, so that we don't have to test for file existence
      separately from opening the file for reading.  This removes a race
      fixes a permission-checking problem, and simplifies the code.
      All uses changed.
      (file_p): Remove; no longer needed.
      
      Fixes: debbugs:12632
      73dcdb9f
  27. 05 Nov, 2012 2 commits
    • Chong Yidong's avatar
    • Paul Eggert's avatar
      Assume at least POSIX.1-1988 for getpgrp, setpgid, setsid. · dd0333b6
      Paul Eggert authored
      This removes code that has been obsolete since around 1990.
      * admin/CPP-DEFINES (HAVE_SETPGID, HAVE_SETSID, SETPGRP_RELEASES_CTTY):
      Remove; obsolete.
      * configure.ac (setpgid, setsid): Assume their existence.
      (AC_FUNC_GETPGRP, SETPGRP_RELEASES_CTTY): Remove; obsolete.
      * src/callproc.c (Fcall_process):
      * src/emacs.c (main):
      * src/process.c (create_process):
      * src/term.c (dissociate_if_controlling_tty):
      Assume setsid exists.
      * src/callproc.c (child_setup): Assume setpgid exists and behaves as
      per POSIX.1-1988 or later.
      * src/conf_post.h (setpgid) [!HAVE_SETPGID]: Remove.
      * src/emacs.c (shut_down_emacs):
      * src/sysdep.c (sys_suspend, init_foreground_group):
      Assume getpgrp behaves as per POSIX.1-1998 or later.
      * src/msdos.c (setpgrp): Remove.
      (tcgetpgrp, setpgid, setsid): New functions.
      * src/systty.h (EMACS_GETPGRP): Remove.  All callers now use getpgrp.
      * src/term.c (no_controlling_tty): Remove; unused.
      * src/w32proc.c (setpgrp): Remove.
      (setsid, tcgetpgrp): New functions.
      
      Fixes: debbugs:12800
      dd0333b6
  28. 03 Nov, 2012 3 commits
    • 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
    • Chong Yidong's avatar
    • Chong Yidong's avatar
      Fix a race condition in wait_reading_process_output (tiny change). · 893cc455
      Chong Yidong authored
      * src/process.c (wait_reading_process_output): Avoid a race condition
      with SIGIO delivery.
      
      Fixes: debbugs:11536
      893cc455
  29. 31 Oct, 2012 1 commit
    • Paul Eggert's avatar
      Fix crash when using Emacs as commit editor for git. · 322aea6d
      Paul Eggert authored
      * callproc.c (setpgrp): Remove macro, as we now use setpgid
      and it is configured in conf_post.h.
      (Fcall_process): Don't invoke both setsid and setpgid; the former
      is enough, if it exists.
      * callproc.c (Fcall_process, child_setup):
      * process.c (create_process): Use setpgid.
      * conf_post.h (setpgid) [!HAVE_SETPGID]: New macro, which substitutes
      for the real thing.
      * dispnew.c (init_display): Initialize the foreground group
      if we are running a tty display.
      * emacs.c (main): Do not worry about setpgrp; init_display does it now.
      * lisp.h (init_foreground_group): New decl.
      * sysdep.c (inherited_pgroup): New static var.
      (init_foreground_group, tcsetpgrp_without_stopping)
      (narrow_foreground_group, widen_foreground_group): New functions.
      (init_sys_modes): Narrow foreground group.
      (reset_sys_modes): Widen foreground group.
      
      Fixes: debbugs:12697
      322aea6d
  30. 19 Oct, 2012 2 commits
    • Paul Eggert's avatar
      Undo faccessat change. · f0a80175
      Paul Eggert authored
      f0a80175
    • Paul Eggert's avatar
      Use faccessat, not access, when checking file permissions. · e752e0b0
      Paul Eggert authored
      * .bzrignore: Add lib/fcntl.h.
      * configure.ac (euidaccess): Remove check; gnulib does this for us now.
      (gl_FCNTL_O_FLAGS): Define a dummy version.
      * lib/at-func.c, lib/euidaccess.c, lib/faccessat.c, lib/fcntl.in.h:
      * lib/getgroups.c, lib/group-member.c, lib/root-uid.h:
      * lib/xalloc-oversized.h, m4/euidaccess.m4, m4/faccessat.m4:
      * m4/fcntl_h.m4, m4/getgroups.m4, m4/group-member.m4:
      New files, from gnulib.
      * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
      * admin/merge-gnulib (GNULIB_MODULES): Add faccessat.
      (GNULIB_TOOL_FLAGS): Avoid at-internal, fchdir, malloc-posix,
      openat-die, openat-h, save-cwd.  Do not avoid fcntl-h.
      Omit gnulib's m4/fcntl-o.m4.
      * nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS): New symbols.
      (access): Remove.
      (faccessat): New macro.
      * src/Makefile.in (LIB_EACCESS): New macro.
      (LIBES): Use it.
      * src/callproc.c (init_callproc):
      * src/charset.c (init_charset):
      * src/fileio.c (check_existing, check_executable):
      * src/lread.c (openp, load_path_check):
      * src/process.c (allocate_pty):
      * src/xrdb.c (file_p):
      Use faccessat, not access or euidaccess.  Use symbolic names
      instead of integers for the flags, as they're portable now.
      * src/charset.c, src/xrdb.c: Include <fcntl.h>, for the new flags used.
      * src/fileio.c (Ffile_readable_p):
      Use faccessat, not stat + open + close.
      (file_directory_p): New function, which uses 'stat' on most places
      but 'access' (for efficiency) if WINDOWSNT.
      * src/fileio.c (Ffile_directory_p, Fset_file_times):
      * src/xrdb.c (file_p): Use file_directory_p.
      * src/lisp.h (file_directory_p): New decl.
      * src/lread.c (openp): When opening a file, use fstat rather than
      stat, as that avoids a permissions race.  When not opening a file,
      use file_directory_p rather than stat.
      * src/process.c, src/sysdep.c, src/term.c: All uses of '#ifdef O_NONBLOCK'
      changed to '#if O_NONBLOCK', to accommodate gnulib O_* tyle.
      * src/w32.c (sys_faccessat): Rename from sys_access and switch to
      faccessat's API.  All uses changed.
      
      Fixes: debbugs:12632
      e752e0b0
  31. 17 Oct, 2012 1 commit
    • Eli Zaretskii's avatar
      Fix warnings when compiling on MS-Windows with -std=gnu99. · a68089e4
      Eli Zaretskii authored
       src/makefile.w32-in ($(BLD)/w32.$(O)): 
       ($(BLD)/vm-limit.$(O)): 
       ($(BLD)/term.$(O)): 
       ($(BLD)/unexw32.$(O)): 
       ($(BLD)/fileio.$(O)): 
       ($(BLD)/dispnew.$(O)): Update dependencies.
       src/w32term.h (w32_initialize_display_info, initialize_w32_display):
       Add prototypes.
       src/w32proc.c: Include ctype.h.
       src/w32.h (init_environment, check_windows_init_file)
       (syms_of_ntproc, syms_of_ntterm, dostounix_filename)
       (unixtodos_filename, init_winsock, srandom, random, sys_pipe)
       (set_process_dir, sys_spawnve, register_child, sys_sleep, getwd)
       (sys_link): Add prototypes.
       src/w32.c: Include w32select.h.
       (sys_access, e_malloc, sys_select): Add prototypes.
       (emacs_gnutls_pull): 'timeout' is now EMACS_TIME, not struct timeval.
       src/vm-limit.c [WINDOWSNT]: Include w32heap.h.
       src/unexw32.c: Include lisp.h and w32.h.
       src/term.c [WINDOWSNT]: Include w32term.h.
       src/process.c [WINDOWSNT]: Add prototype of sys_select.
       src/fileio.c [WINDOWSNT]: Include w32.h.
       src/dispnew.c [WINDOWSNT]: Include w32.h.
      
       nt/inc/pwd.h (getuid, geteuid): Add prototypes.
       nt/inc/ms-w32.h (sys_wait, _getpid, gmtgime_r, localtime_r)
       (signal_handler, sys_signal, sigemptyset, sigfillset, sigprocmask)
       (pthread_sigmask, sigismember, setpgrp, sigaction, alarm)
       (sys_kill, getpagesize): Add prototypes for emulated functions.
       nt/inc/grp.h (getgid, getegid): Add prototypes.
       nt/gmake.defs (DEBUG_CFLAGS) [NOOPT]: Add -std=gnu99.
       nt/configure.bat (chkapiN): Avoid compiler warning in junk.c when
       compiling with -std=gnu99.
       nt/config.nt (CHECK_LISP_OBJECT_TYPE): Don't undef, so that it
       could be used via --cflags switch to configure.bat.
      a68089e4
  32. 13 Oct, 2012 1 commit
    • Paul Eggert's avatar
      Fix some stat-related races. · d6453ce4
      Paul Eggert authored
      * fileio.c (Fwrite_region): Avoid race condition if a file is
      removed or renamed by some other process immediately after Emacs
      writes it but before Emacs stats it.  Do not assume that stat (or
      fstat) succeeds.
      * image.c (slurp_file): Resolve the file name with fopen + fstat
      rather than stat + fopen.
      (pbm_read_file) [0]: Remove unused code with stat race.
      * process.c (allocate_pty) [HAVE_PTYS && !PTY_ITERATION && !PTY_OPEN]:
      Remove ineffective code with stat race.
      d6453ce4