1. 28 Jul, 2014 1 commit
    • Dmitry Antipov's avatar
      On GNU/Linux, use timerfd for asynchronous timers. · 768b24eb
      Dmitry Antipov authored
      * configure.ac (toplevel): Check whether GNU/Linux-specific
      timerfd functions and macros are available.
      * m4/clock_time.m4 (gl_CLOCK_TIME): Check for clock_getres as well.
      * src/atimer.c (toplevel) [HAVE_TIMERFD]: Include sys/timerfd.h.
      (toplevel): Rename alarm_timer_ok to special_timer_available.
      [HAVE_TIMERFD]: Declare timerfd.
      [HAVE_CLOCK_GETRES]: Declare resolution.
      (start_atimer) [HAVE_CLOCK_GETRES]: Round up timestamp to
      system timer resolution.
      (set_alarm) [HAVE_TIMERFD]: Use timerfd_settime.
      (timerfd_callback) [HAVE_TIMERFD]: New function.
      (atimer_result, debug_timer_callback, Fdebug_timer_check)
      [ENABLE_CHECKING]: New function for the sake of automated tests.
      (init_atimer) [HAVE_TIMERFD]: Setup timerfd.
      [HAVE_CLOCK_GETRES]: Likewise for system timer resolution.
      [ENABLE_CHECKING]: Defsubr test function.
      * src/atimer.h (timerfd_callback) [HAVE_TIMERFD]: Add prototype.
      * src/lisp.h (add_timer_wait_descriptor) [HAVE_TIMERFD]: Likewise.
      * src/process.c (add_timer_wait_descriptor) [HAVE_TIMERFD]: New function.
      * test/automated/timer-tests.el (timer-tests-debug-timer-check): New test.
      768b24eb
  2. 26 Jul, 2014 2 commits
    • Paul Eggert's avatar
      Revert previous change. · 9e9f8582
      Paul Eggert authored
      There is certainly nothing wrong with writing code like 'lo <= i
      && i <= hi', even if LO happens to a constant.  There isn't even
      anything wrong in general with writing 'a <= b' if A happens to
      be a constant.  At any rate stylistic changes shouldn't
      be done like this without discussion.
      9e9f8582
    • Andreas Schwab's avatar
      Reorder conditions that are written backwards · 3acf58ee
      Andreas Schwab authored
      * alloc.c (xnmalloc, xnrealloc, xpalloc, make_save_value)
      (Fgarbage_collect): Reorder conditions that are written backwards.
      * data.c (cons_to_unsigned): Likewise.
      * dispnew.c (update_frame_1, sit_for): Likewise.
      * fileio.c (file_offset): Likewise.
      * filelock.c (read_lock_data, lock_file): Likewise.
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      Likewise.
      * font.c (font_intern_prop, font_style_symbolic): Likewise.
      * lisp.h (FIXNUM_OVERFLOW_P): Likewise.
      * lread.c (read1): Likewise.
      * minibuf.c (read_minibuf_noninteractive): Likewise.
      * nsterm.m (x_set_frame_alpha): Likewise.
      * process.c (wait_reading_process_output): Likewise.
      * region-cache.c (delete_cache_boundaries): Likewise.
      * xterm.c (x_set_frame_alpha): Likewise.
      3acf58ee
  3. 08 Jul, 2014 2 commits
  4. 24 Jun, 2014 1 commit
    • Paul Eggert's avatar
      Be more consistent about the 'Qfoo' naming convention. · 40f5d4b7
      Paul Eggert authored
      * image.c (Fimagemagick_types):
      * lisp.h (lisp_h_CHECK_TYPE, CHECK_TYPE, CHECK_ARRAY):
      * process.c (Fmake_network_process):
      Rename C local identifier 'Qfoo to avoid giving the false
      impression that it stands for the symbol 'foo'.
      40f5d4b7
  5. 13 Jun, 2014 1 commit
    • Paul Eggert's avatar
      Avoid hangs in accept-process-output. · 05d28210
      Paul Eggert authored
      * lisp.h, process.c (wait_reading_process_input):
      Return int, not bool.  All uses changed.
      * process.c (SELECT_CANT_DO_WRITE_MASK):
      Remove macro, replacing with ...
      (SELECT_CAN_DO_WRITE_MASK): ... new constant, with inverted sense.
      All uses changed.
      (status_notify): New arg WAIT_PROC.  Return int, not void.
      All uses changed.
      
      Fixes: debbugs:17647
      05d28210
  6. 09 Jun, 2014 1 commit
  7. 08 Jun, 2014 1 commit
    • Paul Eggert's avatar
      If a C name must be extern on some platforms, make it extern on all. · ff2d0e83
      Paul Eggert authored
      * dispextern.h (set_vertical_scroll_bar, erase_phys_cursor)
      (load_color):
      * font.h (ftxfont_driver) [HAVE_XFT]:
      * keyboard.h (menu_items_inuse, ignore_mouse_drag_p, make_ctrl_char):
      * lisp.h (get_frame_param):
      * menu.h (tty_menu_show):
      * process.h (conv_sockaddr_to_lisp, catch_child_signal):
      * termhooks.h (encode_terminal_code):
      * xterm.h (x_menu_wait_for_event):
      Always declare.
      * frame.c (get_frame_param):
      * fringe.c (max_used_fringe_bitmap):
      * ftxfont.c (ftxfont_driver):
      * keyboard.c (ignore_mouse_drag_p, make_ctrl_char):
      * menu.c (menu_items_inuse):
      * process.c (conv_sockaddr_to_lisp, catch_child_signal):
      * term.c (encode_terminal_code, tty_menu_show):
      * xdisp.c (set_vertical_scroll_bar, erase_phys_cursor):
      * xfaces.c (load_color):
      * xmenu.c (x_menu_wait_for_event):
      Now always extern.
      ff2d0e83
  8. 05 Jun, 2014 1 commit
  9. 03 Jun, 2014 2 commits
  10. 27 May, 2014 1 commit
    • Paul Eggert's avatar
      Don't kill already-reaped process. · ca0279be
      Paul Eggert authored
      * process.c (process_send_signal): Fix race condition where a
      subprocess was reaped by a signal handler between the check for
      liveness and calling 'kill', which meant that Emacs could in
      theory kill an innocent bystander process.  Do the fix by blocking
      SIGCHLD in a critical section that checks liveness before killing.
      
      Fixes: debbugs:17561
      ca0279be
  11. 03 May, 2014 1 commit
    • Paul Eggert's avatar
      Handle systems without WCONTINUED consistently. · d355cad6
      Paul Eggert authored
      * lib-src/emacsclient.c (WCONTINUED): Move to ../src/syswait.h.
      * src/process.c (handle_child_signal): Remove WCONTINUED ifdef,
      because WCONTINUED is always defined now.
      * src/syswait.h (WCONTINUED): Move here from ../lib-src/emacsclient.c.
      
      Fixes: debbugs:15110 debbugs:17339
      d355cad6
  12. 29 Apr, 2014 1 commit
  13. 16 Apr, 2014 1 commit
    • Eli Zaretskii's avatar
      Fix the MSDOS build. · bf6b4923
      Eli Zaretskii authored
       src/unexcoff.c [MSDOS]: Include libc/atexit.h.
       (copy_text_and_data): Zero out the atexit chain pointer before
       dumping Emacs.
       src/termhooks.h (encode_terminal_code): Update prototype.
       src/term.c (encode_terminal_code) [DOS_NT]: Make it externally
       visible for all DOS_NT ports, not just WINDOWSNT.
       (syms_of_term) [!MSDOS]: Don't define 'tty-menu-*' symbols on MSDOS.
       src/sysdep.c (emacs_sigaction_init, init_signals): Don't use SIGCHLD
       unless it is defined.
       (emacs_pipe) [MSDOS]: Redirect to 'pipe'.
       src/process.c (close_on_exec, accept4, process_socket): Move into
       the "ifdef subprocesses" part.
       (catch_child_signal): Condition by "ifdef subprocesses".
       (syms_of_process) <Qinternal_default_process_sentinel>
       <Qinternal_default_process_filter>: Condition by "ifdef subprocesses".
       src/msdos.h: Add prototypes for new functions.
       (EINPROGRESS): Define.
       (O_CLOEXEC): Define to zero.
       src/msdos.c (check_window_system): Remove unnecessary an
       incompatible duplicate function.
       (sys_opendir, readlinkat, faccessat, fstatat, unsetenv): New
       functions in support of new functionality.
       src/menu.c (single_menu_item): Add visual indication  of submenu
       also for menus on MSDOS frames.
       (Fx_popup_menu) [!MSDOS]: Do not call tty_menu_show on MSDOS.
       src/lisp.h (CHECK_PROCESS) [!subprocesses]: Do not define
       when async subprocesses aren't supported.
       src/font.h (FONT_WIDTH) [MSDOS]: MSDOS-specific definition.
       src/emacs.c (close_output_streams): Zero out errno before calling
       close_stream.
       src/dired.c [MSDOS]: Include msdos.h.
       src/conf_post.h (opendir) [MSDOS]: Redirect to sys_opendir.
       (DATA_START) [MSDOS]: Define.
       (SYSTEM_PURESIZE_EXTRA) [MSDOS]: Enlarge by 25K.
       src/callproc.c (block_child_signal, unblock_child_signal) [MSDOS]:
       Ifdef away for MSDOS.
       (record_kill_process) [MSDOS]: Ifdef away the entire body for MSDOS.
       (call_process_cleanup) [MSDOS]: Ifdef away portions not relevant
       for MSDOS.
       (call_process) [MSDOS]: Fix call sequence of dostounix_filename.
       Use temporary file template that is compatible with mkostemp.
       Move vfork-related portions under #ifndef MSDOS.
       (syms_of_callproc): Unify templates of MSDOS and WINDOWSNT.
      
       lisp/term/pc-win.el (x-list-fonts, x-get-selection-value): Provide
       doc strings, as required by snarf-documentation.
      
       msdos/sedlisp.inp:
       msdos/sedlibmk.inp:
       msdos/sedleim.inp:
       msdos/sed3v2.inp:
       msdos/sed2v2.inp:
       msdos/sed1v2.inp: Update Sed scripts for Emacs 24.4.
       msdos/inttypes.h: Add PRIdMAX.
       msdos/INSTALL: Update for Emacs 24.4.
       msdos/sedadmin.inp: New file.
      bf6b4923
  14. 05 Apr, 2014 1 commit
    • Paul Eggert's avatar
      Prefer 'ARRAYELTS (x)' to 'sizeof x / sizeof *x'. · faa52174
      Paul Eggert authored
      * alloc.c (memory_full):
      * charset.c (syms_of_charset):
      * doc.c (Fsnarf_documentation):
      * emacs.c (main):
      * font.c (BUILD_STYLE_TABLE):
      * keyboard.c (make_lispy_event):
      * profiler.c (setup_cpu_timer):
      * xgselect.c (xg_select):
      * xterm.c (record_event, STORE_KEYSYM_FOR_DEBUG):
      Use ARRAYELTS.
      * font.c (FONT_PROPERTY_TABLE_SIZE): Remove.
      Replace the only use with ARRAYELTS (font_property_table).
      * xfaces.c (DIM): Remove.  All uses replaced by ARRAYELTS.
      faa52174
  15. 25 Mar, 2014 1 commit
    • Paul Eggert's avatar
      Handle sigmask better with nested signal handlers. · 1e952f0a
      Paul Eggert authored
      * atimer.c (sigmask_atimers): Remove.
      Remaining use rewritten to use body of this function.
      * atimer.c (block_atimers, unblock_atimers):
      * callproc.c (block_child_signal, unblock_child_signal):
      * sysdep.c (block_tty_out_signal, unblock_tty_out_signal):
      New arg OLDSET.  All callers changed.
      * atimer.c (block_atimers, unblock_atimers):
      * callproc.c (block_child_signal, unblock_child_signal):
      * keyboard.c (handle_interrupt):
      * sound.c (vox_configure, vox_close):
      Restore the old signal mask rather than unilaterally clearing bits
      from the mask, in case a handler is running within another
      handler.  All callers changed.
      * lisp.h, process.c, process.h, term.c:
      Adjust decls and callers to match new API.
      * sysdep.c (emacs_sigaction_init): Don't worry about masking SIGFPE;
      signal handlers aren't supposed to use floating point anyway.
      (handle_arith_signal): Unblock just SIGFPE rather than clearing mask.
      
      Fixes: debbugs:15561
      1e952f0a
  16. 23 Mar, 2014 3 commits
  17. 22 Mar, 2014 1 commit
  18. 22 Feb, 2014 1 commit
  19. 21 Feb, 2014 1 commit
    • Glenn Morris's avatar
      Some doc updates for default process sentinels and filters not being nil · 458e643b
      Glenn Morris authored
      * doc/lispref/internals.texi (Process Internals):
      * doc/lispref/processes.texi (Deleting Processes, Output from Processes)
      (Process Buffers, Filter Functions, Accepting Output, Sentinels)
      (Network, Network Servers, Network Processes, Serial Ports):
      Filters and sentinels can no longer be nil.
      
      * doc/lispref/elisp.texi (Top): Menu update.
      
      * doc/misc/flymake.texi (Starting the syntax check process): Grammar fix.
      
      * doc/misc/tramp.texi (External packages): Grammar fix.
      Reword for default sentinel not being nil any more.
      
      * src/process.c (Fprocess_buffer, Faccept_process_output)
      (Finternal_default_process_filter, Finternal_default_process_sentinel):
      Doc fixes.
      458e643b
  20. 30 Jan, 2014 1 commit
  21. 20 Jan, 2014 1 commit
  22. 01 Jan, 2014 1 commit
  23. 18 Dec, 2013 2 commits
    • Paul Eggert's avatar
      Minor fixes for recent openp changes. · 518c40a2
      Paul Eggert authored
      * lisp.h (GCPRO7): New macro.
      * lread.c (openp): Use bool for boolean; all callers changed.
      Protect save_string from GC.  Don't assume that file descriptors
      are nonzero.  Redo save_mtime comparison to avoid bogus GCC
      warning about uninitialized variable.
      518c40a2
    • Glenn Morris's avatar
      Add load-prefer-newer option, to load .el if newer than .elc · 1f41ee56
      Glenn Morris authored
      * src/lread.c (Fload): Pass load_prefer_newer to openp.
      Don't bother checking mtime if openp already did it.
      (openp): Add `newer' argument, to check all suffixes
      and find the newest file.
      (syms_of_lread) <load_prefer_newer>: New option. 
      
      * src/callproc.c (call_process):
      * src/charset.c (load_charset_map_from_file):
      * src/emacs.c (init_cmdargs):
      * src/image.c (x_create_bitmap_from_file, x_find_image_file):
      * src/lisp.h (openp):
      * lread.c (Flocate_file_internal):
      * src/process.c (Fformat_network_address):
      * src/sound.c (Fplay_sound_internal):
      * src/w32.c (check_windows_init_file):
      * src/w32proc.c (sys_spawnve): Update for new arg spec of openp.
      
      * lisp/Makefile.in (BYTE_COMPILE_FLAGS): Set load-prefer-newer to t.
      
      * etc/NEWS: Mention this.
      
      Fixes: debbugs:2061
      1f41ee56
  24. 15 Dec, 2013 1 commit
  25. 23 Nov, 2013 1 commit
  26. 18 Nov, 2013 1 commit
  27. 06 Nov, 2013 1 commit
  28. 05 Nov, 2013 2 commits
    • Paul Eggert's avatar
      Fix recent gnutls changes. · 69369809
      Paul Eggert authored
      * gnutls.c (Fgnutls_boot): Don't assume C99.
      * process.c (wait_reading_process_output): Fix typo in recent change.
      69369809
    • Ted Zlatanov's avatar
      Several GnuTLS fixes for log level and initialization. · 194b4d9f
      Ted Zlatanov authored
      * gnutls.c (emacs_gnutls_handle_error): Adjust log level for EAGAIN.
      (Fgnutls_boot): Set process gnutls_p later, after initialization.
      
      * process.c (wait_reading_process_output, read_process_output)
      (send_process): Check gnutls_state is not NULL.
      194b4d9f
  29. 04 Nov, 2013 1 commit
    • Paul Eggert's avatar
      Port to stricter C99 platforms. · 91f2d272
      Paul Eggert authored
      Especially, C99 prohibits nesting a struct X inside struct Y if
      struct X has a flexible array member.
      Also, merge from gnulib, incorporating:
      2013-11-03 intprops: port to Oracle Studio c99
      * lib/intprops.h: Update from gnulib.
      * src/alloc.c (struct sdata): New type.
      (sdata): Implement in terms of struct sdata.
      Remove u member; all uses replaced by next_vector, set_next_vector.
      (SDATA_SELECTOR, SDATA_DATA, SDATA_DATA_OFFSET): Adjust to sdata change.
      (SDATA_DATA_OFFSET): Now a constant, not a macro.
      (struct sblock): Rename first_data member to data, which is now
      a flexible array member.  All uses changed.
      (next_vector, set_next_vector, large_vector_vec): New functions.
      (vector_alignment): New constant.
      (roundup_size): Make it a multiple of ALIGNOF_STRUCT_LISP_VECTOR, too.
      (struct large-vector): Now merely a NEXT member, since the old approach
      ran afoul of stricter C99.  All uses changed to use
      large_vector_vec or large_vector_offset.
      (large_vector_offset): New constant.
      * src/dispnew.c: Include tparam.h, for tgetent.
      Do not include term.h; no longer needed.
      * src/gnutls.c (Fgnutls_boot): Don't continue after calling a _Noreturn.
      * src/lisp.h (ENUM_BF) [__SUNPRO_C && __STDC__]: Use unsigned int.
      (struct Lisp_Vector): Use a flexible array member for contents,
      instead of a union with a member that is an array of size 1.
      All uses changed.
      (ALIGNOF_STRUCT_LISP_VECTOR): New constant, to make up for the
      fact that the struct no longer contains a union.
      (struct Lisp_Misc_Any, struct Lisp_Marker, struct Lisp_Overlay)
      (struct Lisp_Save_Value, struct Lisp_Free):
      Use unsigned, not int, for spacers, to avoid c99 warning.
      (union specbinding): Use unsigned, not bool, for bitfield, as
      bool is not portable to pre-C99 hosts.
      91f2d272
  30. 17 Oct, 2013 1 commit
    • Paul Eggert's avatar
      Make some functions static in non-Microsoft builds. · 3d798ba7
      Paul Eggert authored
      On my platform (Fedora 19 x86-64), this shrinks the
      Emacs executable (text+data) by 0.25%.
      * dispextern.h (erase_phys_cursor) [!WINDOWSNT]:
      (load_color) [!MSDOS]:
      * gnutls.h (emacs_gnutls_transport_set_errno) [!WINDOWSNT]:
      * keyboard.h (make_ctrl_char) [!WINDOWSNT]:
      * lisp.h (check_existing):
      * process.h (conv_sockaddr_to_lisp, network_interface_list)
      (network_interface_info) [!WINDOWSNT]:
      * termhooks.h (encode_terminal_code) [!WINDOWSNT]:
      Remove extern decls.
      * fileio.c (check_existing):
      * keyboard.c (make_ctrl_char) [!WINDOWSNT]:
      * process.c (conv_sockaddr_to_lisp, network_interface_list)
      (network_interface_info) [!WINDOWSNT]:
      * term.c (encode_terminal_code) [!WINDOWSNT]:
      * xdisp.c (erase_phys_cursor) [!WINDOWSNT]:
      * xfaces.c (load_color) [!MSDOS]:
      Now static.
      * fileio.c (check_existing, check_executable, check_writable):
      * process.c (network_interface_list, network_interface_info):
      Move earlier, so that we don't need forward decls.
      * gnutls.c (fn_gnutls_transport_set_errno)
      (emacs_gnutls_transport_set_errno) [!WINDOWNT]:
      Remove; unused.
      * w32.c (init_environment): Use faccessat rather than
      check_existing, partly for consistency with the rest of the code
      in this file, partly so that check_existing can be static.
      3d798ba7
  31. 16 Oct, 2013 1 commit
    • Eli Zaretskii's avatar
      Implement network-interface-* functions for MS-Windows (bug #15610). · 3dffe395
      Eli Zaretskii authored
       src/w32.c (network_interface_get_info, network_interface_list)
       (network_interface_info): New functions.
       (GetAdaptersInfo_Proc): New typedef.
       (get_adapters_info): New wrapper function.
       (globals_of_w32): Initialize g_b_init_get_adapters_info.
       src/process.h (network_interface_list, network_interface_info): New
       prototypes.
       src/process.c (conv_sockaddr_to_lisp): Now externally-visible.
       (Fnetwork_interface_list, Fnetwork_interface_info): Define for
       all systems.  Return non-nil for systems that HAVE_NET_IF_H and
       for WINDOWSNT.  Doc fix.
       (syms_of_process): Defsubr Snetwork_interface_list and
       Snetwork_interface_info unconditionally.
      3dffe395
  32. 24 Sep, 2013 2 commits
    • Daniel Colascione's avatar
      Fix build break due to vector changes · 10ebac9d
      Daniel Colascione authored
      10ebac9d
    • Dmitry Antipov's avatar
      Use union for the payload of struct Lisp_Vector. · d6d9cbc1
      Dmitry Antipov authored
      This helps to avoid a few glitches dictated by C's aliasing rules.
      * lisp.h (struct Lisp_Vector): Use union for next and
      contents member.  Adjust comment.  Change related users.
      * alloc.c (next_in_free_list, set_next_in_free_list): Remove.
      Related users changed.
      * buffer.c, bytecode.c, ccl.c, character.h, chartab.c, composite.c:
      * composite.h, disptab.h, fns.c, fontset.c, indent.c, keyboard.c:
      * lread.c, msdos.c, process.c, w32menu.c, window.c, xdisp.c:
      * xfaces.c, xfont.c, xmenu.c: Related users changed.
      d6d9cbc1