1. 23 Dec, 2012 1 commit
    • Eli Zaretskii's avatar
      Improve handling of subprocess shutdown on MS-Windows. · 299614f3
      Eli Zaretskii authored
       src/w32proc.c (reader_thread): Do not index fd_info[] with negative
       values.
       (reader_thread): Exit when cp->status becomes STATUS_READ_ERROR
       after WaitForSingleObject returns normally.  This expedites reader
       thread shutdown when delete_child triggers it.
       (reap_subprocess): More accurate commentary for why we call
       delete_child only when cp->fd is negative.
       src/w32.c (sys_close): Do not call delete_child on a subprocess
       whose handle is not yet closed.  Instead, set its file descriptor
       to a negative value, so that reap_subprocess will call
       delete_child on that subprocess when its SIGCHLD arrives.  This
       avoids closing handles used for communications between sys_select
       and reader_thread, which doesn't give sys_select a chance to
       notice that the process exited and invoke the SIGCHLD handler for
       it.
      299614f3
  2. 18 Dec, 2012 1 commit
  3. 17 Dec, 2012 1 commit
    • Eli Zaretskii's avatar
      Support Posix ACL APIs on MS-Windows. · 66447e07
      Eli Zaretskii authored
       src/w32.c: Include sddl.h and sys/acl.h.
       (SDDL_REVISION_1): Define if not already defined.
       (g_b_init_get_security_descriptor_dacl)
       (g_b_init_convert_sd_to_sddl, g_b_init_convert_sddl_to_sd)
       (g_b_init_is_valid_security_descriptor)
       (g_b_init_set_file_security): New static flags.
       (globals_of_w32): Initialize them to zero.
       (SetFileSecurity_Name): New string constant.
       (SetFileSecurity_Proc, GetSecurityDescriptorDacl_Proc)
       (ConvertStringSecurityDescriptorToSecurityDescriptor_Proc)
       (ConvertSecurityDescriptorToStringSecurityDescriptor_Proc)
       (IsValidSecurityDescriptor_Proc): New typedefs.
       (get_file_security, get_security_descriptor_owner)
       (get_security_descriptor_group): Set errno to ENOTSUP.
       (set_file_security, get_security_descriptor_dacl)
       (is_valid_security_descriptor, convert_sd_to_sddl)
       (convert_sddl_to_sd, acl_valid, acl_to_text, acl_from_text)
       (acl_free, acl_get_file, acl_set_file): New functions.
       src/fileio.c (Fcopy_file) [WINDOWSNT]: Support copying ACLs.
      
       nt/inc/sys/acl.h: New file.
       nt/inc/ms-w32.h (ENOTSUP): Define if undefined.
       nt/config.nt (HAVE_POSIX_ACL): Define.
      
       doc/lispref/files.texi (File Attributes, Changing Files): Update to include
       MS-Windows support for ACLs.
      66447e07
  4. 15 Dec, 2012 1 commit
  5. 14 Dec, 2012 2 commits
    • Eli Zaretskii's avatar
      Speed up most calls to 'stat' and 'lstat' on MS-Windows. · 5c207910
      Eli Zaretskii authored
       src/w32.c (stat_worker): If w32_stat_get_owner_group is zero, do not
       try to get accurate owner and group information from NT file
       security APIs.  This is to make most callers of 'stat' and
       'lstat', which don't need that information, much faster.
       src/dired.c (Ffile_attributes) [WINDOWSNT]: Set
       w32_stat_get_owner_group to a non-zero value, to request accurate
       owner and group information from 'lstat'.
      
       nt/inc/sys/stat.h: Declare w32_stat_get_owner_group.
      5c207910
    • Eli Zaretskii's avatar
      Fix bug #12621 with crashes on MS-Windows in LookupAccountSid. · 92340ec7
      Eli Zaretskii authored
       src/w32.c (get_name_and_id): Always pass NULL as the first argument
       of lookup_account_sid.  Avoids crashes with UNC file names that
       refer to DFS domains, not to specific machine names.  (Bug#12621)
       Remove now unused argument FNAME; all callers changed.
       (get_file_owner_and_group): Remove now unused argument FNAME; all
       callers changed.
      92340ec7
  6. 08 Dec, 2012 3 commits
  7. 30 Nov, 2012 1 commit
    • Fabrice Popineau's avatar
      Fix compilation problems with 64-bit MSVC compiler. · c7b36b95
      Fabrice Popineau authored
       src/w32fns.c: Remove prototype of atof.
       (syspage_mask): Declared DWORD_PTR, for compatibility with 64-bit
       builds.
       (file_dialog_callback): Declared UINT_PTR.
       src/w32common.h (syspage_mask): Declare DWORD_PTR, for compatibility
       with 64-bit builds.
       src/w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED)
       (FILE_ANY_ACCESS, CTL_CODE) [_MSC_VER]: Define only if not already
       defined.
      c7b36b95
  8. 23 Nov, 2012 1 commit
    • Paul Eggert's avatar
      Assume POSIX 1003.1-1988 or later for dirent.h. · 95ef7787
      Paul Eggert authored
      * admin/CPP-DEFINES (HAVE_CLOSEDIR, HAVE_DIRENT_H): Remove.
      * admin/notes/copyright: Adjust to src/ndir.h -> nt/inc/dirent.h renaming.
      * configure.ac: Do not check for dirent.h or closdir.
      * nt/inc/dirent.h: Rename from ../src/ndir.h, with these changes:
      (struct dirent): Rename from struct direct.  All uses changed.
      * nt/inc/sys/dir.h: Remove.
      * src/dired.c: Assume HAVE_DIRENT_H.
      (NAMLEN): Remove, replacing with ...
      (dirent_namelen): New function.  All uses changed.  Use the GNU macro
      _D_EXACT_NAMELEN if available, as it's faster than strlen.
      (DIRENTRY): Remove, replacing all uses with 'struct dirent'.
      (DIRENTRY_NONEMPTY): Remove.  All callers now assume it's nonzero.
      * src/makefile.w32-in (DIR_H): Remove.  All uses replaced with
      $(NT_INC)/dirent.h.
      ($(BLD)/w32.$(O)): Do not depend on $(SRC)/ndir.h.
      * src/ndir.h: Rename to ../nt/inc/dirent.h.
      * src/sysdep.h (closedir) [!HAVE_CLOSEDIR]: Remove.
      Do not include <dirent.h>; no longer needed.
      * src/w32.c: Include <dirent.h> rather than "ndir.h".
      
      Fixes: debbugs:12958
      95ef7787
  9. 22 Nov, 2012 1 commit
  10. 21 Nov, 2012 1 commit
    • Paul Eggert's avatar
      Assume POSIX 1003.1-1988 or later for unistd.h. · 9239d970
      Paul Eggert authored
      * admin/CPP-DEFINES (BROKEN_GETWD, HAVE_GETCWD, HAVE_GETWD, HAVE_SIZE_T)
      (HAVE_UNISTD_H): Remove.
      * configure.ac: Do not check for getcwd or getwd.
      * lib-src/emacsclient.c (getcwd): Remove decl.
      (get_current_dir_name): Assume getcwd exists.
      * lib-src/etags.c (HAVE_GETCWD): Remove.
      (getcwd): Remove decl.
      (NO_LONG_OPTIONS): Remove this.  All uses removed.
      Emacs always has GNU getopt.
      (etags_getcwd): Assume getcwd exists.
      * lib-src/movemail.c (F_OK, X_OK, W_OK, R_OK): Remove.
      * nt/config.nt (HAVE_GETCWD): Remove.
      * src/alloc.c: Assume unistd.h exists.
      * src/fileio.c (Fexpand_file_name) [DOS_NT]: Use getcwd, not getwd.
      * src/sysdep.c (get_current_dir_name): Assume getcwd exists.
      (getwd) [USG]: Remove; no longer needed.
      (sys_subshell) [DOS_NT]: Use getcwd, not getwd.
      * src/w32.c (getcwd): Rename from getwd, and switch to getcwd's API.
      * src/w32.h (getcwd): Remove decl.
      
      Fixes: debbugs:12945
      9239d970
  11. 19 Nov, 2012 1 commit
    • Eli Zaretskii's avatar
      More fixes for bug #12878 with MS-Windows MSVC build. · 88c4a13c
      Eli Zaretskii authored
       src/xdisp.c (start_hourglass) [HAVE_NTGUI]: Don't mix declaration of
       w32_note_current_window with code.  (Backport from trunk.)
       src/w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED)
       (FILE_ANY_ACCESS, CTL_CODE, FSCTL_GET_REPARSE_POINT) [_MSC_VER]:
       Define for the MSVC compiler.
       src/w32term.h (EnumSystemLocalesW) [_MSC_VER]: Add a missing
       semi-colon.
      
       nt/inc/stdint.h (PTRDIFF_MIN) [!__GNUC__]: Define for MSVC.
      88c4a13c
  12. 17 Nov, 2012 2 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
    • Eli Zaretskii's avatar
      Fix MS-Windows emulation of 'faccessat' wrt directories. · 6ad30855
      Eli Zaretskii authored
       src/w32.c (faccessat): Pretend that directories have the execute bit
       set.  Emacs expects that, e.g., in files.el:cd-absolute.
      6ad30855
  13. 14 Nov, 2012 2 commits
    • Eli Zaretskii's avatar
      MS-Windows followup for 2012-11-14T04:55:41Z!eggert@cs.ucla.edu, regarding faccessat. · 14f20728
      Eli Zaretskii authored
       nt/inc/unistd.h (faccessat): Add prototype.
       (AT_FDCWD, AT_EACCESS, AT_SYMLINK_NOFOLLOW): New macros; the first
       2 moved from ms-w32.h.
       nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS, faccessat): Remove macros.
      
       src/w32.c (faccessat): Rename from sys_faccessat.  (No need to use a
       different name, as the MS runtime does not have such a function,
       and probably never will.)  All callers changed.  Ignore DIRFD
       value if PATH is an absolute file name, to match Posix spec
       better.  If AT_SYMLINK_NOFOLLOW is set in FLAGS, don't resolve
       symlinks.
      
      Fixes: debbugs:12632
      14f20728
    • 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
  14. 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
  15. 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
  16. 12 Oct, 2012 2 commits
    • Eli Zaretskii's avatar
      Fix typo in last change. · 99b1553e
      Eli Zaretskii authored
      99b1553e
    • Eli Zaretskii's avatar
      Fix bug #12587 with slow startup on MS-Windows with Netlogon service. · bb385a92
      Eli Zaretskii authored
       src/fileio.c (check_existing): New function.
       (make_temp_name, Ffile_exists_p, Ffile_writable_p): Call it
       instead of calling 'stat', when what's needed is to check whether
       a file exists.  This avoids expensive system calls on MS-Windows.
       src/w32.c (init_environment): Call 'check_existing' instead of 'stat'.
       src/lread.c (openp) [WINDOWSNT]: Call 'access' instead of 'stat' to
       determine whether a file exists and is not a directory.
       src/lisp.h (check_existing): Add prototype.
      bb385a92
  17. 08 Oct, 2012 1 commit
  18. 05 Oct, 2012 2 commits
  19. 04 Oct, 2012 1 commit
  20. 30 Sep, 2012 2 commits
    • Fabrice Popineau's avatar
      Support x64 build on MS-Windows with MSVC. · 62aba0d4
      Fabrice Popineau authored
       src/w32term.h (SCROLL_BAR_PACK, SCROLL_BAR_UNPACK): Define for x64.
       (SET_SCROLL_BAR_W32_WINDOW): Cast ID to intptr_t, for
       compatibility with x64.
       src/w32term.c (w32_draw_underwave): Don't use GCC extensions for
       defining an XRectangle structure.
       src/w32proc.c (RVA_TO_PTR, w32_executable_type): Fix pointer
       arithmetics for compatibility with x64.
       src/w32menu.c (add_menu_item): Use UINT_PTR instead of UINT, for
       compatibility with x64.
       src/w32heap.h: Adjust prototypes and declarations.
       src/w32heap.c (RVA_TO_PTR, allocate_heap, sbrk, init_heap)
       (round_heap): Use DWORD_PTR, ptrdiff_t and size_t instead of
       DWORD, long, and unsigned long, for compatibility with x64.
       (allocate_heap) [_WIN64]: Reserve 32GB of memory.
       (sbrk): Argument is now of type ptrdiff_t.
       src/w32fns.c (HMONITOR): Condition declaration on _WIN32_WINNT being
       less than 0x0500.
       (w32_msg_pump): Use WPARAM type for 'result'.
       src/w32.c (init_environment, get_emacs_configuration): Support AMD64
       architecture.
       (init_ntproc): Cast arguments of _open_osfhandle to intptr_t, for
       compatibility with x64.
       src/vm-limit.c (lim_data): Now size_t.
       (check_memory_limits): Adjust prototypes of real_morecore and
       __morecore to receive argument of type ptrdiff_t.  Use size_t for
       five_percent and data_size.
       src/unexw32.c: Use DWORD_PTR instead of DWORD for file-scope
       variables, for compatibility with x64.
       (rva_to_section, offset_to_section, relocate_offset)
       (OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET)
       (PTR_TO_RVA, RVA_TO_PTR, OFFSET_TO_PTR, get_section_info)
       (copy_executable_and_dump_data): Use DWORD_PTR instead of DWORD
       for compatibility with x64.
       src/sysdep.c (STDERR_FILENO): Define if not already defined.
       src/ralloc.c (real_morecore): Argument type is now ptrdiff_t.
       (__morecore): Argument type is now ptrdiff_t.
       (ROUNDUP, MEM_ROUNDUP): Use size_t instead of 'unsigned long'.
       (relinquish): Use ptrdiff_t type for 'excess'.
       (r_alloc_sbrk): Argument type is now ptrdiff_t.
       src/makefile.w32-in (HEAPSIZE): Get value from EMACS_HEAPSIZE.
       (bootstrap-temacs-CMD, bootstrap-temacs-SH): Use $(EMACS_PURESIZE)
       instead of a literal number.
       src/gmalloc.c [WINDOWSNT]: Include w32heap.h.
       (min): Define only if not already defined.
       src/frame.c (x_report_frame_params): Use EMACS_UINT for the return
       value of FRAME_X_WINDOW, to fit a 64-bit pointer on 64-bit Windows
       hosts.
       src/image.c (x_bitmap_pixmap): Return ptrdiff_t, not int, since
       'bitmaps' is a pointer.
       src/dispextern.h (x_bitmap_pixmap): Adjust prototype.
       src/alloc.c (gdb_make_enums_visible): Now conditional on __GNUC__.
      
       nt/makefile.w32-in ($(TRES)): Use $(EMACS_MANIFEST).
       nt/inc/sys/socket.h: Don't map Winsock error codes to standard ones
       that are already defined.
       nt/inc/ms-w32.h (EMACS_INT, EMACS_UINT, EMACS_INT_MAX, PRIuMAX)
       (pI, _INTPTR) [_MSC_VER]: Fix definitions for MSVC.
       [_MSC_VER]: Add pragmas to suppress some MSVC warnings.
       nt/preprep.c (pfnCheckSumMappedFile, rva_to_section)
       (offset_to_section, relocate_offset, OFFSET_TO_RVA)
       (RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET, PTR_TO_RVA)
       (OFFSET_TO_PTR, ROUND_UP, ROUND_DOWN)
       (copy_executable_and_move_sections, ADJUST_IMPORT_RVA, main): Use
       DWORD_PTR instead of DWORD for compatibility with x64.
       nt/nmake.defs: Support AMD64.
       (EMACS_HEAPSIZE, EMACS_PURESIZE, EMACS_MANIFEST): New macros.
       nt/gmake.defs: (EMACS_HEAPSIZE, EMACS_PURESIZE, EMACS_MANIFEST):
       New macros.
       nt/addsection.c (pfnCheckSumMappedFile, rva_to_section)
       (offset_to_section, relocate_offset, OFFSET_TO_RVA)
       (RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET, PTR_TO_RVA)
       (OFFSET_TO_PTR, ROUND_UP, ROUND_DOWN)
       (copy_executable_and_add_section, main): Use DWORD_PTR instead of
       DWORD, for compatibility with x64.
       nt/emacs-x64.manifest: New file.
       nt/emacs-x86.manifest: Renamed from emacs.manifest.
      
       lib-src/ntlib.c (gettimeofday): Copy from src/w32.c.  lib/gettime. 
       needs this function.
      62aba0d4
    • Eli Zaretskii's avatar
      Support atimers and CPU profiler via profile.c on MS-Windows. · c06c382a
      Eli Zaretskii authored
       src/w32proc.c (sig_mask, crit_sig): New static variables.
       (sys_signal): Support SIGALRM and SIGPROF.
       (sigemptyset, sigaddset, sigfillset, sigprocmask)
       (pthread_sigmask, setpgrp): Moved here from w32.c.  sigaddset,
       sigfillset, and sigprocmask are no longer no-ops.
       (sigismember): New function.
       (struct itimer_data): New definition.
       (ticks_now, real_itimer, prof_itimer, clocks_min, crit_real)
       (crit_prof): New static variables.
       (MAX_SINGLE_SLEEP): New definition.
       (timer_loop, stop_timer_thread, term_timers, init_timers)
       (start_timer_thread, getitimer, setitimer): New functions.
       (alarm): No longer a no-op, calls setitimer.
       src/w32.c (term_ntproc): Call term_timers.
       (init_ntproc): Make sure all signals are unblocked at startup, to
       erase any traces of dumping.  Call init_timers.
       src/w32fns.c (hourglass_timer, HOURGLASS_ID): Remove.
       Windows-specific code to display the hourglass mouse pointer is no
       longer used.
       (w32_wnd_proc): Remove code that handled the WM_TIMER message due
       to hourglass timer expiration.
       (start_hourglass, cancel_hourglass, DEFAULT_HOURGLASS_DELAY):
       Remove, no longer used.
       (w32_note_current_window, show_hourglass, hide_hourglass): New
       functions, in support of hourglass cursor display similar to other
       window systems.
       (syms_of_w32fns): Don't initialize hourglass_timer.
       src/xdisp.c (start_hourglass, cancel_hourglass): Now used on
       WINDOWSNT as well.
       (start_hourglass) [WINDOWSNT]: Call w32_note_current_window.
       src/w32.h (init_timers, term_timers): Add prototypes.
      
       nt/inc/sys/time.h (ITIMER_REAL, ITIMER_PROF): Define.
       (struct itimerval): Define.
       (getitimer, setitimer): Add prototypes.
       nt/inc/ms-w32.h <sigset_t> [_MSVC_VER]: Make the typedef consistent
       with MinGW.
       (SA_RESTART, SIGPROF): Define.
       nt/config.nt (HAVE_SETITIMER): Define to 1.
      c06c382a
  21. 25 Sep, 2012 2 commits
    • Juanma Barranquero's avatar
      Move Vlibrary_cache to emacs.c and reset before dumping. · aa15c6bb
      Juanma Barranquero authored
      * src/lisp.h (reset_image_types): Declare.
      [WINDOWSNT] (Vlibrary_cache): Declare.
      
      * src/image.c (reset_image_types): New function.
      
      * src/emacs.c [WINDOWSNT] (Vlibrary_cache): Move from w32.c.
      (syms_of_emacs) [WINDOWSNT] <Vlibrary_cache>: Initialize and staticpro.
      (Fdump_emacs): Reset Vlibrary_cache and image_types.
      
      * src/w32.c (Vlibrary_cache): Do not define; moved to emacs.c
      (globals_of_w32) <Vlibrary_cache>: Do not initialize.
      
      * src/w32.h (Vlibrary_cache): Do not declare.
      aa15c6bb
    • Eli Zaretskii's avatar
      Fix handling of fatal signals and exceptions on MS-Windows. · 16b22fef
      Eli Zaretskii authored
       src/w32proc.c (sys_signal): Handle all signals defined by the
       MS-Windows runtime, not just SIGCHLD.  Actually install the signal
       handlers for signals supported by Windows.  Don't override
       term_ntproc as the handler for SIGABRT.
       (sigaction): Rewrite to call sys_signal instead of duplicating its
       code.
       (sys_kill): Improve commentary.
       src/w32.c (term_ntproc): Accept (and ignore) one argument, for
       consistency with a signature of a signal handler.  All callers
       changed.
       (init_ntproc): Accept an argument DUMPING.  If dumping, don't
       install term_ntproc as a signal handler for SIGABRT, as that
       should be done by the dumped Emacs.
       src/w32.h (init_ntproc, term_ntproc): Adjust prototypes.
       src/w32select.c (term_w32select): Protect against repeated
       invocation by setting clipboard_owner to NULL after calling
       DestroyWindow.
       src/emacs.c (shut_down_emacs, main): Adapt the calls to init_ntproc
       and term_ntproc to their modified signatures.
      16b22fef
  22. 23 Sep, 2012 1 commit
    • Chong Yidong's avatar
      Remove LIBRARIES arg from w32_delayed_load and friends. · d07ff9db
      Chong Yidong authored
      These always use Vdynamic_library_alist anyway.
      
      * src/image.c (Finit_image_library, lookup_image_type)
      (define_image_type): Remove now-unneeded second arg.
      (init_xpm_functions, init_png_functions, init_jpeg_functions)
      (init_tiff_functions, init_gif_functions, init_svg_functions):
      Arglist and w32_delayed_load calling convention changed.
      (gs_type): Remove init_gs_functions; there is no such function.
      
      * src/gnutls.c (init_gnutls_functions): Caller changed; remove arg.
      (Fgnutls_available_p): Caller changed.
      
      * src/xml.c (init_libxml2_functions, Flibxml_parse_html_region)
      (Flibxml_parse_xml_region): Likewise.
      
      * src/dispextern.h (struct image_type): Remove arg from init function.
      
      * src/w32.c (w32_delayed_load): Remove LIBRARIES argument; always use
      Vdynamic_library_alist.
      
      * lisp/image.el (image-type-available-p): Change caller to
      init-image-library.
      d07ff9db
  23. 17 Sep, 2012 1 commit
    • Daniel Colascione's avatar
      Implement cygw32 · 0fda9b75
      Daniel Colascione authored
      Here, we use the generic window-system configuration system we just
      implemented to support the w32 window-system in the mainline build
      under Cygwin.  (Previously, the w32 window system could only be
      compiled as part of the NT-native Emacs build process.)
      
      The changes in this patch need to be applied atomically in order to
      avoid breaking Emacs.  The changes include:
      
        - Changes throughout the Lisp and C code to not assume that
            NT Emacs and the w32 window system are synonymous.
      
        - Wiring up the regular select(2) event loop to Windows messages
      
        - Cleaning up the w32 drag-and-drop receiving code.
      
        - Exposing Cygwin path conversion functions to elisp.
      
        - Unicode file dialog support when compiling for Cygwin.
      
        - Splitting the w32 term lisp initialization code into code
          applicable to any w32 window-system and code specific to
          system-type windows-nt.
      
        - Integrating the old and new w32 code into the build system.
      0fda9b75
  24. 15 Sep, 2012 1 commit
    • Eli Zaretskii's avatar
      Fix MS-Windows build broken by 2012-09-15T07:06:56Z!eggert@cs.ucla.edu,... · 7105c8cb
      Eli Zaretskii authored
      Fix MS-Windows build broken by 2012-09-15T07:06:56Z!eggert@cs.ucla.edu, completing fix for bug #12446.
      
       src/w32xfns.c:
       src/w32uniscribe.c:
       src/w32term.c:
       src/w32select.c:
       src/w32reg.c:
       src/w32proc.c:
       src/w32menu.c:
       src/w32inevt.c:
       src/w32heap.c:
       src/w32font.c:
       src/w32fns.c:
       src/w32console.c:
       src/w32.c:
       src/w16select.c: Remove inclusion of setjmp.h, as it is now included
       by lisp.h.  This completes removal of setjmp.h inclusion
       erroneously announced in the previous commit.
       src/lisp.h [!HAVE__SETJMP, !HAVE_SIGSETJMP]: Make the commentary
       more accurate.
       src/image.c (_setjmp) [!HAVE__SETJMP]: Define only if 'setjmp' is
       not defined as a macro.  The latter happens on MS-Windows.
      7105c8cb
  25. 07 Sep, 2012 1 commit
  26. 04 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Simplify redefinition of 'abort' (Bug#12316). · 1088b922
      Paul Eggert authored
      Do not try to redefine the 'abort' function.  Instead, redo
      the code so that it calls 'emacs_abort' rather than 'abort'.
      This removes the need for the NO_ABORT configure-time macro
      and makes it easier to change the abort code to do a backtrace.
      * configure.ac (NO_ABRT): Remove.
      * admin/CPP-DEFINES (NO_ABORT): Remove.
      * nt/inc/ms-w32.h (w32_abort) [HAVE_NTGUI]: Remove.
      * src/.gdbinit: Just stop at emacs_abort, not at w32_abort or abort.
      * src/emacs.c (abort) [!DOS_NT && !NO_ABORT]:
      Remove; sysdep.c's emacs_abort now takes its place.
      * src/lisp.h (emacs_abort): New decl.  All calls from Emacs code to
      'abort' changed to use 'emacs_abort'.
      * src/msdos.c (dos_abort) [defined abort]: Remove; not used.
      (abort) [!defined abort]: Rename to ...
      (emacs_abort): ... new name.
      * src/sysdep.c (emacs_abort) [!HAVE_NTGUI]: New function, taking
      the place of the old 'abort' in emacs.c.
      * src/w32.c, src/w32fns.c (abort): Do not #undef.
      * src/w32.c (emacs_abort): Rename from w32_abort.
      1088b922
  27. 02 Sep, 2012 1 commit
    • Paul Eggert's avatar
      * emacs.c, eval.c: Use bool for boolean. · 1882aa38
      Paul Eggert authored
      * emacs.c (initialized, inhibit_window_system, running_asynch_code):
      (malloc_using_checking) [DOUG_LEA_MALLOC]:
      (display_arg) [HAVE_X_WINDOWS || HAVE_NS]:
      (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch)
      (main, decode_env_path, Fdaemon_initialized):
      * eval.c (call_debugger, Finteractive_p, interactive_p):
      (unwind_to_catch, Fsignal, wants_debugger, skip_debugger)
      (maybe_call_debugger, Fbacktrace):
      * process.c (read_process_output, exec_sentinel):
      Use bool for booleans.
      * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X.
      All callers changed.
      * eval.c (interactive_p): Omit always-true boolean argument
      EXCLUDE_SUBRS_P.  All callers changed.
      * dispextern.h, lisp.h: Reflect above API changes.
      * firstfile.c (dummy): Use the address of 'main', whose signature
      won't change, instead of the address of 'initialize', whose
      signature just changed from int to bool.
      * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ...
      * msdos.c (fatal_error_in_progress): ... from here.
      * xdisp.c (redisplaying_p): Now a boolean.  Set it to 1 instead
      of incrementing it.
      (redisplay_internal, unwind_redisplay): Simply clear
      REDISPLAYING_P when unwinding, instead of saving its previous,
      always-false value and then restoring it.
      1882aa38
  28. 26 Aug, 2012 1 commit
  29. 18 Aug, 2012 1 commit
    • Paul Eggert's avatar
      * process.h (PSET): Remove. · 6a09a33b
      Paul Eggert authored
      Replace all uses with calls to new setter functions.
      Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
      (PROCESS_INLINE): New macro.
      (pset_childp): New setter function.
      (pset_gnutls_cred_type) [HAVE_GNUTLS]: New setter function.
      * process.c (PROCESS_INLINE):
      Define to EXTERN_INLINE, so that the corresponding functions
      are compiled into code.
      (pset_buffer, pset_command, pset_decode_coding_system)
      (pset_decoding_buf, pset_encode_coding_system)
      (pset_encoding_buf, pset_filter, pset_log, pset_mark, pset_name)
      (pset_plist, pset_sentinel, pset_status, pset_tty_name)
      (pset_type, pset_write_queue): New setter functions.
      
      Fixes: debbugs:12215
      6a09a33b
  30. 07 Aug, 2012 1 commit