aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-04-21 17:53:32 -0700
committerPaul Eggert2012-04-21 17:53:32 -0700
commitbbd347f5f7e99da1a559dad818b5fa8f59c0901e (patch)
tree77c1fc54c2240b08d2859109d18cac8812a8ffb1 /src
parente4ecdc9c71af4199129d5dd2db1a32ff6b725fe4 (diff)
parent9ee7d8b93cb143b473e6dffb708e777bc6fe5bd0 (diff)
downloademacs-bbd347f5f7e99da1a559dad818b5fa8f59c0901e.tar.gz
emacs-bbd347f5f7e99da1a559dad818b5fa8f59c0901e.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog197
-rw-r--r--src/ChangeLog.102
-rw-r--r--src/ChangeLog.112
-rw-r--r--src/ChangeLog.62
-rw-r--r--src/Makefile.in15
-rw-r--r--src/alloc.c114
-rw-r--r--src/buffer.c11
-rw-r--r--src/character.h2
-rw-r--r--src/dired.c41
-rw-r--r--src/indent.c3
-rw-r--r--src/keyboard.c23
-rw-r--r--src/lisp.h39
-rw-r--r--src/lisp.mk1
-rw-r--r--src/lread.c5
-rw-r--r--src/m/ia64.h10
-rw-r--r--src/nsterm.m8
-rw-r--r--src/print.c90
-rw-r--r--src/process.c50
-rw-r--r--src/ralloc.c60
-rw-r--r--src/regex.c17
-rw-r--r--src/s/aix4-2.h4
-rw-r--r--src/s/cygwin.h13
-rw-r--r--src/s/darwin.h3
-rw-r--r--src/s/freebsd.h3
-rw-r--r--src/s/gnu-linux.h3
-rw-r--r--src/s/gnu.h3
-rw-r--r--src/s/hpux10-20.h4
-rw-r--r--src/s/irix6-5.h1
-rw-r--r--src/s/msdos.h1
-rw-r--r--src/s/netbsd.h3
-rw-r--r--src/s/sol2-6.h1
-rw-r--r--src/s/unixware.h4
-rw-r--r--src/sysdep.c211
-rw-r--r--src/w32.c10
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c31
36 files changed, 719 insertions, 270 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 71fb5d9ab2a..ae8ab9420a8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,4 @@
12012-04-09 Paul Eggert <eggert@cs.ucla.edu> 12012-04-21 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Fix integer width and related bugs (Bug#9874). 3 Fix integer width and related bugs (Bug#9874).
4 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): 4 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
@@ -790,6 +790,187 @@
790 rather than rolling our own approximation. 790 rather than rolling our own approximation.
791 (SCROLL_BAR_VEC_SIZE): Remove; not used. 791 (SCROLL_BAR_VEC_SIZE): Remove; not used.
792 792
7932012-04-21 Eduard Wiebe <usenet@pusto.de>
794
795 * sysdep.c (list_system_processes, system_process_attributes): Add
796 implementation for FreeBSD (Bug#5243).
797
7982012-04-21 Andreas Schwab <schwab@linux-m68k.org>
799
800 * lisp.mk (lisp): Update.
801
8022012-04-20 Paul Eggert <eggert@cs.ucla.edu>
803
804 * keyboard.c (process_pending_signals): Define only if SYNC_INPUT.
805 It is never used otherwise.
806
8072012-04-20 Stefan Monnier <monnier@iro.umontreal.ca>
808
809 * print.c (print_preprocess): Only check print_depth if print-circle
810 is nil.
811 (print_object): Check for cycles even when print-circle is nil and
812 print-gensym is t, but only check print_depth if print-circle is nil.
813
8142012-04-20 Chong Yidong <cyd@gnu.org>
815
816 * process.c (wait_reading_process_output): If EIO occurs on a pty,
817 set the status to "failed" and ensure that sentinel is run.
818
8192012-04-20 Glenn Morris <rgm@gnu.org>
820
821 * process.c (Fset_process_inherit_coding_system_flag)
822 (Fset_process_query_on_exit_flag): Doc fix (mention return value).
823 (Fmake_network_process, Fmake_serial_process): Doc fix.
824
8252012-04-20 Eli Zaretskii <eliz@gnu.org>
826
827 * xdisp.c (string_buffer_position_lim): Limit starting position to
828 BEGV.
829 (set_cursor_from_row): If called for a mode-line or header-line
830 row, return zero immediately.
831 (try_cursor_movement): If inside continuation line, don't back up
832 farther than the first row after the header line, if any.
833 Don't consider the header-line row as "partially visible", even if
834 MATRIX_ROW_PARTIALLY_VISIBLE_P returns non-zero. (Bug#11261)
835
8362012-04-20 Atsuo Ohki <ohki@gssm.otsuka.tsukuba.ac.jp> (tiny change)
837
838 * lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n"
839 (bug#11238).
840
8412012-04-20 Teodor Zlatanov <tzz@lifelogs.com>
8422012-04-18 Paul Eggert <eggert@cs.ucla.edu>
843
844 configure: new option --enable-gcc-warnings (Bug#11207)
845 * Makefile.in (C_WARNINGS_SWITCH): Remove.
846 (WARN_CFLAGS, WERROR_CFLAGS): New macros.
847 (ALL_CFLAGS): Use new macros rather than old.
848 * process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
849 * regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
850 -Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
851 -Wunused-result, -Wunused-variable. This should go away once
852 the Emacs and Gnulib regex code is merged.
853 (xmalloc, xrealloc): Now static.
854
8552012-04-17 Paul Eggert <eggert@cs.ucla.edu>
856
857 * dired.c (Fsystem_groups): Remove unused local.
858
8592012-04-17 Glenn Morris <rgm@gnu.org>
860
861 * dired.c (Fsystem_users): Doc fix.
862
8632012-04-17 Dmitry Antipov <dmantipov@yandex.ru>
864
865 * dired.c (Fsystem_users, Fsystem_groups): New functions. (Bug#7900)
866 (syms_of_dired): Add them.
867
8682012-04-16 Paul Eggert <eggert@cs.ucla.edu>
869
870 Fix minor alloc.c problems found by static checking.
871 * alloc.c (_malloc_internal, _free_internal) [!DOUG_LEA_MALLOC]:
872 New extern decls, to avoid calling undeclared functions.
873 (dont_register_blocks): Define if ((!SYSTEM_MALLOC && !SYNC_INPUT)
874 && GC_MALLOC_CHECK), not if ((GC_MARK_STACK || defined
875 GC_MALLOC_CHECK) && GC_MALLOC_CHECK), to match when it's used.
876 (NEED_MEM_INSERT): New macro.
877 (mem_insert, mem_insert_fixup) [!NEED_MEM_INSERT]: Remove; unused.
878 Remove one incorrect comment and fix another.
879
880 Fix minor ralloc.c problems found by static checking.
881 See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html
882 * ralloc.c (ALIGNED, ROUND_TO_PAGE, HEAP_PTR_SIZE)
883 (r_alloc_size_in_use, r_alloc_freeze, r_alloc_thaw): Remove; unused.
884 (r_alloc_sbrk): Now static.
885
886 Improve ralloc.c interface checking.
887 See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html
888 * buffer.c (ralloc_reset_variable, r_alloc, r_re_alloc)
889 (r_alloc_free) [REL_ALLOC]: Move decls from here ...
890 * lisp.h (r_alloc, r_alloc_free, r_re_alloc, r_alloc_reset_variable)
891 [REL_ALLOC]: ... to here, to check interface.
892 * m/ia64.h (r_alloc, r_alloc_free) [REL_ALLOC && !_MALLOC_INTERNAL]:
893 Remove decls. This fixes an "It stinks!".
894
895 * alloc.c (which_symbols): Fix alignment issue / type clash.
896
8972012-04-15 Andreas Schwab <schwab@linux-m68k.org>
898
899 * lisp.h (struct Lisp_Symbol): Remove explicit padding.
900 (struct Lisp_Misc_Any): Likewise.
901 (struct Lisp_Free): Likewise.
902 * alloc.c (union aligned_Lisp_Symbol): Define.
903 (SYMBOL_BLOCK_SIZE, struct symbol_block): Use union
904 aligned_Lisp_Symbol instead of struct Lisp_Symbol.
905 (union aligned_Lisp_Misc): Define.
906 (MARKER_BLOCK_SIZE, struct marker_block): Use union
907 aligned_Lisp_Misc instead of union Lisp_Misc.
908 (Fmake_symbol, allocate_misc, gc_sweep): Adjust.
909
9102012-04-14 Paul Eggert <eggert@cs.ucla.edu>
911
912 Make GC_MAKE_GCPROS_NOOPS the default (Bug#9926).
913 * lisp.h (GC_MARK_STACK): Default to GC_MAKE_GCPROS_NOOPS.
914 * s/cygwin.h, s/darwin.h, s/freebsd.h, s/gnu.h, s/irix6-5.h, s/msdos.h:
915 * s/netbsd.h, s/sol2-6.h:
916 Remove definition of GC_MARK_STACK, since the default now works.
917 * s/aix4-2.h, s/hpux10-20.h, s/unixware.h:
918 Define GC_MARK_STACK to GC_USE_GCPROS_AS_BEFORE, since that's
919 no longer the default.
920 * s/gnu-linux.h (GC_MARK_STACK): Adjust to change in default.
921
9222012-04-14 Atsuo Ohki <ohki@gssm.otsuka.tsukuba.ac.jp> (tiny change)
923
924 * lread.c (lisp_file_lexically_bound_p):
925 Fix hang at ";-*-\n" (bug#11238).
926
9272012-04-14 Eli Zaretskii <eliz@gnu.org>
928
929 * xdisp.c (find_last_unchanged_at_beg_row): Don't consider a row
930 "unchanged" if its end.pos is beyond ZV. (Bug#11199)
931
9322012-04-14 Jan Djärv <jan.h.d@swipnet.se>
933
934 * nsterm.m (constrainFrameRect): Always constrain when there is only
935 one screen (Bug#10962).
936
9372012-04-13 Ken Brown <kbrown@cornell.edu>
938
939 * s/cygwin.h (PTY_OPEN): Don't try to close a bogus file descriptor.
940
9412012-04-13 Reuben Thomas <rrt@sc3d.org>
942
943 * indent.c (Fmove_to_column): Change interactive spec (Bug#739).
944
9452012-04-11 Daniel Colascione <dancol@dancol.org>
946
947 * s/cygwin.h: The vfork the #define in cygwin.h was protecting
948 against is gone. It's better to use vfork now so that when Cygwin
949 gains a new, working vfork, we use it automatically (bug#10398).
950
9512012-04-11 Stefan Monnier <monnier@iro.umontreal.ca>
952
953 * window.c (save_window_save): Obey window-point-insertion-type.
954
9552012-04-11 Glenn Morris <rgm@gnu.org>
956
957 * Makefile.in (GNUSTEP_CFLAGS): Rename from C_SWITCH_X_SYSTEM.
958
9592012-04-11 Stefan Monnier <monnier@iro.umontreal.ca>
960
961 * alloc.c (lisp_align_malloc): Remove unneeded prototype.
962
9632012-04-10 Jason S. Cornez <jcornez@ravenpack.com> (tiny change)
964
965 * keyboard.c: Override inhibit-quit after the third C-g (bug#6585).
966 (force_quit_count): New var.
967 (handle_interrupt): Use it.
968
9692012-04-10 Juanma Barranquero <lekktu@gmail.com>
970
971 * w32.c (w32_delayed_load): Record the full path of the library
972 being loaded (bug#10424).
973
7932012-04-09 Glenn Morris <rgm@gnu.org> 9742012-04-09 Glenn Morris <rgm@gnu.org>
794 975
795 * doc.c (Fsnarf_documentation): Check variables, functions are bound, 976 * doc.c (Fsnarf_documentation): Check variables, functions are bound,
@@ -804,8 +985,8 @@
804 * process.h: Add integer `gnutls_handshakes_tried' member to 985 * process.h: Add integer `gnutls_handshakes_tried' member to
805 process struct. 986 process struct.
806 987
807 * gnutls.h: Add `GNUTLS_EMACS_HANDSHAKES_LIMIT' upper limit. Add 988 * gnutls.h: Add `GNUTLS_EMACS_HANDSHAKES_LIMIT' upper limit.
808 convenience `GNUTLS_LOG2i' macro. 989 Add convenience `GNUTLS_LOG2i' macro.
809 990
810 * gnutls.c (gnutls_log_function2i): Convenience log function. 991 * gnutls.c (gnutls_log_function2i): Convenience log function.
811 (emacs_gnutls_read): Use new log functions, 992 (emacs_gnutls_read): Use new log functions,
@@ -891,8 +1072,8 @@
891 (xml_cleanup_parser): New function, export for fn_xmlCleanupParser. 1072 (xml_cleanup_parser): New function, export for fn_xmlCleanupParser.
892 Calls xmlCleanupParser only if libxml2 was loaded (or statically 1073 Calls xmlCleanupParser only if libxml2 was loaded (or statically
893 linked in). 1074 linked in).
894 (Flibxml_parse_html_region, Flibxml_parse_xml_region): Call 1075 (Flibxml_parse_html_region, Flibxml_parse_xml_region):
895 init_libxml2_functions before calling libxml2 functions. 1076 Call init_libxml2_functions before calling libxml2 functions.
896 (syms_of_xml) <Qlibxml2_dll>: DEFSYM it. 1077 (syms_of_xml) <Qlibxml2_dll>: DEFSYM it.
897 1078
898 * emacs.c: Don't include libxml/parser.h. 1079 * emacs.c: Don't include libxml/parser.h.
@@ -2278,7 +2459,7 @@
2278 * xfns.c (unwind_create_frame): Fix comment. 2459 * xfns.c (unwind_create_frame): Fix comment.
2279 (Fx_create_frame, x_create_tip_frame): 2460 (Fx_create_frame, x_create_tip_frame):
2280 Move terminal->reference_count++ just before making the frame 2461 Move terminal->reference_count++ just before making the frame
2281 official. Move initialization of image_cache_refcount and 2462 official. Move initialization of image_cache_refcount and
2282 dpyinfo_refcount before calling init_frame_faces (Bug#9943). 2463 dpyinfo_refcount before calling init_frame_faces (Bug#9943).
2283 2464
22842011-11-05 Eli Zaretskii <eliz@gnu.org> 24652011-11-05 Eli Zaretskii <eliz@gnu.org>
@@ -8051,7 +8232,7 @@
8051 * xfaces.c <Qunspecified>: Make extern again. 8232 * xfaces.c <Qunspecified>: Make extern again.
8052 8233
8053 * syntax.c: Include sys/types.h before including regex.h, as 8234 * syntax.c: Include sys/types.h before including regex.h, as
8054 required by Posix. 8235 required by POSIX.
8055 8236
8056 * doc.c (get_doc_string): Improve the format passed to `error'. 8237 * doc.c (get_doc_string): Improve the format passed to `error'.
8057 8238
@@ -10515,7 +10696,7 @@ See ChangeLog.11 for earlier changes.
10515;; coding: utf-8 10696;; coding: utf-8
10516;; End: 10697;; End:
10517 10698
10518 Copyright (C) 2011-2012 Free Software Foundation, Inc. 10699 Copyright (C) 2011-2012 Free Software Foundation, Inc.
10519 10700
10520 This file is part of GNU Emacs. 10701 This file is part of GNU Emacs.
10521 10702
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10
index 10de7e53794..cf62ec29bbc 100644
--- a/src/ChangeLog.10
+++ b/src/ChangeLog.10
@@ -23215,7 +23215,7 @@
23215 23215
23216 * macterm.c (do_ae_open_documents) [MAC_OSX]: Call FSpMakeFSRef 23216 * macterm.c (do_ae_open_documents) [MAC_OSX]: Call FSpMakeFSRef
23217 and FSRefMakePath to convert FSSpec returned with Apple Event to 23217 and FSRefMakePath to convert FSSpec returned with Apple Event to
23218 Posix pathname. 23218 POSIX pathname.
23219 (mac_initialize) [TARGET_API_MAC_CARBON]: 23219 (mac_initialize) [TARGET_API_MAC_CARBON]:
23220 Call init_required_apple_events and disable the `Quit' menu item 23220 Call init_required_apple_events and disable the `Quit' menu item
23221 provided automatically by the Carbon Toolbox. 23221 provided automatically by the Carbon Toolbox.
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index 97d5a65281a..781027ee8ae 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -9641,7 +9641,7 @@
9641 9641
96422010-03-12 Eli Zaretskii <eliz@gnu.org> 96422010-03-12 Eli Zaretskii <eliz@gnu.org>
9643 9643
9644 These changes remove termcap.c from the build on Posix platforms. 9644 These changes remove termcap.c from the build on POSIX platforms.
9645 * Makefile.in (termcapobj): Move termcap.o from here... 9645 * Makefile.in (termcapobj): Move termcap.o from here...
9646 (MSDOS_OBJ): ...to here. 9646 (MSDOS_OBJ): ...to here.
9647 (termcapobj) [!LIBS_TERMCAP]: Remove specialized value, as it is 9647 (termcapobj) [!LIBS_TERMCAP]: Remove specialized value, as it is
diff --git a/src/ChangeLog.6 b/src/ChangeLog.6
index 91c20681157..3aa1a23818e 100644
--- a/src/ChangeLog.6
+++ b/src/ChangeLog.6
@@ -3236,7 +3236,7 @@
3236 3236
32371995-12-12 Paul Eggert <eggert@twinsun.com> 32371995-12-12 Paul Eggert <eggert@twinsun.com>
3238 3238
3239 * process.c (create_process): Use Posix signal handling to 3239 * process.c (create_process): Use POSIX signal handling to
3240 block signals, if available. If HAVE_VFORK, save and restore 3240 block signals, if available. If HAVE_VFORK, save and restore
3241 signal handlers that the child might change, since in many 3241 signal handlers that the child might change, since in many
3242 systems (e.g. Solaris 2.4) if the child changes the signal 3242 systems (e.g. Solaris 2.4) if the child changes the signal
diff --git a/src/Makefile.in b/src/Makefile.in
index a90fd5841e4..37480f8269d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -68,23 +68,21 @@ OTHER_FILES = @OTHER_FILES@
68PROFILING_CFLAGS = @PROFILING_CFLAGS@ 68PROFILING_CFLAGS = @PROFILING_CFLAGS@
69 69
70## Flags to pass to the compiler to enable build warnings 70## Flags to pass to the compiler to enable build warnings
71C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ 71WARN_CFLAGS = @WARN_CFLAGS@
72WERROR_CFLAGS = @WERROR_CFLAGS@
72 73
73## Machine-specific CFLAGS. 74## Machine-specific CFLAGS.
74C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ 75C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
75## System-specific CFLAGS. 76## System-specific CFLAGS.
76C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ 77C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
77 78
78## Currently only set if NS_IMPL_GNUSTEP. 79GNUSTEP_CFLAGS=@GNUSTEP_CFLAGS@
79## C_SWITCH_X_SITE may override this.
80C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@
81 80
82## Define C_SWITCH_X_SITE to contain any special flags your compiler 81## Define C_SWITCH_X_SITE to contain any special flags your compiler
83## may need to deal with X Windows. For instance, if you've defined 82## may need to deal with X Windows. For instance, if you've defined
84## HAVE_X_WINDOWS and your X include files aren't in a place that your 83## HAVE_X_WINDOWS and your X include files aren't in a place that your
85## compiler can find on its own, you might want to add "-I/..." or 84## compiler can find on its own, you might want to add "-I/..." or
86## something similar. This is normally set by configure. 85## something similar. This is normally set by configure.
87## This is used before C_SWITCH_X_SYSTEM and may override it.
88C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ 86C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
89 87
90## Define LD_SWITCH_X_SITE to contain any special flags your loader 88## Define LD_SWITCH_X_SITE to contain any special flags your loader
@@ -302,19 +300,16 @@ MKDEPDIR=@MKDEPDIR@
302## -DHAVE_CONFIG_H is needed for some other files to take advantage of 300## -DHAVE_CONFIG_H is needed for some other files to take advantage of
303## the information in `config.h'. 301## the information in `config.h'.
304## 302##
305## C_SWITCH_X_SITE must come before C_SWITCH_X_SYSTEM
306## since it may have -I options that should override those.
307##
308## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. 303## FIXME? MYCPPFLAGS only referenced in etc/DEBUG.
309ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \ 304ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \
310 -I$(lib) -I$(srcdir)/../lib \ 305 -I$(lib) -I$(srcdir)/../lib \
311 $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ 306 $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
312 $(C_SWITCH_X_SYSTEM) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ 307 $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
313 $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ 308 $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
314 $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ 309 $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
315 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ 310 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \
316 $(LIBGNUTLS_CFLAGS) \ 311 $(LIBGNUTLS_CFLAGS) \
317 $(C_WARNINGS_SWITCH) $(CFLAGS) 312 $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS)
318ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) 313ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
319 314
320.SUFFIXES: .m 315.SUFFIXES: .m
diff --git a/src/alloc.c b/src/alloc.c
index 27118c91c9c..c07d5c929f9 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -82,6 +82,8 @@ extern POINTER_TYPE *sbrk ();
82 82
83extern size_t _bytes_used; 83extern size_t _bytes_used;
84extern size_t __malloc_extra_blocks; 84extern size_t __malloc_extra_blocks;
85extern void *_malloc_internal (size_t);
86extern void _free_internal (void *);
85 87
86#endif /* not DOUG_LEA_MALLOC */ 88#endif /* not DOUG_LEA_MALLOC */
87 89
@@ -296,7 +298,6 @@ enum mem_type
296 MEM_TYPE_VECTORLIKE 298 MEM_TYPE_VECTORLIKE
297}; 299};
298 300
299static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type);
300static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); 301static POINTER_TYPE *lisp_malloc (size_t, enum mem_type);
301 302
302 303
@@ -315,7 +316,6 @@ static Lisp_Object Vdead;
315#ifdef GC_MALLOC_CHECK 316#ifdef GC_MALLOC_CHECK
316 317
317enum mem_type allocated_mem_type; 318enum mem_type allocated_mem_type;
318static int dont_register_blocks;
319 319
320#endif /* GC_MALLOC_CHECK */ 320#endif /* GC_MALLOC_CHECK */
321 321
@@ -392,8 +392,13 @@ static int live_misc_p (struct mem_node *, void *);
392static void mark_maybe_object (Lisp_Object); 392static void mark_maybe_object (Lisp_Object);
393static void mark_memory (void *, void *); 393static void mark_memory (void *, void *);
394static void mem_init (void); 394static void mem_init (void);
395#if (defined GC_MALLOC_CHECK \
396 ? !defined SYSTEM_MALLOC && !defined SYNC_INPUT \
397 : GC_MARK_STACK)
398# define NEED_MEM_INSERT
395static struct mem_node *mem_insert (void *, void *, enum mem_type); 399static struct mem_node *mem_insert (void *, void *, enum mem_type);
396static void mem_insert_fixup (struct mem_node *); 400static void mem_insert_fixup (struct mem_node *);
401#endif
397static void mem_rotate_left (struct mem_node *); 402static void mem_rotate_left (struct mem_node *);
398static void mem_rotate_right (struct mem_node *); 403static void mem_rotate_right (struct mem_node *);
399static void mem_delete (struct mem_node *); 404static void mem_delete (struct mem_node *);
@@ -938,13 +943,11 @@ lisp_free (POINTER_TYPE *block)
938 MALLOC_UNBLOCK_INPUT; 943 MALLOC_UNBLOCK_INPUT;
939} 944}
940 945
941/* Allocation of aligned blocks of memory to store Lisp data. */ 946/***** Allocation of aligned blocks of memory to store Lisp data. *****/
942/* The entry point is lisp_align_malloc which returns blocks of at most */ 947
943/* BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary. */ 948/* The entry point is lisp_align_malloc which returns blocks of at most
949 BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary. */
944 950
945/* Use posix_memalloc if the system has it and we're using the system's
946 malloc (because our gmalloc.c routines don't have posix_memalign although
947 its memalloc could be used). */
948#if defined (HAVE_POSIX_MEMALIGN) && defined (SYSTEM_MALLOC) 951#if defined (HAVE_POSIX_MEMALIGN) && defined (SYSTEM_MALLOC)
949#define USE_POSIX_MEMALIGN 1 952#define USE_POSIX_MEMALIGN 1
950#endif 953#endif
@@ -1001,7 +1004,7 @@ struct ablocks
1001 struct ablock blocks[ABLOCKS_SIZE]; 1004 struct ablock blocks[ABLOCKS_SIZE];
1002}; 1005};
1003 1006
1004/* Size of the block requested from malloc or memalign. */ 1007/* Size of the block requested from malloc or posix_memalign. */
1005#define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING) 1008#define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING)
1006 1009
1007#define ABLOCK_ABASE(block) \ 1010#define ABLOCK_ABASE(block) \
@@ -1099,7 +1102,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
1099#endif 1102#endif
1100 1103
1101 /* Initialize the blocks and put them on the free list. 1104 /* Initialize the blocks and put them on the free list.
1102 Is `base' was not properly aligned, we can't use the last block. */ 1105 If `base' was not properly aligned, we can't use the last block. */
1103 for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++) 1106 for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++)
1104 { 1107 {
1105 abase->blocks[i].abase = abase; 1108 abase->blocks[i].abase = abase;
@@ -1146,8 +1149,8 @@ lisp_align_free (POINTER_TYPE *block)
1146 ablock->x.next_free = free_ablock; 1149 ablock->x.next_free = free_ablock;
1147 free_ablock = ablock; 1150 free_ablock = ablock;
1148 /* Update busy count. */ 1151 /* Update busy count. */
1149 ABLOCKS_BUSY (abase) = 1152 ABLOCKS_BUSY (abase)
1150 (struct ablocks *) (-2 + (intptr_t) ABLOCKS_BUSY (abase)); 1153 = (struct ablocks *) (-2 + (intptr_t) ABLOCKS_BUSY (abase));
1151 1154
1152 if (2 > (intptr_t) ABLOCKS_BUSY (abase)) 1155 if (2 > (intptr_t) ABLOCKS_BUSY (abase))
1153 { /* All the blocks are free. */ 1156 { /* All the blocks are free. */
@@ -1223,6 +1226,10 @@ static void (*old_free_hook) (void*, const void*);
1223# define BYTES_USED _bytes_used 1226# define BYTES_USED _bytes_used
1224#endif 1227#endif
1225 1228
1229#ifdef GC_MALLOC_CHECK
1230static int dont_register_blocks;
1231#endif
1232
1226static size_t bytes_used_when_reconsidered; 1233static size_t bytes_used_when_reconsidered;
1227 1234
1228/* Value of _bytes_used, when spare_memory was freed. */ 1235/* Value of _bytes_used, when spare_memory was freed. */
@@ -3137,17 +3144,29 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3137 Symbol Allocation 3144 Symbol Allocation
3138 ***********************************************************************/ 3145 ***********************************************************************/
3139 3146
3147/* Like struct Lisp_Symbol, but padded so that the size is a multiple
3148 of the required alignment if LSB tags are used. */
3149
3150union aligned_Lisp_Symbol
3151{
3152 struct Lisp_Symbol s;
3153#ifdef USE_LSB_TAG
3154 unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1)
3155 & -(1 << GCTYPEBITS)];
3156#endif
3157};
3158
3140/* Each symbol_block is just under 1020 bytes long, since malloc 3159/* Each symbol_block is just under 1020 bytes long, since malloc
3141 really allocates in units of powers of two and uses 4 bytes for its 3160 really allocates in units of powers of two and uses 4 bytes for its
3142 own overhead. */ 3161 own overhead. */
3143 3162
3144#define SYMBOL_BLOCK_SIZE \ 3163#define SYMBOL_BLOCK_SIZE \
3145 ((1020 - sizeof (struct symbol_block *)) / sizeof (struct Lisp_Symbol)) 3164 ((1020 - sizeof (struct symbol_block *)) / sizeof (union aligned_Lisp_Symbol))
3146 3165
3147struct symbol_block 3166struct symbol_block
3148{ 3167{
3149 /* Place `symbols' first, to preserve alignment. */ 3168 /* Place `symbols' first, to preserve alignment. */
3150 struct Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE]; 3169 union aligned_Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE];
3151 struct symbol_block *next; 3170 struct symbol_block *next;
3152}; 3171};
3153 3172
@@ -3203,7 +3222,7 @@ Its value and function definition are void, and its property list is nil. */)
3203 symbol_block = new; 3222 symbol_block = new;
3204 symbol_block_index = 0; 3223 symbol_block_index = 0;
3205 } 3224 }
3206 XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index]); 3225 XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index].s);
3207 symbol_block_index++; 3226 symbol_block_index++;
3208 } 3227 }
3209 3228
@@ -3231,16 +3250,28 @@ Its value and function definition are void, and its property list is nil. */)
3231 Marker (Misc) Allocation 3250 Marker (Misc) Allocation
3232 ***********************************************************************/ 3251 ***********************************************************************/
3233 3252
3253/* Like union Lisp_Misc, but padded so that its size is a multiple of
3254 the required alignment when LSB tags are used. */
3255
3256union aligned_Lisp_Misc
3257{
3258 union Lisp_Misc m;
3259#ifdef USE_LSB_TAG
3260 unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1)
3261 & -(1 << GCTYPEBITS)];
3262#endif
3263};
3264
3234/* Allocation of markers and other objects that share that structure. 3265/* Allocation of markers and other objects that share that structure.
3235 Works like allocation of conses. */ 3266 Works like allocation of conses. */
3236 3267
3237#define MARKER_BLOCK_SIZE \ 3268#define MARKER_BLOCK_SIZE \
3238 ((1020 - sizeof (struct marker_block *)) / sizeof (union Lisp_Misc)) 3269 ((1020 - sizeof (struct marker_block *)) / sizeof (union aligned_Lisp_Misc))
3239 3270
3240struct marker_block 3271struct marker_block
3241{ 3272{
3242 /* Place `markers' first, to preserve alignment. */ 3273 /* Place `markers' first, to preserve alignment. */
3243 union Lisp_Misc markers[MARKER_BLOCK_SIZE]; 3274 union aligned_Lisp_Misc markers[MARKER_BLOCK_SIZE];
3244 struct marker_block *next; 3275 struct marker_block *next;
3245}; 3276};
3246 3277
@@ -3285,7 +3316,7 @@ allocate_misc (void)
3285 marker_block_index = 0; 3316 marker_block_index = 0;
3286 total_free_markers += MARKER_BLOCK_SIZE; 3317 total_free_markers += MARKER_BLOCK_SIZE;
3287 } 3318 }
3288 XSETMISC (val, &marker_block->markers[marker_block_index]); 3319 XSETMISC (val, &marker_block->markers[marker_block_index].m);
3289 marker_block_index++; 3320 marker_block_index++;
3290 } 3321 }
3291 3322
@@ -3548,6 +3579,8 @@ mem_find (void *start)
3548} 3579}
3549 3580
3550 3581
3582#ifdef NEED_MEM_INSERT
3583
3551/* Insert a new node into the tree for a block of memory with start 3584/* Insert a new node into the tree for a block of memory with start
3552 address START, end address END, and type TYPE. Value is a 3585 address START, end address END, and type TYPE. Value is a
3553 pointer to the node that was inserted. */ 3586 pointer to the node that was inserted. */
@@ -3695,6 +3728,8 @@ mem_insert_fixup (struct mem_node *x)
3695 mem_root->color = MEM_BLACK; 3728 mem_root->color = MEM_BLACK;
3696} 3729}
3697 3730
3731#endif /* NEED_MEM_INSERT */
3732
3698 3733
3699/* (x) (y) 3734/* (x) (y)
3700 / \ / \ 3735 / \ / \
@@ -6071,22 +6106,22 @@ gc_sweep (void)
6071 for (sblk = symbol_block; sblk; sblk = *sprev) 6106 for (sblk = symbol_block; sblk; sblk = *sprev)
6072 { 6107 {
6073 int this_free = 0; 6108 int this_free = 0;
6074 struct Lisp_Symbol *sym = sblk->symbols; 6109 union aligned_Lisp_Symbol *sym = sblk->symbols;
6075 struct Lisp_Symbol *end = sym + lim; 6110 union aligned_Lisp_Symbol *end = sym + lim;
6076 6111
6077 for (; sym < end; ++sym) 6112 for (; sym < end; ++sym)
6078 { 6113 {
6079 /* Check if the symbol was created during loadup. In such a case 6114 /* Check if the symbol was created during loadup. In such a case
6080 it might be pointed to by pure bytecode which we don't trace, 6115 it might be pointed to by pure bytecode which we don't trace,
6081 so we conservatively assume that it is live. */ 6116 so we conservatively assume that it is live. */
6082 int pure_p = PURE_POINTER_P (XSTRING (sym->xname)); 6117 int pure_p = PURE_POINTER_P (XSTRING (sym->s.xname));
6083 6118
6084 if (!sym->gcmarkbit && !pure_p) 6119 if (!sym->s.gcmarkbit && !pure_p)
6085 { 6120 {
6086 if (sym->redirect == SYMBOL_LOCALIZED) 6121 if (sym->s.redirect == SYMBOL_LOCALIZED)
6087 xfree (SYMBOL_BLV (sym)); 6122 xfree (SYMBOL_BLV (&sym->s));
6088 sym->next = symbol_free_list; 6123 sym->s.next = symbol_free_list;
6089 symbol_free_list = sym; 6124 symbol_free_list = &sym->s;
6090#if GC_MARK_STACK 6125#if GC_MARK_STACK
6091 symbol_free_list->function = Vdead; 6126 symbol_free_list->function = Vdead;
6092#endif 6127#endif
@@ -6096,8 +6131,8 @@ gc_sweep (void)
6096 { 6131 {
6097 ++num_used; 6132 ++num_used;
6098 if (!pure_p) 6133 if (!pure_p)
6099 UNMARK_STRING (XSTRING (sym->xname)); 6134 UNMARK_STRING (XSTRING (sym->s.xname));
6100 sym->gcmarkbit = 0; 6135 sym->s.gcmarkbit = 0;
6101 } 6136 }
6102 } 6137 }
6103 6138
@@ -6109,7 +6144,7 @@ gc_sweep (void)
6109 { 6144 {
6110 *sprev = sblk->next; 6145 *sprev = sblk->next;
6111 /* Unhook from the free list. */ 6146 /* Unhook from the free list. */
6112 symbol_free_list = sblk->symbols[0].next; 6147 symbol_free_list = sblk->symbols[0].s.next;
6113 lisp_free (sblk); 6148 lisp_free (sblk);
6114 } 6149 }
6115 else 6150 else
@@ -6139,22 +6174,22 @@ gc_sweep (void)
6139 6174
6140 for (i = 0; i < lim; i++) 6175 for (i = 0; i < lim; i++)
6141 { 6176 {
6142 if (!mblk->markers[i].u_any.gcmarkbit) 6177 if (!mblk->markers[i].m.u_any.gcmarkbit)
6143 { 6178 {
6144 if (mblk->markers[i].u_any.type == Lisp_Misc_Marker) 6179 if (mblk->markers[i].m.u_any.type == Lisp_Misc_Marker)
6145 unchain_marker (&mblk->markers[i].u_marker); 6180 unchain_marker (&mblk->markers[i].m.u_marker);
6146 /* Set the type of the freed object to Lisp_Misc_Free. 6181 /* Set the type of the freed object to Lisp_Misc_Free.
6147 We could leave the type alone, since nobody checks it, 6182 We could leave the type alone, since nobody checks it,
6148 but this might catch bugs faster. */ 6183 but this might catch bugs faster. */
6149 mblk->markers[i].u_marker.type = Lisp_Misc_Free; 6184 mblk->markers[i].m.u_marker.type = Lisp_Misc_Free;
6150 mblk->markers[i].u_free.chain = marker_free_list; 6185 mblk->markers[i].m.u_free.chain = marker_free_list;
6151 marker_free_list = &mblk->markers[i]; 6186 marker_free_list = &mblk->markers[i].m;
6152 this_free++; 6187 this_free++;
6153 } 6188 }
6154 else 6189 else
6155 { 6190 {
6156 num_used++; 6191 num_used++;
6157 mblk->markers[i].u_any.gcmarkbit = 0; 6192 mblk->markers[i].m.u_any.gcmarkbit = 0;
6158 } 6193 }
6159 } 6194 }
6160 lim = MARKER_BLOCK_SIZE; 6195 lim = MARKER_BLOCK_SIZE;
@@ -6165,7 +6200,7 @@ gc_sweep (void)
6165 { 6200 {
6166 *mprev = mblk->next; 6201 *mprev = mblk->next;
6167 /* Unhook from the free list. */ 6202 /* Unhook from the free list. */
6168 marker_free_list = mblk->markers[0].u_free.chain; 6203 marker_free_list = mblk->markers[0].m.u_free.chain;
6169 lisp_free (mblk); 6204 lisp_free (mblk);
6170 } 6205 }
6171 else 6206 else
@@ -6297,11 +6332,12 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
6297 { 6332 {
6298 for (sblk = symbol_block; sblk; sblk = sblk->next) 6333 for (sblk = symbol_block; sblk; sblk = sblk->next)
6299 { 6334 {
6300 struct Lisp_Symbol *sym = sblk->symbols; 6335 union aligned_Lisp_Symbol *aligned_sym = sblk->symbols;
6301 int bn; 6336 int bn;
6302 6337
6303 for (bn = 0; bn < SYMBOL_BLOCK_SIZE; bn++, sym++) 6338 for (bn = 0; bn < SYMBOL_BLOCK_SIZE; bn++, aligned_sym++)
6304 { 6339 {
6340 struct Lisp_Symbol *sym = &aligned_sym->s;
6305 Lisp_Object val; 6341 Lisp_Object val;
6306 Lisp_Object tem; 6342 Lisp_Object tem;
6307 6343
diff --git a/src/buffer.c b/src/buffer.c
index 8cb68317bed..d3d5bd268a2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2005,10 +2005,6 @@ advance_to_char_boundary (ptrdiff_t byte_pos)
2005 return byte_pos; 2005 return byte_pos;
2006} 2006}
2007 2007
2008#ifdef REL_ALLOC
2009extern void r_alloc_reset_variable (POINTER_TYPE *, POINTER_TYPE *);
2010#endif /* REL_ALLOC */
2011
2012DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, 2008DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2013 1, 1, 0, 2009 1, 1, 0,
2014 doc: /* Swap the text between current buffer and BUFFER. */) 2010 doc: /* Swap the text between current buffer and BUFFER. */)
@@ -4770,13 +4766,6 @@ mmap_realloc (POINTER_TYPE **var, size_t nbytes)
4770 Buffer-text Allocation 4766 Buffer-text Allocation
4771 ***********************************************************************/ 4767 ***********************************************************************/
4772 4768
4773#ifdef REL_ALLOC
4774extern POINTER_TYPE *r_alloc (POINTER_TYPE **, size_t);
4775extern POINTER_TYPE *r_re_alloc (POINTER_TYPE **, size_t);
4776extern void r_alloc_free (POINTER_TYPE **ptr);
4777#endif /* REL_ALLOC */
4778
4779
4780/* Allocate NBYTES bytes for buffer B's text buffer. */ 4769/* Allocate NBYTES bytes for buffer B's text buffer. */
4781 4770
4782static void 4771static void
diff --git a/src/character.h b/src/character.h
index d2a7a11fa56..8a0f2d4c3f6 100644
--- a/src/character.h
+++ b/src/character.h
@@ -316,7 +316,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
316 Note: This macro returns the actual length of the character's 316 Note: This macro returns the actual length of the character's
317 multibyte sequence as it is stored in a buffer or string. The 317 multibyte sequence as it is stored in a buffer or string. The
318 character it returns might have a different codepoint that has a 318 character it returns might have a different codepoint that has a
319 different multibyte sequence of a different legth, due to possible 319 different multibyte sequence of a different length, due to possible
320 unification of CJK characters inside string_char. Therefore do NOT 320 unification of CJK characters inside string_char. Therefore do NOT
321 assume that the length returned by this macro is identical to the 321 assume that the length returned by this macro is identical to the
322 length of the multibyte sequence of the character it returns. */ 322 length of the multibyte sequence of the character it returns. */
diff --git a/src/dired.c b/src/dired.c
index 6eedc824231..38dfa23c1bf 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -1018,6 +1018,45 @@ Comparison is in lexicographic order and case is significant. */)
1018 return Fstring_lessp (Fcar (f1), Fcar (f2)); 1018 return Fstring_lessp (Fcar (f1), Fcar (f2));
1019} 1019}
1020 1020
1021
1022DEFUN ("system-users", Fsystem_users, Ssystem_users, 0, 0, 0,
1023 doc: /* Return a list of user names currently registered in the system.
1024If we don't know how to determine that on this platform, just
1025return a list with one element, taken from `user-real-login-name'. */)
1026 (void)
1027{
1028 Lisp_Object users = Qnil;
1029#if defined HAVE_GETPWENT && defined HAVE_ENDPWENT
1030 struct passwd *pw;
1031
1032 while ((pw = getpwent ()))
1033 users = Fcons (DECODE_SYSTEM (build_string (pw->pw_name)), users);
1034
1035 endpwent ();
1036#endif
1037 if (EQ (users, Qnil))
1038 /* At least current user is always known. */
1039 users = Fcons (Vuser_real_login_name, Qnil);
1040 return users;
1041}
1042
1043DEFUN ("system-groups", Fsystem_groups, Ssystem_groups, 0, 0, 0,
1044 doc: /* Return a list of user group names currently registered in the system.
1045The value may be nil if not supported on this platform. */)
1046 (void)
1047{
1048 Lisp_Object groups = Qnil;
1049#if defined HAVE_GETGRENT && defined HAVE_ENDGRENT
1050 struct group *gr;
1051
1052 while ((gr = getgrent ()))
1053 groups = Fcons (DECODE_SYSTEM (build_string (gr->gr_name)), groups);
1054
1055 endgrent ();
1056#endif
1057 return groups;
1058}
1059
1021void 1060void
1022syms_of_dired (void) 1061syms_of_dired (void)
1023{ 1062{
@@ -1035,6 +1074,8 @@ syms_of_dired (void)
1035 defsubr (&Sfile_name_all_completions); 1074 defsubr (&Sfile_name_all_completions);
1036 defsubr (&Sfile_attributes); 1075 defsubr (&Sfile_attributes);
1037 defsubr (&Sfile_attributes_lessp); 1076 defsubr (&Sfile_attributes_lessp);
1077 defsubr (&Ssystem_users);
1078 defsubr (&Ssystem_groups);
1038 1079
1039 DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions, 1080 DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions,
1040 doc: /* Completion ignores file names ending in any string in this list. 1081 doc: /* Completion ignores file names ending in any string in this list.
diff --git a/src/indent.c b/src/indent.c
index 22b0bb2c668..32533438e2a 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -962,7 +962,8 @@ indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column)
962 return val >= column; 962 return val >= column;
963} 963}
964 964
965DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", 965DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2,
966 "NMove to column: ",
966 doc: /* Move point to column COLUMN in the current line. 967 doc: /* Move point to column COLUMN in the current line.
967Interactively, COLUMN is the value of prefix numeric argument. 968Interactively, COLUMN is the value of prefix numeric argument.
968The column of a character is calculated by adding together the widths 969The column of a character is calculated by adding together the widths
diff --git a/src/keyboard.c b/src/keyboard.c
index bad91ea3f72..79d9e7a18e8 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7200,6 +7200,7 @@ handle_async_input (void)
7200#endif 7200#endif
7201} 7201}
7202 7202
7203#ifdef SYNC_INPUT
7203void 7204void
7204process_pending_signals (void) 7205process_pending_signals (void)
7205{ 7206{
@@ -7207,6 +7208,7 @@ process_pending_signals (void)
7207 handle_async_input (); 7208 handle_async_input ();
7208 do_pending_atimers (); 7209 do_pending_atimers ();
7209} 7210}
7211#endif
7210 7212
7211#ifdef SIGIO /* for entire page */ 7213#ifdef SIGIO /* for entire page */
7212/* Note SIGIO has been undef'd if FIONREAD is missing. */ 7214/* Note SIGIO has been undef'd if FIONREAD is missing. */
@@ -10218,7 +10220,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10218 10220
10219 memset (keybuf, 0, sizeof keybuf); 10221 memset (keybuf, 0, sizeof keybuf);
10220 GCPRO1 (keybuf[0]); 10222 GCPRO1 (keybuf[0]);
10221 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); 10223 gcpro1.nvars = (sizeof keybuf / sizeof (keybuf[0]));
10222 10224
10223 if (NILP (continue_echo)) 10225 if (NILP (continue_echo))
10224 { 10226 {
@@ -10232,7 +10234,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10232 cancel_hourglass (); 10234 cancel_hourglass ();
10233#endif 10235#endif
10234 10236
10235 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), 10237 i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])),
10236 prompt, ! NILP (dont_downcase_last), 10238 prompt, ! NILP (dont_downcase_last),
10237 ! NILP (can_return_switch_frame), 0); 10239 ! NILP (can_return_switch_frame), 0);
10238 10240
@@ -10923,6 +10925,11 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10923 errno = old_errno; 10925 errno = old_errno;
10924} 10926}
10925 10927
10928/* If Emacs is stuck because `inhibit-quit' is true, then keep track
10929 of the number of times C-g has been requested. If C-g is pressed
10930 enough times, then quit anyway. See bug#6585. */
10931static int force_quit_count;
10932
10926/* This routine is called at interrupt level in response to C-g. 10933/* This routine is called at interrupt level in response to C-g.
10927 10934
10928 It is called from the SIGINT handler or kbd_buffer_store_event. 10935 It is called from the SIGINT handler or kbd_buffer_store_event.
@@ -11041,8 +11048,16 @@ handle_interrupt (void)
11041 UNGCPRO; 11048 UNGCPRO;
11042 } 11049 }
11043 else 11050 else
11044 /* Else request quit when it's safe */ 11051 { /* Else request quit when it's safe. */
11045 Vquit_flag = Qt; 11052 if (NILP (Vquit_flag))
11053 force_quit_count = 0;
11054 if (++force_quit_count == 3)
11055 {
11056 immediate_quit = 1;
11057 Vinhibit_quit = Qnil;
11058 }
11059 Vquit_flag = Qt;
11060 }
11046 } 11061 }
11047 11062
11048/* TODO: The longjmp in this call throws the NS event loop integration off, 11063/* TODO: The longjmp in this call throws the NS event loop integration off,
diff --git a/src/lisp.h b/src/lisp.h
index 864346d85c2..66e449b0039 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1139,8 +1139,6 @@ struct Lisp_Symbol
1139 special (with `defvar' etc), and shouldn't be lexically bound. */ 1139 special (with `defvar' etc), and shouldn't be lexically bound. */
1140 unsigned declared_special : 1; 1140 unsigned declared_special : 1;
1141 1141
1142 unsigned spacer : 23;
1143
1144 /* The symbol's name, as a Lisp string. 1142 /* The symbol's name, as a Lisp string.
1145 The name "xname" is used to intentionally break code referring to 1143 The name "xname" is used to intentionally break code referring to
1146 the old field "name" of type pointer to struct Lisp_String. */ 1144 the old field "name" of type pointer to struct Lisp_String. */
@@ -1342,8 +1340,6 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */
1342 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */ 1340 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */
1343 unsigned gcmarkbit : 1; 1341 unsigned gcmarkbit : 1;
1344 int spacer : 15; 1342 int spacer : 15;
1345 /* Make it as long as "Lisp_Free without padding". */
1346 void *fill;
1347}; 1343};
1348 1344
1349struct Lisp_Marker 1345struct Lisp_Marker
@@ -1535,13 +1531,6 @@ struct Lisp_Free
1535 unsigned gcmarkbit : 1; 1531 unsigned gcmarkbit : 1;
1536 int spacer : 15; 1532 int spacer : 15;
1537 union Lisp_Misc *chain; 1533 union Lisp_Misc *chain;
1538#ifdef USE_LSB_TAG
1539 /* Try to make sure that sizeof(Lisp_Misc) preserves TYPEBITS-alignment.
1540 This assumes that Lisp_Marker is the largest of the alternatives and
1541 that Lisp_Misc_Any has the same size as "Lisp_Free w/o padding". */
1542 char padding[((((sizeof (struct Lisp_Marker) - 1) >> GCTYPEBITS) + 1)
1543 << GCTYPEBITS) - sizeof (struct Lisp_Misc_Any)];
1544#endif
1545 }; 1534 };
1546 1535
1547/* To get the type field of a union Lisp_Misc, use XMISCTYPE. 1536/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
@@ -1550,19 +1539,19 @@ struct Lisp_Free
1550union Lisp_Misc 1539union Lisp_Misc
1551 { 1540 {
1552 struct Lisp_Misc_Any u_any; /* Supertype of all Misc types. */ 1541 struct Lisp_Misc_Any u_any; /* Supertype of all Misc types. */
1553 struct Lisp_Free u_free; /* Includes padding to force alignment. */ 1542 struct Lisp_Free u_free;
1554 struct Lisp_Marker u_marker; /* 5 */ 1543 struct Lisp_Marker u_marker;
1555 struct Lisp_Overlay u_overlay; /* 5 */ 1544 struct Lisp_Overlay u_overlay;
1556 struct Lisp_Save_Value u_save_value; /* 3 */ 1545 struct Lisp_Save_Value u_save_value;
1557 }; 1546 };
1558 1547
1559union Lisp_Fwd 1548union Lisp_Fwd
1560 { 1549 {
1561 struct Lisp_Intfwd u_intfwd; /* 2 */ 1550 struct Lisp_Intfwd u_intfwd;
1562 struct Lisp_Boolfwd u_boolfwd; /* 2 */ 1551 struct Lisp_Boolfwd u_boolfwd;
1563 struct Lisp_Objfwd u_objfwd; /* 2 */ 1552 struct Lisp_Objfwd u_objfwd;
1564 struct Lisp_Buffer_Objfwd u_buffer_objfwd; /* 2 */ 1553 struct Lisp_Buffer_Objfwd u_buffer_objfwd;
1565 struct Lisp_Kboard_Objfwd u_kboard_objfwd; /* 2 */ 1554 struct Lisp_Kboard_Objfwd u_kboard_objfwd;
1566 }; 1555 };
1567 1556
1568/* Lisp floating point type */ 1557/* Lisp floating point type */
@@ -2253,7 +2242,7 @@ struct gcpro
2253#define GC_USE_GCPROS_CHECK_ZOMBIES 3 2242#define GC_USE_GCPROS_CHECK_ZOMBIES 3
2254 2243
2255#ifndef GC_MARK_STACK 2244#ifndef GC_MARK_STACK
2256#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE 2245#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
2257#endif 2246#endif
2258 2247
2259/* Whether we do the stack marking manually. */ 2248/* Whether we do the stack marking manually. */
@@ -2876,6 +2865,14 @@ extern void syms_of_alloc (void);
2876extern struct buffer * allocate_buffer (void); 2865extern struct buffer * allocate_buffer (void);
2877extern int valid_lisp_object_p (Lisp_Object); 2866extern int valid_lisp_object_p (Lisp_Object);
2878 2867
2868#ifdef REL_ALLOC
2869/* Defined in ralloc.c */
2870extern void *r_alloc (void **, size_t);
2871extern void r_alloc_free (void **);
2872extern void *r_re_alloc (void **, size_t);
2873extern void r_alloc_reset_variable (void **, void **);
2874#endif
2875
2879/* Defined in chartab.c */ 2876/* Defined in chartab.c */
2880EXFUN (Fmake_char_table, 2); 2877EXFUN (Fmake_char_table, 2);
2881EXFUN (Fset_char_table_parent, 2); 2878EXFUN (Fset_char_table_parent, 2);
diff --git a/src/lisp.mk b/src/lisp.mk
index c082630f717..4895ca40959 100644
--- a/src/lisp.mk
+++ b/src/lisp.mk
@@ -131,6 +131,7 @@ lisp = \
131 $(lispsource)/replace.elc \ 131 $(lispsource)/replace.elc \
132 $(lispsource)/buff-menu.elc \ 132 $(lispsource)/buff-menu.elc \
133 $(lispsource)/fringe.elc \ 133 $(lispsource)/fringe.elc \
134 $(lispsource)/emacs-lisp/regexp-opt.elc \
134 $(lispsource)/image.elc \ 135 $(lispsource)/image.elc \
135 $(lispsource)/international/fontset.elc \ 136 $(lispsource)/international/fontset.elc \
136 $(lispsource)/dnd.elc \ 137 $(lispsource)/dnd.elc \
diff --git a/src/lread.c b/src/lread.c
index 48849cccd2b..a2a18921bdc 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -842,7 +842,7 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun)
842 } 842 }
843 843
844 /* Stop scanning if no colon was found before end marker. */ 844 /* Stop scanning if no colon was found before end marker. */
845 if (!in_file_vars) 845 if (!in_file_vars || ch == '\n' || ch == EOF)
846 break; 846 break;
847 847
848 while (i > 0 && (var[i - 1] == ' ' || var[i - 1] == '\t')) 848 while (i > 0 && (var[i - 1] == ' ' || var[i - 1] == '\t'))
@@ -866,8 +866,7 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun)
866 ch = READCHAR; 866 ch = READCHAR;
867 } 867 }
868 if (! in_file_vars) 868 if (! in_file_vars)
869 /* The value was terminated by an end-marker, which 869 /* The value was terminated by an end-marker, which remove. */
870 remove. */
871 i -= 3; 870 i -= 3;
872 while (i > 0 && (val[i - 1] == ' ' || val[i - 1] == '\t')) 871 while (i > 0 && (val[i - 1] == ' ' || val[i - 1] == '\t'))
873 i--; 872 i--;
diff --git a/src/m/ia64.h b/src/m/ia64.h
index 2ddc2fdfb17..47df94cedd0 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -30,13 +30,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#define EMACS_INT long 30#define EMACS_INT long
31#define pI "l" 31#define pI "l"
32#define EMACS_UINT unsigned long 32#define EMACS_UINT unsigned long
33
34#ifdef REL_ALLOC
35#ifndef _MALLOC_INTERNAL
36/* "char *" because ralloc.c defines it that way. gmalloc.c thinks it
37 is allowed to prototype these as "void *" so we don't prototype in
38 that case. You're right: it stinks! */
39extern char *r_alloc (), *r_re_alloc ();
40extern void r_alloc_free ();
41#endif /* not _MALLOC_INTERNAL */
42#endif /* REL_ALLOC */
diff --git a/src/nsterm.m b/src/nsterm.m
index a45792fd645..7cbaf991311 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6038,11 +6038,15 @@ ns_term_shutdown (int sig)
6038 restrict the height to just one monitor. So we override this. */ 6038 restrict the height to just one monitor. So we override this. */
6039- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen 6039- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
6040{ 6040{
6041 /* When making the frame visible for the first time, we want to 6041 /* When making the frame visible for the first time or if there is just
6042 constrain. Other times not. */ 6042 one screen, we want to constrain. Other times not. */
6043 NSUInteger nr_screens = [[NSScreen screens] count];
6043 struct frame *f = ((EmacsView *)[self delegate])->emacsframe; 6044 struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
6044 NSTRACE (constrainFrameRect); 6045 NSTRACE (constrainFrameRect);
6045 6046
6047 if (nr_screens == 1)
6048 return [super constrainFrameRect:frameRect toScreen:screen];
6049
6046 if (f->output_data.ns->dont_constrain 6050 if (f->output_data.ns->dont_constrain
6047 || ns_menu_bar_should_be_hidden ()) 6051 || ns_menu_bar_should_be_hidden ())
6048 return frameRect; 6052 return frameRect;
diff --git a/src/print.c b/src/print.c
index 868d61ba2f1..92e62520954 100644
--- a/src/print.c
+++ b/src/print.c
@@ -93,14 +93,14 @@ static void print_interval (INTERVAL interval, Lisp_Object printcharfun);
93int print_output_debug_flag EXTERNALLY_VISIBLE = 1; 93int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
94 94
95 95
96/* Low level output routines for characters and strings */ 96/* Low level output routines for characters and strings. */
97 97
98/* Lisp functions to do output using a stream 98/* Lisp functions to do output using a stream
99 must have the stream in a variable called printcharfun 99 must have the stream in a variable called printcharfun
100 and must start with PRINTPREPARE, end with PRINTFINISH, 100 and must start with PRINTPREPARE, end with PRINTFINISH,
101 and use PRINTDECLARE to declare common variables. 101 and use PRINTDECLARE to declare common variables.
102 Use PRINTCHAR to output one character, 102 Use PRINTCHAR to output one character,
103 or call strout to output a block of characters. */ 103 or call strout to output a block of characters. */
104 104
105#define PRINTDECLARE \ 105#define PRINTDECLARE \
106 struct buffer *old = current_buffer; \ 106 struct buffer *old = current_buffer; \
@@ -1122,15 +1122,15 @@ print_preprocess (Lisp_Object obj)
1122 int loop_count = 0; 1122 int loop_count = 0;
1123 Lisp_Object halftail; 1123 Lisp_Object halftail;
1124 1124
1125 /* Give up if we go so deep that print_object will get an error. */
1126 /* See similar code in print_object. */
1127 if (print_depth >= PRINT_CIRCLE)
1128 error ("Apparently circular structure being printed");
1129
1130 /* Avoid infinite recursion for circular nested structure 1125 /* Avoid infinite recursion for circular nested structure
1131 in the case where Vprint_circle is nil. */ 1126 in the case where Vprint_circle is nil. */
1132 if (NILP (Vprint_circle)) 1127 if (NILP (Vprint_circle))
1133 { 1128 {
1129 /* Give up if we go so deep that print_object will get an error. */
1130 /* See similar code in print_object. */
1131 if (print_depth >= PRINT_CIRCLE)
1132 error ("Apparently circular structure being printed");
1133
1134 for (i = 0; i < print_depth; i++) 1134 for (i = 0; i < print_depth; i++)
1135 if (EQ (obj, being_printed[i])) 1135 if (EQ (obj, being_printed[i]))
1136 return; 1136 return;
@@ -1232,7 +1232,7 @@ static void print_check_string_charset_prop (INTERVAL interval, Lisp_Object stri
1232#define PRINT_STRING_NON_CHARSET_FOUND 1 1232#define PRINT_STRING_NON_CHARSET_FOUND 1
1233#define PRINT_STRING_UNSAFE_CHARSET_FOUND 2 1233#define PRINT_STRING_UNSAFE_CHARSET_FOUND 2
1234 1234
1235/* Bitwise or of the above macros. */ 1235/* Bitwise or of the above macros. */
1236static int print_check_string_result; 1236static int print_check_string_result;
1237 1237
1238static void 1238static void
@@ -1315,48 +1315,46 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1315 1315
1316 QUIT; 1316 QUIT;
1317 1317
1318 /* See similar code in print_preprocess. */
1319 if (print_depth >= PRINT_CIRCLE)
1320 error ("Apparently circular structure being printed");
1321
1322 /* Detect circularities and truncate them. */ 1318 /* Detect circularities and truncate them. */
1323 if (PRINT_CIRCLE_CANDIDATE_P (obj)) 1319 if (NILP (Vprint_circle))
1324 { 1320 {
1325 if (NILP (Vprint_circle) && NILP (Vprint_gensym)) 1321 /* Simple but incomplete way. */
1326 { 1322 int i;
1327 /* Simple but incomplete way. */ 1323
1328 int i; 1324 /* See similar code in print_preprocess. */
1329 for (i = 0; i < print_depth; i++) 1325 if (print_depth >= PRINT_CIRCLE)
1330 if (EQ (obj, being_printed[i])) 1326 error ("Apparently circular structure being printed");
1331 { 1327
1332 sprintf (buf, "#%d", i); 1328 for (i = 0; i < print_depth; i++)
1333 strout (buf, -1, -1, printcharfun); 1329 if (EQ (obj, being_printed[i]))
1334 return; 1330 {
1335 } 1331 sprintf (buf, "#%d", i);
1336 being_printed[print_depth] = obj; 1332 strout (buf, -1, -1, printcharfun);
1337 } 1333 return;
1338 else 1334 }
1335 being_printed[print_depth] = obj;
1336 }
1337 else if (PRINT_CIRCLE_CANDIDATE_P (obj))
1338 {
1339 /* With the print-circle feature. */
1340 Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
1341 if (INTEGERP (num))
1339 { 1342 {
1340 /* With the print-circle feature. */ 1343 EMACS_INT n = XINT (num);
1341 Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil); 1344 if (n < 0)
1342 if (INTEGERP (num)) 1345 { /* Add a prefix #n= if OBJ has not yet been printed;
1346 that is, its status field is nil. */
1347 sprintf (buf, "#%"pI"d=", -n);
1348 strout (buf, -1, -1, printcharfun);
1349 /* OBJ is going to be printed. Remember that fact. */
1350 Fputhash (obj, make_number (- n), Vprint_number_table);
1351 }
1352 else
1343 { 1353 {
1344 EMACS_INT n = XINT (num); 1354 /* Just print #n# if OBJ has already been printed. */
1345 if (n < 0) 1355 sprintf (buf, "#%"pI"d#", n);
1346 { /* Add a prefix #n= if OBJ has not yet been printed; 1356 strout (buf, -1, -1, printcharfun);
1347 that is, its status field is nil. */ 1357 return;
1348 sprintf (buf, "#%"pI"d=", -n);
1349 strout (buf, -1, -1, printcharfun);
1350 /* OBJ is going to be printed. Remember that fact. */
1351 Fputhash (obj, make_number (- n), Vprint_number_table);
1352 }
1353 else
1354 {
1355 /* Just print #n# if OBJ has already been printed. */
1356 sprintf (buf, "#%"pI"d#", n);
1357 strout (buf, -1, -1, printcharfun);
1358 return;
1359 }
1360 } 1358 }
1361 } 1359 }
1362 } 1360 }
diff --git a/src/process.c b/src/process.c
index 9ccc77e1d83..a84dac144d8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -120,6 +120,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
120#include "nsterm.h" 120#include "nsterm.h"
121#endif 121#endif
122 122
123/* Work around GCC 4.7.0 bug with strict overflow checking; see
124 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
125 These lines can be removed once the GCC bug is fixed. */
126#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
127# pragma GCC diagnostic ignored "-Wstrict-overflow"
128#endif
129
123Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; 130Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
124Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; 131Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
125Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; 132Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
@@ -1066,7 +1073,9 @@ is more appropriate for saving the process buffer.
1066 1073
1067Binding the variable `inherit-process-coding-system' to non-nil before 1074Binding the variable `inherit-process-coding-system' to non-nil before
1068starting the process is an alternative way of setting the inherit flag 1075starting the process is an alternative way of setting the inherit flag
1069for the process which will run. */) 1076for the process which will run.
1077
1078This function returns FLAG. */)
1070 (register Lisp_Object process, Lisp_Object flag) 1079 (register Lisp_Object process, Lisp_Object flag)
1071{ 1080{
1072 CHECK_PROCESS (process); 1081 CHECK_PROCESS (process);
@@ -1079,7 +1088,8 @@ DEFUN ("set-process-query-on-exit-flag",
1079 2, 2, 0, 1088 2, 2, 0,
1080 doc: /* Specify if query is needed for PROCESS when Emacs is exited. 1089 doc: /* Specify if query is needed for PROCESS when Emacs is exited.
1081If the second argument FLAG is non-nil, Emacs will query the user before 1090If the second argument FLAG is non-nil, Emacs will query the user before
1082exiting or killing a buffer if PROCESS is running. */) 1091exiting or killing a buffer if PROCESS is running. This function
1092returns FLAG. */)
1083 (register Lisp_Object process, Lisp_Object flag) 1093 (register Lisp_Object process, Lisp_Object flag)
1084{ 1094{
1085 CHECK_PROCESS (process); 1095 CHECK_PROCESS (process);
@@ -2521,7 +2531,7 @@ could be "COM1", or "\\\\.\\COM10" for ports higher than COM9 (double
2521the backslashes in strings). 2531the backslashes in strings).
2522 2532
2523:speed SPEED -- (mandatory) is handled by `serial-process-configure', 2533:speed SPEED -- (mandatory) is handled by `serial-process-configure',
2524which is called by `make-serial-process'. 2534which this function calls.
2525 2535
2526:name NAME -- NAME is the name of the process. If NAME is not given, 2536:name NAME -- NAME is the name of the process. If NAME is not given,
2527the value of PORT is used. 2537the value of PORT is used.
@@ -2550,13 +2560,12 @@ but you can send outgoing data. The stopped state is cleared by
2550 2560
2551:plist PLIST -- Install PLIST as the initial plist of the process. 2561:plist PLIST -- Install PLIST as the initial plist of the process.
2552 2562
2553:speed
2554:bytesize 2563:bytesize
2555:parity 2564:parity
2556:stopbits 2565:stopbits
2557:flowcontrol 2566:flowcontrol
2558-- These arguments are handled by `serial-process-configure', which is 2567-- This function calls `serial-process-configure' to handle these
2559called by `make-serial-process'. 2568arguments.
2560 2569
2561The original argument list, possibly modified by later configuration, 2570The original argument list, possibly modified by later configuration,
2562is available via the function `process-contact'. 2571is available via the function `process-contact'.
@@ -2790,7 +2799,7 @@ The stopped state is cleared by `continue-process' and set by
2790:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the 2799:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the
2791process filter are multibyte, otherwise they are unibyte. 2800process filter are multibyte, otherwise they are unibyte.
2792If this keyword is not specified, the strings are multibyte if 2801If this keyword is not specified, the strings are multibyte if
2793`default-enable-multibyte-characters' is non-nil. 2802the default value of `enable-multibyte-characters' is non-nil.
2794 2803
2795:sentinel SENTINEL -- Install SENTINEL as the process sentinel. 2804:sentinel SENTINEL -- Install SENTINEL as the process sentinel.
2796 2805
@@ -4877,16 +4886,23 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
4877 It can't hurt. */ 4886 It can't hurt. */
4878 else if (nread == -1 && errno == EIO) 4887 else if (nread == -1 && errno == EIO)
4879 { 4888 {
4880 /* Don't do anything if only a pty, with no associated 4889 struct Lisp_Process *p = XPROCESS (proc);
4881 process (bug#10933). */ 4890
4882 if (XPROCESS (proc)->pid != -2) { 4891 /* Clear the descriptor now, so we only raise the
4883 /* Clear the descriptor now, so we only raise the signal 4892 signal once. */
4884 once. */ 4893 FD_CLR (channel, &input_wait_mask);
4885 FD_CLR (channel, &input_wait_mask); 4894 FD_CLR (channel, &non_keyboard_wait_mask);
4886 FD_CLR (channel, &non_keyboard_wait_mask); 4895
4887 4896 if (p->pid == -2)
4888 kill (getpid (), SIGCHLD); 4897 {
4889 } 4898 /* If the EIO occurs on a pty, sigchld_handler's
4899 wait3() will not find the process object to
4900 delete. Do it here. */
4901 p->tick = ++process_tick;
4902 p->status = Qfailed;
4903 }
4904 else
4905 kill (getpid (), SIGCHLD);
4890 } 4906 }
4891#endif /* HAVE_PTYS */ 4907#endif /* HAVE_PTYS */
4892 /* If we can detect process termination, don't consider the 4908 /* If we can detect process termination, don't consider the
diff --git a/src/ralloc.c b/src/ralloc.c
index 896ad9f3155..4bb2f240438 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -95,10 +95,8 @@ static int extra_bytes;
95/* Macros for rounding. Note that rounding to any value is possible 95/* Macros for rounding. Note that rounding to any value is possible
96 by changing the definition of PAGE. */ 96 by changing the definition of PAGE. */
97#define PAGE (getpagesize ()) 97#define PAGE (getpagesize ())
98#define ALIGNED(addr) (((unsigned long int) (addr) & (page_size - 1)) == 0)
99#define ROUNDUP(size) (((unsigned long int) (size) + page_size - 1) \ 98#define ROUNDUP(size) (((unsigned long int) (size) + page_size - 1) \
100 & ~(page_size - 1)) 99 & ~(page_size - 1))
101#define ROUND_TO_PAGE(addr) (addr & (~(page_size - 1)))
102 100
103#define MEM_ALIGN sizeof (double) 101#define MEM_ALIGN sizeof (double)
104#define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \ 102#define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \
@@ -151,7 +149,6 @@ typedef struct heap
151} *heap_ptr; 149} *heap_ptr;
152 150
153#define NIL_HEAP ((heap_ptr) 0) 151#define NIL_HEAP ((heap_ptr) 0)
154#define HEAP_PTR_SIZE (sizeof (struct heap))
155 152
156/* This is the first heap object. 153/* This is the first heap object.
157 If we need additional heap objects, each one resides at the beginning of 154 If we need additional heap objects, each one resides at the beginning of
@@ -366,15 +363,6 @@ relinquish (void)
366 } 363 }
367 } 364 }
368} 365}
369
370/* Return the total size in use by relocating allocator,
371 above where malloc gets space. */
372
373long
374r_alloc_size_in_use (void)
375{
376 return (char *) break_value - (char *) virtual_break_value;
377}
378 366
379/* The meat - allocating, freeing, and relocating blocs. */ 367/* The meat - allocating, freeing, and relocating blocs. */
380 368
@@ -748,7 +736,7 @@ free_bloc (bloc_ptr bloc)
748 __morecore hook values - in particular, __default_morecore in the 736 __morecore hook values - in particular, __default_morecore in the
749 GNU malloc package. */ 737 GNU malloc package. */
750 738
751POINTER 739static POINTER
752r_alloc_sbrk (long int size) 740r_alloc_sbrk (long int size)
753{ 741{
754 register bloc_ptr b; 742 register bloc_ptr b;
@@ -1014,52 +1002,6 @@ r_re_alloc (POINTER *ptr, SIZE size)
1014 return *ptr; 1002 return *ptr;
1015} 1003}
1016 1004
1017/* Disable relocations, after making room for at least SIZE bytes
1018 of non-relocatable heap if possible. The relocatable blocs are
1019 guaranteed to hold still until thawed, even if this means that
1020 malloc must return a null pointer. */
1021
1022void
1023r_alloc_freeze (long int size)
1024{
1025 if (! r_alloc_initialized)
1026 r_alloc_init ();
1027
1028 /* If already frozen, we can't make any more room, so don't try. */
1029 if (r_alloc_freeze_level > 0)
1030 size = 0;
1031 /* If we can't get the amount requested, half is better than nothing. */
1032 while (size > 0 && r_alloc_sbrk (size) == 0)
1033 size /= 2;
1034 ++r_alloc_freeze_level;
1035 if (size > 0)
1036 r_alloc_sbrk (-size);
1037}
1038
1039void
1040r_alloc_thaw (void)
1041{
1042
1043 if (! r_alloc_initialized)
1044 r_alloc_init ();
1045
1046 if (--r_alloc_freeze_level < 0)
1047 abort ();
1048
1049 /* This frees all unused blocs. It is not too inefficient, as the resize
1050 and memcpy is done only once. Afterwards, all unreferenced blocs are
1051 already shrunk to zero size. */
1052 if (!r_alloc_freeze_level)
1053 {
1054 bloc_ptr *b = &first_bloc;
1055 while (*b)
1056 if (!(*b)->variable)
1057 free_bloc (*b);
1058 else
1059 b = &(*b)->next;
1060 }
1061}
1062
1063 1005
1064#if defined (emacs) && defined (DOUG_LEA_MALLOC) 1006#if defined (emacs) && defined (DOUG_LEA_MALLOC)
1065 1007
diff --git a/src/regex.c b/src/regex.c
index 0f9150193ec..d16a5148054 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -33,6 +33,19 @@
33 #pragma alloca 33 #pragma alloca
34#endif 34#endif
35 35
36/* Ignore some GCC warnings for now. This section should go away
37 once the Emacs and Gnulib regex code is merged. */
38#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
39# pragma GCC diagnostic ignored "-Wstrict-overflow"
40# ifndef emacs
41# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
42# pragma GCC diagnostic ignored "-Wunused-function"
43# pragma GCC diagnostic ignored "-Wunused-macros"
44# pragma GCC diagnostic ignored "-Wunused-result"
45# pragma GCC diagnostic ignored "-Wunused-variable"
46# endif
47#endif
48
36#ifdef HAVE_CONFIG_H 49#ifdef HAVE_CONFIG_H
37# include <config.h> 50# include <config.h>
38#endif 51#endif
@@ -198,7 +211,7 @@
198 211
199/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */ 212/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
200 213
201void * 214static void *
202xmalloc (size_t size) 215xmalloc (size_t size)
203{ 216{
204 register void *val; 217 register void *val;
@@ -211,7 +224,7 @@ xmalloc (size_t size)
211 return val; 224 return val;
212} 225}
213 226
214void * 227static void *
215xrealloc (void *block, size_t size) 228xrealloc (void *block, size_t size)
216{ 229{
217 register void *val; 230 register void *val;
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index 37b041396f9..354ffda0988 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -75,3 +75,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
75 Emacs currently calls xrealloc on the results of get_current_dir name, 75 Emacs currently calls xrealloc on the results of get_current_dir name,
76 to avoid a crash just use the Emacs implementation for that function. */ 76 to avoid a crash just use the Emacs implementation for that function. */
77#define BROKEN_GET_CURRENT_DIR_NAME 1 77#define BROKEN_GET_CURRENT_DIR_NAME 1
78
79/* Conservative garbage collection has not been tested, so for now
80 play it safe and stick with the old-fashioned way of marking. */
81#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
index 9a371829eaa..9310890351e 100644
--- a/src/s/cygwin.h
+++ b/src/s/cygwin.h
@@ -58,7 +58,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
58 if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) \ 58 if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) \
59 fd = -1; \ 59 fd = -1; \
60 sigsetmask (mask); \ 60 sigsetmask (mask); \
61 emacs_close (dummy); \ 61 if (fd >= 0) \
62 emacs_close (dummy); \
62 } \ 63 } \
63 while (0) 64 while (0)
64 65
@@ -81,16 +82,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
81 82
82#define HAVE_SOCKETS 83#define HAVE_SOCKETS
83 84
84/* vfork() interacts badly with setsid(), causing ptys to fail to
85 change their controlling terminal */
86#define vfork fork
87
88/* This should work (at least when compiling with gcc). But I have no way
89 or intention to verify or even test it. If you encounter a problem with
90 it, feel free to change this setting, but please add a comment here about
91 why it needed to be changed. */
92#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
93
94/* Emacs supplies its own malloc, but glib (part of Gtk+) calls 85/* Emacs supplies its own malloc, but glib (part of Gtk+) calls
95 memalign and on Cygwin, that becomes the Cygwin-supplied memalign. 86 memalign and on Cygwin, that becomes the Cygwin-supplied memalign.
96 As malloc is not the Cygwin malloc, the Cygwin memalign always 87 As malloc is not the Cygwin malloc, the Cygwin memalign always
diff --git a/src/s/darwin.h b/src/s/darwin.h
index 9ac9e91fd9d..7c8e26f46cc 100644
--- a/src/s/darwin.h
+++ b/src/s/darwin.h
@@ -145,6 +145,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
145 It is already a controlling terminal of subprocess, because we did 145 It is already a controlling terminal of subprocess, because we did
146 ioctl TIOCSCTTY. */ 146 ioctl TIOCSCTTY. */
147#define DONT_REOPEN_PTY 147#define DONT_REOPEN_PTY
148
149/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */
150#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
diff --git a/src/s/freebsd.h b/src/s/freebsd.h
index c74605fe366..05be07695cb 100644
--- a/src/s/freebsd.h
+++ b/src/s/freebsd.h
@@ -58,6 +58,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
58/* Tell that garbage collector that setjmp is known to save all 58/* Tell that garbage collector that setjmp is known to save all
59 registers relevant for conservative garbage collection in the jmp_buf. */ 59 registers relevant for conservative garbage collection in the jmp_buf. */
60#define GC_SETJMP_WORKS 1 60#define GC_SETJMP_WORKS 1
61
62/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */
63#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index c1233c0e6ce..d04ea33068a 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -145,7 +145,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
145 || defined __arm__ || defined __powerpc__ || defined __amd64__ \ 145 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
146 || defined __ia64__ || defined __sh__ 146 || defined __ia64__ || defined __sh__
147#define GC_SETJMP_WORKS 1 147#define GC_SETJMP_WORKS 1
148#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
149#ifdef __ia64__ 148#ifdef __ia64__
150#define GC_MARK_SECONDARY_STACK() \ 149#define GC_MARK_SECONDARY_STACK() \
151 do { \ 150 do { \
@@ -155,4 +154,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
155 __builtin_ia64_bsp ()); \ 154 __builtin_ia64_bsp ()); \
156 } while (0) 155 } while (0)
157#endif 156#endif
157#else
158#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
158#endif 159#endif
diff --git a/src/s/gnu.h b/src/s/gnu.h
index 37aaa1357cc..a09e0e824c9 100644
--- a/src/s/gnu.h
+++ b/src/s/gnu.h
@@ -45,6 +45,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#endif /* emacs */ 45#endif /* emacs */
46 46
47#define POSIX_SIGNALS 1 47#define POSIX_SIGNALS 1
48
49/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */
50#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index becb5d3464e..3e25b1bd0d9 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -100,6 +100,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
100 header sections which lose when `static' is defined away, as it is 100 header sections which lose when `static' is defined away, as it is
101 on HP-UX. (You get duplicate symbol errors on linking). */ 101 on HP-UX. (You get duplicate symbol errors on linking). */
102#undef _FILE_OFFSET_BITS 102#undef _FILE_OFFSET_BITS
103
104/* Conservative garbage collection has not been tested, so for now
105 play it safe and stick with the old-fashioned way of marking. */
106#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
103 107
104/* The data segment on this machine always starts at address 0x40000000. */ 108/* The data segment on this machine always starts at address 0x40000000. */
105#define DATA_SEG_BITS 0x40000000 109#define DATA_SEG_BITS 0x40000000
diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h
index 32374498fe7..e5d90c1bd5d 100644
--- a/src/s/irix6-5.h
+++ b/src/s/irix6-5.h
@@ -95,7 +95,6 @@ char *_getpty();
95 95
96/* Tested on Irix 6.5. SCM worked on earlier versions. */ 96/* Tested on Irix 6.5. SCM worked on earlier versions. */
97#define GC_SETJMP_WORKS 1 97#define GC_SETJMP_WORKS 1
98#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
99 98
100 99
101/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which 100/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which
diff --git a/src/s/msdos.h b/src/s/msdos.h
index cde24147c57..add2902d5f3 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -137,4 +137,3 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
137/* Tell the garbage collector that setjmp is known to save all 137/* Tell the garbage collector that setjmp is known to save all
138 registers relevant for conservative garbage collection in the jmp_buf. */ 138 registers relevant for conservative garbage collection in the jmp_buf. */
139#define GC_SETJMP_WORKS 1 139#define GC_SETJMP_WORKS 1
140#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
diff --git a/src/s/netbsd.h b/src/s/netbsd.h
index f25023fb615..ce3b2afa1bb 100644
--- a/src/s/netbsd.h
+++ b/src/s/netbsd.h
@@ -38,6 +38,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38/* Tell that garbage collector that setjmp is known to save all 38/* Tell that garbage collector that setjmp is known to save all
39 registers relevant for conservative garbage collection in the jmp_buf. */ 39 registers relevant for conservative garbage collection in the jmp_buf. */
40#define GC_SETJMP_WORKS 1 40#define GC_SETJMP_WORKS 1
41
42/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */
43#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
diff --git a/src/s/sol2-6.h b/src/s/sol2-6.h
index a9fefcb1992..bb7a9859b7d 100644
--- a/src/s/sol2-6.h
+++ b/src/s/sol2-6.h
@@ -59,4 +59,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
59 } 59 }
60 60
61#define GC_SETJMP_WORKS 1 61#define GC_SETJMP_WORKS 1
62#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
diff --git a/src/s/unixware.h b/src/s/unixware.h
index 22c396a060e..63c36ee40c2 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -50,3 +50,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50 } 50 }
51 51
52#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base) 52#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
53
54/* Conservative garbage collection has not been tested, so for now
55 play it safe and stick with the old-fashioned way of marking. */
56#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
diff --git a/src/sysdep.c b/src/sysdep.c
index 426c6832347..4df1f50a096 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -37,6 +37,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#include "sysselect.h" 37#include "sysselect.h"
38#include "blockinput.h" 38#include "blockinput.h"
39 39
40#ifdef __FreeBSD__
41#include <sys/sysctl.h>
42#include <sys/user.h>
43#include <sys/resource.h> */
44#include <math.h>
45#endif
46
40#ifdef WINDOWSNT 47#ifdef WINDOWSNT
41#define read sys_read 48#define read sys_read
42#define write sys_write 49#define write sys_write
@@ -2530,6 +2537,40 @@ list_system_processes (void)
2530 return proclist; 2537 return proclist;
2531} 2538}
2532 2539
2540#elif defined (__FreeBSD__)
2541
2542Lisp_Object
2543list_system_processes ()
2544{
2545 int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PROC};
2546 size_t len;
2547 struct kinfo_proc *procs;
2548 size_t i;
2549
2550 struct gcpro gcpro1;
2551 Lisp_Object proclist = Qnil;
2552
2553 if (sysctl (mib, 3, NULL, &len, NULL, 0) != 0)
2554 return proclist;
2555
2556 procs = xmalloc (len);
2557 if (sysctl (mib, 3, procs, &len, NULL, 0) != 0)
2558 {
2559 xfree (procs);
2560 return proclist;
2561 }
2562
2563 GCPRO1 (proclist);
2564 len /= sizeof (struct kinfo_proc);
2565 for (i = 0; i < len; i++)
2566 proclist = Fcons (make_fixnum_or_float (procs[i].ki_pid), proclist);
2567 UNGCPRO;
2568
2569 xfree (procs);
2570
2571 return proclist;
2572}
2573
2533/* The WINDOWSNT implementation is in w32.c. 2574/* The WINDOWSNT implementation is in w32.c.
2534 The MSDOS implementation is in dosfns.c. */ 2575 The MSDOS implementation is in dosfns.c. */
2535#elif !defined (WINDOWSNT) && !defined (MSDOS) 2576#elif !defined (WINDOWSNT) && !defined (MSDOS)
@@ -3077,6 +3118,176 @@ system_process_attributes (Lisp_Object pid)
3077 return attrs; 3118 return attrs;
3078} 3119}
3079 3120
3121#elif defined(__FreeBSD__)
3122
3123Lisp_Object
3124system_process_attributes (Lisp_Object pid)
3125{
3126 int proc_id;
3127 int pagesize = getpagesize();
3128 int npages;
3129 int fscale;
3130 struct passwd *pw;
3131 struct group *gr;
3132 char *ttyname;
3133 size_t len;
3134 char args[MAXPATHLEN];
3135 EMACS_TIME t, now;
3136
3137 int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID};
3138 struct kinfo_proc proc;
3139 size_t proclen = sizeof(proc);
3140
3141 struct gcpro gcpro1, gcpro2;
3142 Lisp_Object attrs = Qnil;
3143 Lisp_Object decoded_comm;
3144
3145 CHECK_NUMBER_OR_FLOAT (pid);
3146 proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid);
3147 mib[3] = proc_id;
3148
3149 if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0)
3150 return attrs;
3151
3152 GCPRO2 (attrs, decoded_comm);
3153
3154 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float(proc.ki_uid)), attrs);
3155
3156 BLOCK_INPUT;
3157 pw = getpwuid (proc.ki_uid);
3158 UNBLOCK_INPUT;
3159 if (pw)
3160 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
3161
3162 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float(proc.ki_svgid)), attrs);
3163
3164 BLOCK_INPUT;
3165 gr = getgrgid (proc.ki_svgid);
3166 UNBLOCK_INPUT;
3167 if (gr)
3168 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
3169
3170 decoded_comm = code_convert_string_norecord
3171 (make_unibyte_string (proc.ki_comm, strlen (proc.ki_comm)),
3172 Vlocale_coding_system, 0);
3173
3174 attrs = Fcons (Fcons (Qcomm, decoded_comm), attrs);
3175 {
3176 char state[2] = {'\0', '\0'};
3177 switch (proc.ki_stat)
3178 {
3179 case SRUN:
3180 state[0] = 'R';
3181 break;
3182
3183 case SSLEEP:
3184 state[0] = 'S';
3185 break;
3186
3187 case SLOCK:
3188 state[0] = 'D';
3189 break;
3190
3191 case SZOMB:
3192 state[0] = 'Z';
3193 break;
3194
3195 case SSTOP:
3196 state[0] = 'T';
3197 break;
3198 }
3199 attrs = Fcons (Fcons (Qstate, build_string (state)), attrs);
3200 }
3201
3202 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (proc.ki_ppid)), attrs);
3203 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs);
3204 attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs);
3205
3206 BLOCK_INPUT;
3207 ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR);
3208 UNBLOCK_INPUT;
3209 if (ttyname)
3210 attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs);
3211
3212 attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (proc.ki_tpgid)), attrs);
3213 attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (proc.ki_rusage.ru_minflt)), attrs);
3214 attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (proc.ki_rusage.ru_majflt)), attrs);
3215 attrs = Fcons (Fcons (Qcminflt, make_number (proc.ki_rusage_ch.ru_minflt)), attrs);
3216 attrs = Fcons (Fcons (Qcmajflt, make_number (proc.ki_rusage_ch.ru_majflt)), attrs);
3217
3218#define TIMELIST(ts) \
3219 list3 (make_number (EMACS_SECS (ts) >> 16 & 0xffff), \
3220 make_number (EMACS_SECS (ts) & 0xffff), \
3221 make_number (EMACS_USECS (ts)))
3222
3223 attrs = Fcons (Fcons (Qutime, TIMELIST(proc.ki_rusage.ru_utime)), attrs);
3224 attrs = Fcons (Fcons (Qstime, TIMELIST(proc.ki_rusage.ru_stime)), attrs);
3225 EMACS_ADD_TIME (t, proc.ki_rusage.ru_utime, proc.ki_rusage.ru_stime);
3226 attrs = Fcons (Fcons (Qtime, TIMELIST(t)), attrs);
3227
3228 attrs = Fcons (Fcons (Qcutime, TIMELIST(proc.ki_rusage_ch.ru_utime)), attrs);
3229 attrs = Fcons (Fcons (Qcstime, TIMELIST(proc.ki_rusage_ch.ru_utime)), attrs);
3230 EMACS_ADD_TIME (t, proc.ki_rusage_ch.ru_utime, proc.ki_rusage_ch.ru_stime);
3231 attrs = Fcons (Fcons (Qctime, TIMELIST(t)), attrs);
3232
3233 attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)), attrs);
3234 attrs = Fcons (Fcons (Qpri, make_number (proc.ki_pri.pri_native)), attrs);
3235 attrs = Fcons (Fcons (Qnice, make_number (proc.ki_nice)), attrs);
3236 attrs = Fcons (Fcons (Qstart, TIMELIST(proc.ki_start)), attrs);
3237 attrs = Fcons (Fcons (Qvsize, make_number (proc.ki_size >> 10)), attrs);
3238 attrs = Fcons (Fcons (Qrss, make_number (proc.ki_rssize * pagesize >> 10)), attrs);
3239
3240 EMACS_GET_TIME (now);
3241 EMACS_SUB_TIME (t, now, proc.ki_start);
3242 attrs = Fcons (Fcons (Qetime, TIMELIST(t)), attrs);
3243
3244#undef TIMELIST
3245
3246 len = sizeof(fscale);
3247 if (sysctlbyname ("kern.fscale", &fscale, &len, NULL, 0) == 0)
3248 {
3249 float pcpu;
3250 fixpt_t ccpu;
3251 len = sizeof (ccpu);
3252 if (sysctlbyname ("kern.ccpu", &ccpu, &len, NULL, 0) == 0)
3253 {
3254 pcpu = 100.0 * ((double) proc.ki_pctcpu / fscale)
3255 / (1.0 - exp(proc.ki_swtime * log((double) ccpu / fscale)));
3256 attrs = Fcons (Fcons (Qpcpu, make_fixnum_or_float(pcpu)), attrs);
3257 }
3258 }
3259
3260 len = sizeof(npages);
3261 if (sysctlbyname ("hw.availpages", &npages, &len, NULL, 0) == 0)
3262 {
3263 float pmem = proc.ki_flag & P_INMEM
3264 ? 100.0 * ((float) proc.ki_rssize / npages)
3265 : 0.0;
3266 attrs = Fcons (Fcons (Qpmem, make_fixnum_or_float(pmem)), attrs);
3267 }
3268
3269 mib[2] = KERN_PROC_ARGS;
3270 len = MAXPATHLEN;
3271 if (sysctl (mib, 4, args, &len, NULL, 0) == 0)
3272 {
3273 int i;
3274 for (i = 0; i < len; i++)
3275 {
3276 if (! args[i] && i < len - 1)
3277 args[i] = ' ';
3278 }
3279
3280 decoded_comm = code_convert_string_norecord
3281 (make_unibyte_string (args, strlen (args)),
3282 Vlocale_coding_system, 0);
3283
3284 attrs = Fcons (Fcons (Qargs, decoded_comm), attrs);
3285 }
3286
3287 UNGCPRO;
3288 return attrs;
3289}
3290
3080/* The WINDOWSNT implementation is in w32.c. 3291/* The WINDOWSNT implementation is in w32.c.
3081 The MSDOS implementation is in dosfns.c. */ 3292 The MSDOS implementation is in dosfns.c. */
3082#elif !defined (WINDOWSNT) && !defined (MSDOS) 3293#elif !defined (WINDOWSNT) && !defined (MSDOS)
diff --git a/src/w32.c b/src/w32.c
index 3d3d33453c6..248a91463e8 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -5816,7 +5816,15 @@ w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id)
5816 CHECK_STRING_CAR (dlls); 5816 CHECK_STRING_CAR (dlls);
5817 if ((library_dll = LoadLibrary (SDATA (XCAR (dlls))))) 5817 if ((library_dll = LoadLibrary (SDATA (XCAR (dlls)))))
5818 { 5818 {
5819 found = XCAR (dlls); 5819 char name[MAX_PATH];
5820 DWORD len;
5821
5822 len = GetModuleFileNameA (library_dll, name, sizeof (name));
5823 found = Fcons (XCAR (dlls),
5824 (len > 0)
5825 /* Possibly truncated */
5826 ? make_specified_string (name, -1, len, 1)
5827 : Qnil);
5820 break; 5828 break;
5821 } 5829 }
5822 } 5830 }
diff --git a/src/window.c b/src/window.c
index 7fda1b3bc54..19f27ec5320 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5947,6 +5947,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5947 } 5947 }
5948 else 5948 else
5949 p->pointm = Fcopy_marker (w->pointm, Qnil); 5949 p->pointm = Fcopy_marker (w->pointm, Qnil);
5950 XMARKER (p->pointm)->insertion_type
5951 = !NILP (Vwindow_point_insertion_type);
5950 5952
5951 p->start = Fcopy_marker (w->start, Qnil); 5953 p->start = Fcopy_marker (w->start, Qnil);
5952 p->start_at_line_beg = w->start_at_line_beg; 5954 p->start_at_line_beg = w->start_at_line_beg;
diff --git a/src/xdisp.c b/src/xdisp.c
index d051e88e6bb..43b92bcf536 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4982,7 +4982,7 @@ string_buffer_position_lim (Lisp_Object string,
4982 Lisp_Object limit, prop, pos; 4982 Lisp_Object limit, prop, pos;
4983 int found = 0; 4983 int found = 0;
4984 4984
4985 pos = make_number (from); 4985 pos = make_number (max (from, BEGV));
4986 4986
4987 if (!back_p) /* looking forward */ 4987 if (!back_p) /* looking forward */
4988 { 4988 {
@@ -13697,6 +13697,13 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
13697 comes from a text property, not from an overlay. */ 13697 comes from a text property, not from an overlay. */
13698 int string_from_text_prop = 0; 13698 int string_from_text_prop = 0;
13699 13699
13700 /* Don't even try doing anything if called for a mode-line or
13701 header-line row, since the rest of the code isn't prepared to
13702 deal with such calamities. */
13703 xassert (!row->mode_line_p);
13704 if (row->mode_line_p)
13705 return 0;
13706
13700 /* Skip over glyphs not having an object at the start and the end of 13707 /* Skip over glyphs not having an object at the start and the end of
13701 the row. These are special glyphs like truncation marks on 13708 the row. These are special glyphs like truncation marks on
13702 terminal frames. */ 13709 terminal frames. */
@@ -14917,6 +14924,8 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14917 else if (rc != CURSOR_MOVEMENT_SUCCESS 14924 else if (rc != CURSOR_MOVEMENT_SUCCESS
14918 && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) 14925 && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
14919 { 14926 {
14927 struct glyph_row *row1;
14928
14920 /* If rows are bidi-reordered and point moved, back up 14929 /* If rows are bidi-reordered and point moved, back up
14921 until we find a row that does not belong to a 14930 until we find a row that does not belong to a
14922 continuation line. This is because we must consider 14931 continuation line. This is because we must consider
@@ -14927,24 +14936,28 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14927 /* FIXME: Revisit this when glyph ``spilling'' in 14936 /* FIXME: Revisit this when glyph ``spilling'' in
14928 continuation lines' rows is implemented for 14937 continuation lines' rows is implemented for
14929 bidi-reordered rows. */ 14938 bidi-reordered rows. */
14930 while (MATRIX_ROW_CONTINUATION_LINE_P (row)) 14939 for (row1 = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
14940 MATRIX_ROW_CONTINUATION_LINE_P (row);
14941 --row)
14931 { 14942 {
14932 /* If we hit the beginning of the displayed portion 14943 /* If we hit the beginning of the displayed portion
14933 without finding the first row of a continued 14944 without finding the first row of a continued
14934 line, give up. */ 14945 line, give up. */
14935 if (row <= w->current_matrix->rows) 14946 if (row <= row1)
14936 { 14947 {
14937 rc = CURSOR_MOVEMENT_MUST_SCROLL; 14948 rc = CURSOR_MOVEMENT_MUST_SCROLL;
14938 break; 14949 break;
14939 } 14950 }
14940 xassert (row->enabled_p); 14951 xassert (row->enabled_p);
14941 --row;
14942 } 14952 }
14943 } 14953 }
14944 if (must_scroll) 14954 if (must_scroll)
14945 ; 14955 ;
14946 else if (rc != CURSOR_MOVEMENT_SUCCESS 14956 else if (rc != CURSOR_MOVEMENT_SUCCESS
14947 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) 14957 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
14958 /* Make sure this isn't a header line by any chance, since
14959 then MATRIX_ROW_PARTIALLY_VISIBLE_P might yield non-zero. */
14960 && !row->mode_line_p
14948 && make_cursor_line_fully_visible_p) 14961 && make_cursor_line_fully_visible_p)
14949 { 14962 {
14950 if (PT == MATRIX_ROW_END_CHARPOS (row) 14963 if (PT == MATRIX_ROW_END_CHARPOS (row)
@@ -16613,7 +16626,15 @@ find_last_unchanged_at_beg_row (struct window *w)
16613 continued. */ 16626 continued. */
16614 && !(MATRIX_ROW_END_CHARPOS (row) == first_changed_pos 16627 && !(MATRIX_ROW_END_CHARPOS (row) == first_changed_pos
16615 && (row->continued_p 16628 && (row->continued_p
16616 || row->exact_window_width_line_p))) 16629 || row->exact_window_width_line_p))
16630 /* If ROW->end is beyond ZV, then ROW->end is outdated and
16631 needs to be recomputed, so don't consider this row as
16632 unchanged. This happens when the last line was
16633 bidi-reordered and was killed immediately before this
16634 redisplay cycle. In that case, ROW->end stores the
16635 buffer position of the first visual-order character of
16636 the killed text, which is now beyond ZV. */
16637 && CHARPOS (row->end.pos) <= ZV)
16617 row_found = row; 16638 row_found = row;
16618 16639
16619 /* Stop if last visible row. */ 16640 /* Stop if last visible row. */