1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00
Commit Graph

952 Commits

Author SHA1 Message Date
Eli Zaretskii
9e821c83d3 Fixed configure.ac and headers in nt/inc. Emulated functions not handled yet. 2012-11-24 18:02:07 +02:00
Juanma Barranquero
0414b37b65 nt/config.nt: Sync with autogen/config.in.
(BROKEN_GETWD, HAVE_CLOSEDIR, HAVE_DIRENT_H, HAVE_FCNTL_H, HAVE_GETWD): Remove.
2012-11-23 16:42:40 +01:00
Eli Zaretskii
a879f0eaae Fix bug #12955 with building under MSYS Bash.
src/makefile.w32-in (globals.h, gl-stamp): Use $(SWITCHCHAR) instead
 of a literal "/".
 (gl-stamp): Invoke fc.exe directly, not through cmd.
2012-11-23 10:47:34 +02:00
Paul Eggert
95ef7787fb Assume POSIX 1003.1-1988 or later for dirent.h.
* 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
2012-11-22 23:48:43 -08:00
Paul Eggert
9239d97052 Assume POSIX 1003.1-1988 or later for unistd.h.
* 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
2012-11-21 13:06:52 -08:00
Glenn Morris
6ef2e5ef52 Merge from emacs-24; up to 2012-11-17T22:12:47Z!eggert@cs.ucla.edu 2012-11-20 20:47:55 -08:00
Eli Zaretskii
9aef4c1281 Fix !ifdef in nmake.defs.
nt/nmake.defs: Use !if, not !ifdef.  See
 http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00027.html
 for the details.
2012-11-20 19:13:10 +02:00
Eli Zaretskii
3b0108c5ba Yet more fixes for bug #12878 with MSVC build.
nt/inc/stdint.h (INTPTR_MIN): Define for MSVC.
2012-11-20 19:07:55 +02:00
Eli Zaretskii
88c4a13c3b More fixes for bug #12878 with MS-Windows MSVC build.
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.
2012-11-19 19:34:21 +02:00
Eli Zaretskii
031b541f19 Fix latest changes in nt/inc/unistd.h.
nt/inc/unistd.h: Don't include fcntl.h and don't define O_RDWR.

Fixes: debbugs:12881
2012-11-18 18:54:31 +02:00
Juanma Barranquero
1b47437371 nt/config.nt: Sync with autogen/config.in.
(HAVE_FPATHCONF): Remove.
2012-11-18 00:58:56 +01:00
Paul Eggert
49cdacdad3 Assume POSIX 1003.1-1988 or later for fcntl.h.
* 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
2012-11-17 14:12:47 -08:00
Eli Zaretskii
22bae83fa8 Fix bug #12829 with aborts on MS-Windows when several child processes die.
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-17 18:46:45 +02:00
Dani Moncayo
cd48a2e800 Don't produce "barebin" zip file as part of MS-Windows distributions.
nt/zipdist.bat (ZIP_CHECK): Remove unused label.  When invoking 7z
 to check if it's installed, redirect standard output and standard
 error to the null device.
 (ZIP_DIST): Don't build the "barebin" distribution.
2012-11-17 10:55:07 +02:00
Juanma Barranquero
b24696b8c8 nt/config.nt: Sync with autogen/config.in.
(GETGROUPS_T, GETGROUPS_ZERO_BUG, GNULIB_FACCESSAT, HAVE_ACCESS)
(HAVE_EACCESS, HAVE_FACCESSAT, HAVE_GETGROUPS, HAVE_LIBGEN_H):
New macros.
2012-11-15 15:47:31 +01:00
Eli Zaretskii
14f207289c MS-Windows followup for 2012-11-14T04:55:41Z!eggert@cs.ucla.edu, regarding faccessat.
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
2012-11-14 19:22:55 +02:00
Paul Eggert
73dcdb9f30 Use faccessat, not access, when checking file permissions.
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
2012-11-13 20:55:41 -08:00
Juanma Barranquero
8e2417bfc0 Fix typos. 2012-11-05 18:29:30 +01:00
Eli Zaretskii
4f3f021d65 Avoid compiler warnings in the MS-Windows build.
nt/inc/unistd.h (tcgetpgrp, setsid): Provide prototypes.
2012-11-05 18:21:18 +02:00
Juanma Barranquero
efeccf10f0 nt/config.nt: Sync with autogen/config.in.
(DISPNEW_NEEDS_STDIO_EXT, GETPGRP_VOID, HAVE_SETPGID, HAVE_SETSID)
(PENDING_OUTPUT_COUNT, SETPGRP_RELEASES_CTTY): Remove.
2012-11-05 15:30:32 +01:00
Juanma Barranquero
f200a427ff nt/config.nt: Sync with autogen/config.in.
(GNULIB_CLOSE_STREAM, HAVE_DECL___FPENDING): New macros.
2012-11-04 13:44:58 +01:00
Eli Zaretskii
3a7089c180 Fix Windows build as fallout from 2012-11-03T18:54:17Z!eggert@cs.ucla.edu.
nt/config.nt (PENDING_OUTPUT_N_BYTES): Define.

 lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/fpending.$(O) and
 $(BLD)/close-stream.$(O).
 ($(BLD)/close-stream.$(O)):
 ($(BLD)/fpending.$(O)): New dependencies.

Fixes: debbugs:9574
2012-11-03 22:43:29 +02:00
Chong Yidong
052f924a01 Bump version to 24.3.50 2012-11-02 08:48:12 +08:00
Eli Zaretskii
7e8b50d9e5 Fix MS-Windows build broken by fixing bug #12776 on Posix platforms.
src/w32proc.c (getpgrp, setpgid): New functions.

 nt/inc/unistd.h (setpgid, getpgrp): Provide prototypes.
 nt/config.nt (GETPGRP_VOID): Define to 1.
2012-11-01 16:21:45 +02:00
Juanma Barranquero
e7b9870691 nt/config.nt: Sync with autogen/config.in. 2012-10-24 15:46:38 +02:00
Eli Zaretskii
a68089e4a4 Fix warnings when compiling on MS-Windows with -std=gnu99.
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.
2012-10-17 21:02:44 +02:00
Juanma Barranquero
1f9f395d80 Fix ChangeLog typos. 2012-10-17 13:24:34 +02:00
Juanma Barranquero
fd5125adfe nt/config.nt: Sync with autogen/config.in.
(HAVE_NTGUI): New macro.

src/makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI,
it's now in nt/config.nt.
2012-10-08 16:14:22 +02:00
Eli Zaretskii
d8ab37a818 Fix compilation warnings in the MS-Windows build.
src/w32proc.c (sys_wait): Declare 'signame' 'const char *', to be
 consistent with the change in return value of 'safe_strsignal'.

 nt/preprep.c (RVA_TO_PTR): Cast the result to 'void *', to avoid
 compiler warnings when using the value.
2012-10-02 19:55:29 +02:00
Eli Zaretskii
2d7d160838 Clean up the Windows x64 changes.
nt/preprep.c (RVA_TO_PTR): Use 'unsigned char *' instead of
 'void *', for pointer arithmetics.
 (OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET): Enclose all
 macro arguments in parentheses.

 src/unexw32.c (OFFSET_TO_RVA, RVA_TO_OFFSET)
 (RVA_TO_SECTION_OFFSET): Encode all macro arguments in parentheses.
 (RVA_TO_PTR): Cast the result of RVA_TO_OFFSET to 'unsigned char *',
 as the previous version used 'void *'.
 src/ralloc.c (ROUNDUP): Fix last change.
 (MEM_ROUNDUP): Don't cast MEM_ALIGN, it is already of type
 'size_t'.

Fixes: debbugs:12544
2012-10-01 13:37:37 +02:00
Fabrice Popineau
62aba0d497 Support x64 build on MS-Windows with MSVC.
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.
2012-09-30 23:36:42 +02:00
Eli Zaretskii
c06c382ae4 Support atimers and CPU profiler via profile.c on MS-Windows.
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.
2012-09-30 17:49:05 +02:00
Juanma Barranquero
9ee2ee9f1b nt/config.nt: Sync with autogen/config.in. 2012-09-30 14:27:23 +02:00
Juanma Barranquero
cd155987b5 nt/config.nt: Sync with autogen/config.in
(HAVE_TIMER_SETTIME): New macro.
2012-09-29 19:06:28 +02:00
Eli Zaretskii
5101529e98 Clean-up left-overs after 2012-09-23T08:44:20Z!eggert@cs.ucla.edu wrt signal handling.
src/.gdbinit: Set breakpoint on terminate_due_to_signal, not on
 fatal_error_backtrace.
 src/w32proc.c (sys_kill): Undo last change: don't do anything when
 invoked to deliver SIGABRT to our own process.  This is now
 handled by emacs_raise.

 nt/inc/ms-w32.h (emacs_raise): Redefine to invoke emacs_abort.

Fixes: debbugs:12471
2012-09-23 19:34:30 +02:00
Paul Eggert
4d7e6e51dd Simplify and avoid signal-handling races.
* nt/inc/ms-w32.h (emacs_raise): New macro.
* src/alloc.c (die):
* src/sysdep.c (emacs_abort) [HAVE_NTGUI]:
Avoid recursive loop if there's a fatal error in the function itself.
* src/atimer.c (pending_atimers):
* src/blockinput.h: Don't include "atimer.h"; no longer needed.
(interrupt_input_pending): Remove.  All uses removed.
pending_signals now counts both atimers and ordinary interrupts.
This is less racy than having three separate pending-signal flags.
(block_input, unblock_input, totally_unblock_input, unblock_input_to)
(input_blocked_p):
Rename from their upper-case counterparts BLOCK_INPUT,
UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO,
INPUT_BLOCKED_P, and turn into functions.  All uses changed.
This makes it easier to access volatile variables more accurately.
(BLOCK_INPUT_RESIGNAL): Remove.  All uses replaced by unblock_input ().
(input_blocked_p): Prefer this to 'interrupt_input_blocked', as
that's more reliable if the code is buggy and sets
interrupt_input_blocked to a negative value.  All uses changed.
* src/atimer.c (deliver_alarm_signal):
Remove.  No need to deliver this to the parent; any thread can
handle this signal now.  All uses replaced by underlying handler.
* src/atimer.c (turn_on_atimers):
* src/dispnew.c (handle_window_change_signal):
* src/emacs.c (handle_danger_signal):
* src/keyboard.c (kbd_buffer_get_event):
Don't reestablish signal handler; not needed with sigaction.
* src/blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT)
(UNBLOCK_INPUT_TO):
Rework to avoid unnecessary accesses to volatile variables.
(UNBLOCK_INPUT_TO): Now a function.
(totally_unblock_input, unblock_input): New decls.
* src/data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c
(init_data): Remove.  Necessary stuff now done in init_signal.
* src/emacs.c, src/xdisp.c: Include "atimer.h", since we invoke atimer functions.
* src/emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c.
(fatal_error_code): Remove; no longer needed.
(terminate_due_to_signal): Rename from fatal_error_backtrace, since
it doesn't always backtrace.  All uses changed.  No need to reset
signal to default, since sigaction and/or die does that for us now.
Use emacs_raise (FOO), not kill (getpid (), FOO).
(main): Check more-accurately whether we're dumping.
Move fatal-error setup to sysdep.c
* src/floatfns.c: Do not include "syssignal.h"; no longer needed.
* src/gtkutil.c (xg_get_file_name, xg_get_font):
Remove no-longer-needed signal-mask manipulation.
* src/keyboard.c, src/process.c (POLL_FOR_INPUT):
Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined.
* src/keyboard.c (read_avail_input): Remove.
All uses replaced by gobble_input.
(Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code.
(kbd_buffer_store_event_hold, gobble_input):
(record_asynch_buffer_change) [USABLE_SIGIO]:
(store_user_signal_events):
No need to mess with signal mask.
(gobble_input): If blocking input and there are terminals, simply
set pending_signals to 1 and return.  All hooks changed to not
worry about whether input is blocked.
(process_pending_signals): Clear pending_signals before processing
them, in case a signal comes in while we're processing.
By convention callers now test pending_signals before calling us.
(UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input):
New functions, to support changes to blockinput.h.
(handle_input_available_signal): Now extern.
(reinvoke_input_signal): Remove.  All uses replaced by
handle_async_input.
(quit_count): Now volatile, since a signal handler uses it.
(handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg.  All
callers changed.  Block SIGINT only if not already blocked.
Clear sigmask reliably, even if Fsignal returns, which it can.
Omit unnecessary accesses to volatile var.
(quit_throw_to_read_char): No need to restore sigmask.
* src/keyboard.c (gobble_input, handle_user_signal):
* src/process.c (wait_reading_process_output):
Call signal-handling code rather than killing ourselves.
* src/lisp.h: Include <float.h>, for...
(IEEE_FLOATING_POINT): New macro, moved here to avoid duplication.
(pending_signals): Now volatile.
(syms_of_data): Now const if IEEE floating point.
(handle_input_available_signal) [USABLE_SIGIO]:
(terminate_due_to_signal, record_child_status_change): New decls.
* src/process.c (create_process): Avoid disaster if memory is exhausted
while we're processing a vfork, by tightening the critical section
around the vfork.
(send_process_frame, process_sent_to, handle_pipe_signal)
(deliver_pipe_signal): Remove.  No longer needed, as Emacs now
ignores SIGPIPE.
(send_process): No need for setjmp/longjmp any more, since the
SIGPIPE stuff is now gone.  Instead, report an error if errno
is EPIPE.
(record_child_status_change): Now extern.  PID and W are now args.
Return void, not bool.  All callers changed.
* src/sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]:
Remove.  All uses removed.  This bug should be fixed now in a
different way.
(wait_for_termination_1): Use waitpid rather than sigsuspend,
and record the child status change directly.  This avoids the
need to futz with the signal mask.
(process_fatal_action): Move here from emacs.c.
(emacs_sigaction_flags): New function, containing
much of what used to be in emacs_sigaction_init.
(emacs_sigaction_init): Use it.  Block nonfatal system signals that are
caught by emacs, to make races less likely.
(deliver_process_signal): Rename from handle_on_main_thread.
All uses changed.
(BACKTRACE_LIMIT_MAX): Now at top level.
(thread_backtrace_buffer, threadback_backtrace_pointers):
New static vars.
(deliver_thread_signal, deliver_fatal_thread_signal):
New functions, for more-accurate delivery of thread-specific signals.
(handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c.
(deliver_arith_signal): Handle in this thread, not
in the main thread, since it's triggered by this thread.
(maybe_fatal_sig): New function.
(init_signals): New arg DUMPING so that we can be more accurate
about whether we're dumping.  Caller changed.
Treat thread-specific signals differently from process-general signals.
Block all signals while handling fatal error; that's safer.
xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal
on IEEE hosts.
When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored.
Ignore SIGPIPE unless batch.
(emacs_backtrace): Output backtrace for the appropriate thread,
which is not necessarily the main thread.
* src/syssignal.h: Include <stdbool.h>.
(emacs_raise): New macro.
* src/xterm.c (x_connection_signal): Remove; no longer needed
now that we use sigaction.
(x_connection_closed): No need to mess with sigmask now.
(x_initialize): No need to reset SIGPIPE handler here, since
init_signals does this for us now.

Fixes: debbugs:12471
2012-09-23 01:44:20 -07:00
Eli Zaretskii
ae97707fa2 Fix bug #12464 with test for giflib 5.0.0 on MS-Windows.
nt/configure.bat: Include stddef.h before gif_lib.h, to have size_t
 defined, as needed by giflib-5.0.0.
2012-09-18 13:49:33 +03:00
Juanma Barranquero
caf4040f9e nt/config.nt: Sync with autogen/config.in.
(BROKEN_SA_RESTART, SYNC_INPUT): Remove.
2012-09-17 15:22:45 +02:00
Glenn Morris
78f83752f5 Reduce the number of versioned files storing the short copyright string
* configure.ac (copyright): New output variable.
(COPYRIGHT): New AC_DEFINE.

* admin/admin.el (set-copyright): No more need to set copyrights for
nextstep, or .c files.  Add configure.ac and config.nt.

* lib-src/ebrowse.c (version):
* lib-src/etags.c (print_version): Use COPYRIGHT.

* nextstep/templates/Info-gnustep.plist.in:
* nextstep/templates/InfoPlist.strings.in:
* nextstep/templates/Info.plist.in: Let configure set copyright.

* nt/config.nt (COPYRIGHT): New.

* src/emacs.c: Use COPYRIGHT.
2012-09-16 17:56:08 -07:00
Paul Eggert
39a57ad07b Port _setjmp fix to POSIXish hosts as well as Microsoft.
* nt/config.nt: Attempt to sync with autogen/config.in.
(HAVE_SIGSETJMP, HAVE__SETJMP): New macros.
(_longjmp, _setjmp): Remove.
* src/image.c (_setjmp) [!HAVE__SETJMP]: Restore definition, as
it's needed on POSIXish hosts that lack _setjmp.  Attempt to solve
the Microsoft problem in a different way, by altering nt/config.nt.
2012-09-15 01:45:27 -07:00
Juanma Barranquero
fe5979317f nt/config.nt: Sync with autogen/config.in.
(BROKEN_FIONREAD, BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL)
(BROKEN_SIGPTY, HAVE_CBRT, HAVE_LOGB, NO_TERMIO): Remove.
(USABLE_FIONREAD, USABLE_SIGIO): New macros.
2012-09-14 03:09:22 +02:00
Juanma Barranquero
8c718c5852 nt/config.nt: Sync with autogen/config.in.
(FLOAT_CHECK_DOMAIN, HAVE_FMOD, HAVE_FREXP)
(HAVE_INVERSE_HYPERBOLIC, NO_MATHERR): Remove.
2012-09-10 09:37:53 -04:00
Eli Zaretskii
a30cb5dd2c Fix setting of environment variables by nt/configure.bat.
nt/configure.bat <use_extensions>: Don't leave it set in the
 environment when the script exits.
2012-09-08 14:20:32 +03:00
Juanma Barranquero
4d64875a83 nt/config.nt: Sync with autogen/config.in.
(NO_ABORT, SIGNAL_H_AHB): Remove.
2012-09-07 14:15:08 +02:00
Eli Zaretskii
3e6d6928bd MS-Windows followup for 2012-09-07T01:27:44Z!eggert@cs.ucla.edu, signal-handler cleanup.
src/w32proc.c (sigaction): New function, emulates Posix 'sigaction'.
 src/w32.c (sigemptyset): Empty the set.
 (sigsetmask, sigmask, sigblock, sigunblock): Remove unused functions.

 nt/inc/ms-w32.h (struct sigaction): Declare sa_handler __cdecl.

Fixes: debbugs:12327
2012-09-07 11:20:07 +03:00
Juanma Barranquero
5dbaffae0c nt/config.nt: Sync with autogen/config.in. 2012-09-05 02:17:57 +02:00
Paul Eggert
1088b9226e Simplify redefinition of 'abort' (Bug#12316).
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.
2012-09-04 10:34:54 -07:00
Juanma Barranquero
137e08a46c nt/config.nt: Sync with autogen/config.in.
(HAVE_EXECINFO_H, TERM_HEADER): New macros.
2012-09-02 04:00:47 +02:00
Daniel Colascione
17a2cbbd76 Refactor window-system configuration
This change streamlines the window system selection code in
configure.in and moves many common function declarations from
window-specific headers to frame.h.  It introduces a new TERM_HEADER
macro in config.h: we set this macro to the right header to use for
the window system for which we're compiling Emacs and have source
files include it indirectly.  This way, we don't have to teach every
file about every window system.
2012-08-31 22:38:52 -08:00
Juanma Barranquero
fe72cdc5b2 nt/config.nt: Sync with autogen/config.in. 2012-08-22 13:30:25 +02:00