1. 28 Aug, 2014 2 commits
    • Ken Brown's avatar
      Add support for HYBRID_MALLOC, allowing the use of gmalloc before · ea652500
      Ken Brown authored
      dumping and the system malloc after dumping.  (Bug#18222)
      
      * configure.ac (HYBRID_MALLOC): New macro; define to use gmalloc
      before dumping and the system malloc after dumping.  Define on Cygwin.
      * src/conf_post.h (malloc, realloc, calloc, free) [HYBRID_MALLOC]:
      Define as macros, expanding to hybrid_malloc, etc.
      (HYBRID_GET_CURRENT_DIR_NAME): New macro.
      (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Define as
      macro.
      * src/gmalloc.c: Set up the infrastructure for HYBRID_MALLOC, with a
      full implementation on Cygwin.  Remove Cygwin-specific code that
      is no longer needed.
      (malloc, realloc, calloc, free, aligned_alloc) [HYBRID_MALLOC]:
      Redefine as macros expanding to gmalloc, grealloc, etc.
      (DUMPED, ALLOCATED_BEFORE_DUMPING) [CYGWIN]: New macros.
      (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Undefine.
      (USE_PTHREAD, posix_memalign) [HYBRID_MALLOC]: Don't define.
      (hybrid_malloc, hybrid_calloc, hybrid_free, hybrid_realloc)
      [HYBRID_MALLOC]:
      (hybrid_get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]:
      (hybrid_aligned_alloc) [HYBRID_MALLOC && (HAVE_ALIGNED_ALLOC ||
      HAVE_POSIX_MEMALIGN)]: New functions.
      * src/alloc.c (aligned_alloc) [HYBRID_MALLOC && (ALIGNED_ALLOC ||
      HAVE_POSIX_MEMALIGN)]: Define as macro expanding to
      hybrid_aligned_alloc; declare.
      (USE_ALIGNED_ALLOC) [HYBRID_MALLOC && (ALIGNED_ALLOC ||
      HAVE_POSIX_MEMALIGN)]: Define.
      (refill_memory_reserve) [HYBRID_MALLOC]: Do nothing.
      * src/sysdep.c (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]:
      Define as macro, expanding to gget_current_dir_name, and define
      the latter.
      * src/emacs.c (main) [HYBRID_MALLOC]: Don't call memory_warnings() or
      malloc_enable_thread().  Don't initialize malloc.
      * src/lisp.h (NONPOINTER_BITS) [CYGWIN]: Define (because GNU_MALLOC is
      no longer defined on Cygwin).
      (refill_memory_reserve) [HYBRID_MALLOC]: Don't declare.
      * src/sheap.c (bss_sbrk_buffer_end): New variable.
      * src/unexcw.c (__malloc_initialized): Remove variable.
      * src/ralloc.c: Throughout, treat HYBRID_MALLOC the same as
      SYSTEM_MALLOC.
      * src/xdisp.c (decode_mode_spec) [HYBRID_MALLOC]: Don't check
      	Vmemory_full.
      ea652500
    • Paul Eggert's avatar
      * sysdep.c (LC_COLLATE, LC_COLLATE_MASK): Give individual defaults. · cbe070d1
      Paul Eggert authored
      Fixes: debbugs:18051
      cbe070d1
  2. 27 Aug, 2014 3 commits
    • Paul Eggert's avatar
      Improve robustness of new string-collation code. · 110d87a1
      Paul Eggert authored
      * configure.ac (newlocale): Check for this, not for uselocale.
      * src/sysdep.c (LC_COLLATE, LC_COLLATE_MASK, freelocale, locale_t)
      (newlocale, wcscoll_l): Define substitutes for platforms that
      lack them, so as to simplify the mainline code.
      (str_collate): Simplify the code by assuming the above definitions.
      Use wcscoll_l, not uselocale, as uselocale is too fragile.  For
      example, the old version left the Emacs in the wrong locale if
      wcscoll reported an error.  Use 'int', not ptrdiff_t, for the int
      result.  Report an error if newlocale fails.
      
      Fixes: debbugs:18051
      110d87a1
    • Michael Albinus's avatar
      * lisp.h (str_collate): · 17d94f1b
      Michael Albinus authored
      * sysdep.c (str_collate): Return int.
      (str_collate) [__STDC_ISO_10646__]: Propagate error of wcscoll.
      17d94f1b
    • Dmitry Antipov's avatar
      Fix some glitches in previous change. · 7fb78a08
      Dmitry Antipov authored
      * sysdep.c (stack_direction): Replace stack_grows_down
      to simplify calculation of stack boundaries.
      (handle_sigsegv): Check whether we really crash somewhere near
      to stack boundary, and handle fatal signal as usual if not.
      (init_sigsegv): Adjust accordingly.
      7fb78a08
  3. 26 Aug, 2014 2 commits
    • Dmitry Antipov's avatar
    • Dmitry Antipov's avatar
      Handle C stack overflow caused by too nested Lisp evaluation. · ebd31792
      Dmitry Antipov authored
      * configure.ac: Check for sigaltstack and related sigaction
      support.  Unconditionally check for sigsetjmp and siglongjmp.
      (HAVE_STACK_OVERFLOW_HANDLING): Define if we can support it.
      * src/lisp.h (toplevel) [HAVE_STACK_OVERFLOW_HANDLING]: Declare
      siglongjmp point to transfer control from SIGSEGV handler.
      * src/keyboard.c (return_to_command_loop, recover_top_level_message)
      [HAVE_STACK_OVERFLOW_HANDLING]: New variables.
      (regular_top_level_message): New variable.
      (command_loop) [HAVE_STACK_OVERFLOW_HANDLING]: Handle non-local
      exit from SIGSEGV handler and adjust message displayed by Vtop_level
      if appropriate.
      (syms_of_keyboard): DEFVAR Vtop_level_message and initialize
      new variables described above.
      * src/sysdep.c [HAVE_SYS_RESOURCE_H]: Include sys/resource.h as such.
      (stack_grows_down, sigsegv_stack, handle_sigsegv)
      [HAVE_STACK_OVERFLOW_HANDLING]: New variables and function.
      (init_sigsegv): New function.
      (init_signals): Use it.
      * lisp/startup.el (normal-top-level): Use top-level-message.
      ebd31792
  4. 25 Aug, 2014 2 commits
    • Eli Zaretskii's avatar
      Implement locale-sensitive string collation for MS-Windows. (Bug#18051) · 015ea0ff
      Eli Zaretskii authored
       src/w32proc.c (get_lcid_callback, get_lcid, w32_compare_strings):
       New functions.
       src/w32.h (w32_compare_strings): Add prototype.
       src/w32.c <g_b_init_compare_string_w>: New global flag.
       (globals_of_w32): Initialize it.
       src/sysdep.c (str_collate) [WINDOWSNT]: Implementation for MS-Windows.
       src/fns.c (Fstring_collate_lessp, Fstring_collate_equalp)
       [WINDOWSNT]: Call str_collate on MS-Windows.
      
       etc/NEWS: Mention that string-collate-* functions are supported on
       MS-Windows as well.
      015ea0ff
    • Paul Eggert's avatar
      Minor cleanups of str_collate fix. · 90c5c877
      Paul Eggert authored
      * fns.c (str_collate): Move decl from here ...
      * lisp.h (str_collate): ... to here.
      * sysdep.c (str_collate): Prune away some of the forest of ifdefs.
      Remove unnecessary casts.  Use SAFE_NALLOCA to avoid
      potential problems with integer overflow.  Don't assume
      setlocale succeeds.  Remove unnecessary test before restoring
      locale via setlocale, and free the copied setlocale string
      when done with it.
      
      Fixes: debbugs:18051
      90c5c877
  5. 24 Aug, 2014 1 commit
    • Michael Albinus's avatar
      Add string collation. · 07b47905
      Michael Albinus authored
      * configure.ac: Check also for the uselocale function. 
      
      * src/fns.c (Fstring_collate_lessp, Fstring_collate_equalp): New DEFUNs.
      
      * src/sysdep.c (str_collate): New function.  (Bug#18051)
      07b47905
  6. 14 Jul, 2014 1 commit
    • Paul Eggert's avatar
      Use binary-io module, O_BINARY, and "b" flag. · ba1ed52f
      Paul Eggert authored
      * admin/merge-gnulib (GNULIB_MODULES): Add binary-io.  It was already
      present implicitly; this just makes the dependence explicit.
      * lib-src/etags.c, lib-src/hexl.c, lib-src/make-docfile.c:
      Include binary-io.h instead of fcntl.h and/or io.h.
      (main): Use set_binary_mode or SET_BINARY
      in place of handcrafted code.
      * lib-src/etags.c (main) [DOS_NT]:
      * lib-src/movemail.c (main) [WINDOWSNT]:
      Don't mess with _fmode.
      * lib-src/etags.c (main, process_file_name, analyse_regex):
      Use fopen/popen's "b" flag instead.
      * lib-src/movemail.c (main, popmail): Use open/lk_open/mkostemp's O_BINARY
      instead.
      * src/callproc.c (create_temp_file): Use mkostemp's O_BINARY flag.
      * src/emacs.c [MSDOS]:
      * src/emacs.c (main) [DOS_NT]: Don't mess with _fmode.
      (main) [MSDOS]: Use SET_BINARY instead of setmode.
      * src/minibuf.c: Include binary-io.h instead of fcntl.h.
      (read_minibuf_noninteractive):
      Use set_binary_mode instead of handcrafted code.
      Don't call emacs_set_tty if emacs_get_tty failed.
      * src/sysdep.c, src/systty.h (emacs_get_tty): Return int, not void.
      * src/sysdep.c (emacs_open, emacs_pipe): Use O_BINARY.
      * src/w32.c (pipe2): Adjust eassert to include O_BINARY.
      
      Fixes: debbugs:18006
      ba1ed52f
  7. 11 Jul, 2014 4 commits
    • Paul Eggert's avatar
      Coalesce extern decls. · 6a89fc81
      Paul Eggert authored
      * minibuf.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty):
      * sysdep.c (emacs_get_tty, emacs_set_tty):
      Move duplicate extern decls from here ...
      * systty.h: ... to here, so that there's just one copy.
      6a89fc81
    • Eli Zaretskii's avatar
      Implement echo suppression in non-interactive mode for MS-Windows. · e8963bd7
      Eli Zaretskii authored
       src/minibuf.c (read_minibuf_noninteractive): Finish reading on '\r',
       not only on '\n'.
       src/sysdep.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty)
       [DOS_NT]: Implement for WINDOWSNT.
       src/systty.h (struct emacs_tty) [DOS_NT]: The struct member is now
       unsigned.
      
      Fixes: debbugs:17839
      e8963bd7
    • Michael Albinus's avatar
      * sysdep.c (suppress_echo_on_tty): New function. · fb96e203
      Michael Albinus authored
      * minibuf.c (read_minibuf_noninteractive): Use it.
      fb96e203
    • Michael Albinus's avatar
      Hide password in batch mode · c0ada759
      Michael Albinus authored
      * doc/lispref/minibuf.texi (Intro to Minibuffers, Reading a Password):
      Password hiding is available in batch mode, do not mention it in
      the exclusion list.  Mention `read-hide-char'. 
      
      * lisp/subr.el (read-passwd): Use `read-hide-char' if non-nil.  Bind it
      when calling `read-string'.
      
      * src/minibuf.c (top): Include systty.h.  Declare external
      emacs_get_tty and emacs_set_tty.
      (Vread_hide_char): New lisp variable.
      (read_minibuf_noninteractive): Hide characters with
      Vread_hide_char if it is a character.
      
      * src/sysdep.c (emacs_get_tty, emacs_set_tty): Make them externally visible.
      
      Fixes: debbugs:17839
      c0ada759
  8. 09 Jun, 2014 1 commit
  9. 04 Jun, 2014 1 commit
  10. 01 Jun, 2014 1 commit
    • Paul Eggert's avatar
      Port signal-handling to DragonFly BSD. · 5c2b9423
      Paul Eggert authored
      * callproc.c, sysdep.c (block_child_signal, unblock_child_signal):
      Move implementations from callproc.c to sysdep.c.
      * process.h, syssignal.h (block_child_signal, unblock_child_signal):
      Move declaratations from process.h to syssignal.h.
      
      Fixes: debbugs:17646
      5c2b9423
  11. 30 May, 2014 1 commit
    • Paul Eggert's avatar
      Don't let SIGINT handling block SIGCHLD indefinitely. · 8cf1e6e6
      Paul Eggert authored
      * atimer.c (block_atimers):
      * callproc.c (block_child_signal): Block SIGINT too;
      otherwise, its handler might now unblock signals that it shouldn't.
      * keyboard.c (read_char): Clear signal mask, since we may
      be in a SIGINT handler, and many signals may be masked.
      * keyboard.c (handle_interrupt):
      * sysdep.c (handle_arith_signal):
      Clear signal mask instead of just unblocking the signal that
      was received, since several signals may be blocked at this point.
      
      Fixes: debbugs:17561
      8cf1e6e6
  12. 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
  13. 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
  14. 03 Apr, 2014 2 commits
  15. 26 Mar, 2014 1 commit
    • Juanma Barranquero's avatar
      src/*.c: Silence a few warnings about unused vars and functions. · 5af73b0f
      Juanma Barranquero authored
      * src/image.c (x_bitmap_height, x_bitmap_width) [HAVE_X_WINDOWS]:
      * src/sysdep.c (reset_sigio) [!DOS_NT]: Declare conditionally.
      
      * src/keyboard.c (read_decoded_event_from_main_queue): #ifdef out
        variables on Windows.
      
      * src/w32.c (unsetenv): Remove unused var `retval'.
        (emacs_gnutls_pull): Remove unused vars `fdset' and `timeout'.
      
      * src/w32fns.c (Ffile_system_info): Use parenthesis in and/or expression.
      
      * src/w32notify.c (watch_worker): Remove unnecesary var sleep_result.
        (start_watching): Remove unused var `thr'.
      
      * src/w32proc.c (sys_spawnve): Comment out unused vars `first', `last'.
        (find_child_console): Remove unnecesary var `thread_id'.
      
      * src/w32term.c (w32_read_socket): Comment out unused vars `row', `columns'.
        (x_focus_frame): #ifdef 0 unused variable `dpyinfo'.
      5af73b0f
  16. 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
  17. 01 Jan, 2014 1 commit
  18. 26 Oct, 2013 1 commit
  19. 07 Oct, 2013 1 commit
    • Paul Eggert's avatar
      emacs_read and emacs_write now use void *, not char *. · 223752d7
      Paul Eggert authored
      * alloc.c (valid_pointer_p) [!WINDOWSNT]: Remove now-unnecessary cast.
      * sysdep.c (emacs_read, emacs_write, emacs_write_sig):
      Buffer arg is now void *, not char *.  This matches plain
      'read' and 'write' better, and avoids a constraint violation
      on Solaris 9 with Oracle Studio.
      223752d7
  20. 20 Sep, 2013 1 commit
    • Paul Eggert's avatar
      A simpler, centralized INLINE. · 00382e8b
      Paul Eggert authored
      * lib-src/profile.c (INLINE): New macro.
      (SYSTIME_INLINE): Remove.
      * src/conf_post.h (INLINE): Define only if not already defined.
      This allows us to use a single INLINE, defined by one file
      per executable.
      * src/emacs.c (INLINE): Define it.
      Also, include category.h, charset.h, composite.h, dispextern.h,
      syntax.h, systime.h, so that their INLINE definitions are expanded
      properly for Emacs.
      * src/blockinput.h, src/keyboard.c (BLOCKINPUT_INLINE):
      * src/buffer.h, src/buffer.c (BUFFER_INLINE):
      * src/category.h, src/category.c (CATEGORY_INLINE):
      * src/character.h, src/character.c (CHARACTER_INLINE):
      * src/charset.h, src/charset.c (CHARSET_INLINE):
      * src/composite.h, src/composite.c (COMPOSITE_INLINE):
      * src/dispextern.h, src/dispnew.c (DISPEXTERN_INLINE):
      * src/frame.h, src/frame.c (FRAME_INLINE):
      * src/intervals.h, src/intervals.c (INTERVALS_INLINE):
      * src/keyboard.h, src/keyboard.c (KEYBOARD_INLINE):
      * src/lisp.h, src/alloc.c (LISP_INLINE):
      * src/process.h, src/process.c (PROCESS_INLINE):
      * src/syntax.h, src/syntax.c (SYNTAX_INLINE):
      * src/systime.h, src/sysdep.c (SYSTIME_INLINE):
      * src/termhooks.h, src/terminal.h (TERMHOOKS_INLINE):
      * src/window.h, src/window.c (WINDOW_INLINE):
      Remove.  All uses replaced with INLINE.
      00382e8b
  21. 27 Aug, 2013 2 commits
    • Paul Eggert's avatar
      Simplify SELECT_TYPE-related code. · d486344e
      Paul Eggert authored
      Like EMACS_TIME, this portability layer is no longer needed, since
      Emacs has been using fd_set as a portability layer for some time.
      * sysselect.h (FD_SETSIZE): Rename from MAXDESC.  All uses changed.
      (SELECT_TYPE): Remove.  All uses changed to fd_set.
      (fd_set) [!FD_SET]: New typedef.
      d486344e
    • Paul Eggert's avatar
      Simplify EMACS_TIME-related code. · 43aac990
      Paul Eggert authored
      This portability layer is no longer needed, since Emacs has been
      using struct timespec as a portability layer for some time.
      Merge from gnulib, incorporating:
      2013-08-27 timespec: new convenience constants and function
      * src/atimer.h, src/buffer.h, src/dispextern.h, src/xgselect.h:
      Include <time.h> rather than "systime.h"; that's all that's needed now.
      * src/dispnew.c: Include <timespec.h> rather than "systime.h";
      that's all that's needed now.
      * src/systime.h (EMACS_TIME): Remove.  All uses changed to struct timespec.
      (EMACS_TIME_RESOLUTION): Remove.  All uses changed to
      TIMESPEC_RESOLUTION.
      (LOG10_EMACS_TIME_RESOLUTION): Remove.  All uses changed to
      LOG10_TIMESPEC_RESOLUTION.
      (EMACS_SECS, emacs_secs_addr): Remove.  All uses changed to tv_sec.
      (EMACS_NSECS): Remove.  All uses changed to tv_nsec.
      (make_emacs_time): Remove.  All used changed to make_timespec.
      (invalid_timespec): Rename from invalid_emacs_time.  All uses changed.
      (current_timespec): Rename from current_emacs_time.  All uses changed.
      (add_emacs_time): Remove.  All uses changed to timespec_add.
      (sub_emacs_time): Remove.  All uses change dot timespec_sub.
      (EMACS_TIME_SIGN): Remove.  All uses changed to timespec_sign.
      (timespec_valid_p): Rename from EMACS_TIME_VALID_P.  All uses changed.
      (EMACS_TIME_FROM_DOUBLE): Remove.  All uses changed to dtotimespec.
      (EMACS_TIME_TO_DOUBLE): Remove.  All uses changed to timespectod.
      (current_timespec): Rename from current_emacs_time.  All uses changed.
      (EMACS_TIME_EQ, EMACS_TIME_LT, EMACS_TIME_LE): Remove.  All uses
      changed to timespec_cmp.
      * src/xgselect.c: Include <timespec.h>, since our .h files don't.
      43aac990
  22. 24 Aug, 2013 1 commit
    • Paul Eggert's avatar
      System-dependent integer overflow fixes. · 9c05bccf
      Paul Eggert authored
      * process.c (Fset_process_window_size): Signal an error if
      the window size is outside the range supported by the lower level.
      * sysdep.c (set_window_size): Return negative on error,
      nonnegative on success, rather than -1, 0, 1 on not in system,
      failure, success.  This is simpler.  Caller changed.
      (serial_configure): Remove unnecessary initialization of local.
      (procfs_get_total_memory) [GNU_LINUX]: Don't assume system memory
      size fits in unsigned long; this isn't true on some 32-bit hosts.
      Avoid buffer overrun if some future version of /proc/meminfo has a
      variable name longer than 20 bytes.
      (system_process_attributes) [__FreeBSD__]:
      Don't assume hw.availpages fits in 'int'.
      9c05bccf
  23. 23 Aug, 2013 1 commit
    • Paul Eggert's avatar
      Don't let very long directory names overrun the stack. · c365c355
      Paul Eggert authored
      Fix some related minor problems involving "//", vfork.
      * callproc.c (encode_current_directory): New function.
      (call_process): Don't append "/"; not needed.
      * fileio.c (file_name_as_directory_slop): New constant.
      (file_name_as_directory): Allow SRC to be longer than SRCLEN;
      this can save the caller having to alloca.
      (Ffile_name_as_directory, Fdirectory_file_name, Fexpand_file_name):
      Use SAFE_ALLOCA, not alloca.
      (directory_file_name, Fexpand_file_name): Leave leading "//"
      alone, since it can be special even on POSIX platforms.
      * callproc.c (call_process):
      * process.c (Fformat_network_address):
      * sysdep.c (sys_subshell):
      Use encode_current_directory rather than rolling our own.
      (create_process): No need to encode directory; caller does that now.
      * process.h (encode_current_directory): New decl.
      * sysdep.c (sys_subshell): Work even if vfork trashes saved_handlers.
      Rework to avoid 'goto xyzzy;'.
      c365c355
  24. 22 Aug, 2013 1 commit
  25. 09 Aug, 2013 1 commit
    • Dmitry Antipov's avatar
      Use xstrdup and build_unibyte_string where applicable. · 309f24d1
      Dmitry Antipov authored
      * alloc.c (xstrdup): Tiny cleanup.  Add eassert.
      * xfns.c (x_window):
      * xrdb.c (x_get_customization_string):
      * xterm.c (xim_initialize):
      * w32fns.c (w32_window): Use xstrdup.
      (w32_display_monitor_attributes_list):
      * emacs.c (init_cmdargs):
      * keyboard.c (PUSH_C_STR):
      * nsfont.m (nsfont_open):
      * sysdep.c (system_process_attributes):
      * w32.c (system_process_attributes):
      * xdisp.c (message1, message1_nolog): Use build_unibyte_string.
      309f24d1
  26. 22 Jul, 2013 1 commit
  27. 19 Jul, 2013 1 commit
    • Paul Eggert's avatar
      * sysdep.c [GNU_LINUX]: Fix fd and memory leaks and similar issues. · ab9980cd
      Paul Eggert authored
      (procfs_ttyname): Don't use uninitialized storage if emacs_fopen
      or fscanf fails.
      (system_process_attributes): Prefer plain char to unsigned char
      when either will do.  Clean up properly if interrupted or if
      memory allocations fail.  Don't assume sscanf succeeds.  Remove
      no-longer-needed workaround to stop GCC from whining.  Read
      command-line once, instead of multiple times.  Check read status a
      bit more carefully.
      ab9980cd
  28. 16 Jul, 2013 2 commits
    • Paul Eggert's avatar
      Be simpler and more consistent about reporting I/O errors. · 4e604a5d
      Paul Eggert authored
      * fileio.c (Fcopy_file, Finsert_file_contents, Fwrite_region):
      Say "Read error" and "Write error", rather than "I/O error", or
      "IO error reading", or "IO error writing", when a read or write
      error occurs.
      * process.c (Fmake_network_process, wait_reading_process_output)
      (send_process, Fprocess_send_eof, wait_reading_process_output):
      Capitalize diagnostics consistently.  Put "failed foo" at the
      start of the diagnostic, so that we don't capitalize the
      function name "foo".  Consistently say "failed" for such
      diagnostics.
      * sysdep.c, w32.c (serial_open): Now accepts Lisp string, not C string.
      All callers changed.  This is so it can use report_file_error.
      * sysdep.c (serial_open, serial_configure): Capitalize I/O
      diagnostics consistently as above.
      4e604a5d
    • Paul Eggert's avatar
      Fix porting bug to older POSIXish platforms. · c7ddc792
      Paul Eggert authored
      * sysdep.c (emacs_pipe): New function, that implements
      pipe2 (fd, O_CLOEXEC) even on hosts that lack O_CLOEXEC.
      This should port better to CentOS 5 and to Mac OS X 10.6.
      All calls to pipe2 changed.
      
      Fixes: debbugs:14862
      c7ddc792
  29. 12 Jul, 2013 1 commit
    • Paul Eggert's avatar
      Minor EBADF fixes. · 7e649856
      Paul Eggert authored
      * process.c (create_process, wait_reading_process_output) [AIX]:
      Remove obsolete SIGHUP-related  code, as Emacs no longer disables
      SIGHUP, so EBADF is no longer acceptable here (it wouldn't work in
      a multithreaded environment anyway).
      * sysdep.c (emacs_close): It's not dangerous to invoke emacs_close (-1).
      7e649856