annotate src/vdb-posix.c @ 5632:bd80d9103fc8

Integrate CL code better into core, remove obsolete compatibility code. lisp/ChangeLog addition: 2011-12-30 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el: Call #'cl-compile-time-init explicitly here, don't rely on bytecomp-load-hook for what is core functionality. * cl-extra.el: * cl-extra.el (require): * cl-extra.el (make-random-state): * cl-extra.el (random-state-p): * cl-extra.el (make-hashtable): Removed. * cl-extra.el (make-weak-hashtable): Removed. * cl-extra.el (make-key-weak-hashtable): Removed. * cl-extra.el (make-value-weak-hashtable): Removed. * cl-extra.el ('hashtablep): Removed. * cl-extra.el ('hashtable-fullness): Removed. * cl-extra.el ('hashtable-test-function): Removed. * cl-extra.el ('hashtable-type): Removed. * cl-extra.el ('hashtable-size): Removed. * cl-extra.el ('copy-hashtable): Removed. * cl-extra.el (cl-builtin-gethash): Removed. * cl-extra.el (cl-builtin-remhash): Removed. * cl-extra.el (cl-builtin-clrhash): Removed. * cl-extra.el (cl-builtin-maphash): Removed. * cl-extra.el ('cl-gethash): Removed. * cl-extra.el ('cl-puthash): Removed. * cl-extra.el ('cl-remhash): Removed. * cl-extra.el ('cl-clrhash): Removed. * cl-extra.el ('cl-maphash): Removed. * cl-extra.el ('cl-make-hash-table): Removed. * cl-extra.el ('cl-hash-table-p): Removed. * cl-extra.el ('cl-hash-table-count): Removed. * cl-extra.el (cl-prettyexpand): * cl-extra.el (names): Remove compatibility aliases from this file. In #'cl-prettyexpand, if FULL is nil, don't expand return-from either, for symmetry with not expanding block. Drop cl-extra-load-hook, it's useless when cl-extra is dumped (since third-party code can't use it, and dumped code shouldn't use it.) * cl-macs.el: * cl-macs.el (cl-pop2): * cl-macs.el (defun*): * cl-macs.el (cl-parse-loop-clause): Remove some no-longer-needed compatibility kludges. * cl.el: * cl.el ('cl-map-extents): Removed. * cl.el (cl-random-time): * cl.el (list*): New, moved back from subr.el, given a shorter implementation. * cl.el ('cl-member): Removed. * cl.el ('cl-floor): Removed. * cl.el ('cl-ceiling): Removed. * cl.el ('cl-truncate): Removed. * cl.el ('cl-round): Removed. * cl.el ('cl-mod): Removed. Remove some compatibility aliases; these may conflict with package usage, in which case the packages need to be updated, the new names are available in 21.4, and that's the most recent version we support. * cl.el (cl-hacked-flag): Removed. * cl.el (cl-hack-byte-compiler): Removed. * subr.el: * subr.el (list*): Moved back to cl.el. * update-elc-2.el (batch-update-elc-2): * update-elc.el (do-autoload-commands): Add an autoload for cl-compile-time-init in these two files, they run on bare temacs, auto-autoload isn't available to them, and now bytecomp calls cl-compile-time-init explicitly. * cl-compat.el: Removed. This file was long obsolete. man/ChangeLog addition: 2011-12-30 Aidan Kehoe <kehoea@parhasard.net> * cl.texi (Top): * cl.texi (Usage): * cl.texi (Organization): * cl.texi (Efficiency Concerns): * cl.texi (Common Lisp Compatibility): Remove documentation of cl-compat, now it's deleted.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 30 Dec 2011 16:05:31 +0000
parents 308d34e9f07d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
1 /* Virtual diry bit implementation for XEmacs.
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
2 Copyright (C) 2005 Marcus Crestani.
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
3
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
4 This file is part of XEmacs.
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
5
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5091
diff changeset
6 XEmacs is free software: you can redistribute it and/or modify it
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5091
diff changeset
8 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5091
diff changeset
9 option) any later version.
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
10
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
14 for more details.
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
15
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5091
diff changeset
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
18
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
19 /* Synched up with: Not in FSF. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
20
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
21 #include <config.h>
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
22 #include "lisp.h"
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
23 #include "gc.h"
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
24 #include "mc-alloc.h"
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
25 #include "vdb.h"
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
26
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
27 #include <errno.h>
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
28 #include <signal.h>
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
29 #include <sys/mman.h>
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
30
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
31 #if defined (HAVE_SIGACTION)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
32 # if defined (HAVE_STRUCT_SIGINFO_SI_ADDR)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
33 # define FAULT_HANDLER_ARGUMENTS \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
34 int signum, struct siginfo *siginfo, void *UNUSED (ctx)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
35 # define GET_FAULT_ADDRESS siginfo->si_addr
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
36 # elif defined (HAVE_SIGINFO_T_SI_ADDR)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
37 # define FAULT_HANDLER_ARGUMENTS \
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
38 int signum, siginfo_t *siginfo, void *UNUSED (ctx)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
39 # define GET_FAULT_ADDRESS siginfo->si_addr
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
40 # endif
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
41 # define USE_SIGACTION
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
42 # define FAULT_HANDLER_REMOVE_HANDLER
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
43 #elif defined (HAVE_SIGNAL)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
44 # define FAULT_HANDLER_ARGUMENTS int signum, struct sigcontext sc
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
45 # define GET_FAULT_ADDRESS (void *) sc.cr2
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
46 # define USE_SIGNAL
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
47 #endif
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
48
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
49
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
50 #ifdef USE_SIGACTION
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
51 struct sigaction act, segv_oact, bus_oact;
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
52 #endif /* USE_SIGACTION */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
53
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
54 #ifdef USE_SIGNAL
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
55 sighandler_t segv_oact, bus_oact;
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
56 #endif /* USE_SIGNAL */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
57
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
58 void vdb_remove_signal_handler (void);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
59
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
60 void
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
61 vdb_fault_handler (FAULT_HANDLER_ARGUMENTS)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
62 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
63 if (write_barrier_enabled
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
64 && (fault_on_protected_page (GET_FAULT_ADDRESS)))
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
65 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
66 vdb_designate_modified (GET_FAULT_ADDRESS);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
67 unprotect_page_and_mark_dirty (GET_FAULT_ADDRESS);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
68 #ifdef FAULT_HANDLER_REINSTALL_HANDLER
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
69 vdb_install_signal_handler ();
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
70 #endif /* FAULT_HANDLER_REINSTALL_HANDLER */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
71 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
72 else /* default sigsegv handler */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
73 {
5091
ed624ab64583 fix compile errors/warnings
Ben Wing <ben@xemacs.org>
parents: 3519
diff changeset
74 const Ascbyte *signal_name = "";
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
75 if (signum == SIGSEGV)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
76 signal_name = "SIGSEGV";
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
77 else if (signum == SIGBUS)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
78 signal_name = "SIGBUS";
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
79 else
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
80 ABORT (); /* something weird happened: wrong signal caught */
3519
896a34d28b71 [xemacs-hg @ 2006-07-19 19:24:41 by crestani]
crestani
parents: 3462
diff changeset
81 fprintf (stderr, "\n\nFatal Error: Received %s (%d) for address %p\n",
896a34d28b71 [xemacs-hg @ 2006-07-19 19:24:41 by crestani]
crestani
parents: 3462
diff changeset
82 signal_name, signum, (void *) GET_FAULT_ADDRESS);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
83 #ifdef FAULT_HANDLER_CALL_PREVIOUS_HANDLER
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
84 if (signum == SIGSEGV)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
85 segv_oact (signum);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
86 else if (signum == SIGBUS)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
87 bus_oact (signum);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
88 #endif /* FAULT_HANDLER_CALL_PREVIOUS_HANDLER */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
89 #ifdef FAULT_HANDLER_REMOVE_HANDLER
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
90 vdb_remove_signal_handler ();
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
91 #endif /* FAULT_HANDLER_REMOVE_HANDLER */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
92 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
93 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
94
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
95 void
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
96 vdb_remove_signal_handler (void)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
97 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
98 #ifdef USE_SIGACTION
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
99 sigaction(SIGSEGV, &segv_oact, 0);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
100 sigaction(SIGBUS, &bus_oact, 0);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
101 #endif /* USE_SIGACTION */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
102 #ifdef USE_SIGNAL
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
103 signal (SIGSEGV, segv_oact);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
104 signal (SIGBUS, bus_oact);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
105 #endif
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
106 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
107
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
108 void
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
109 vdb_install_signal_handler (void)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
110 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
111 /* See init_signals_very_early () in signal.c. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
112 if (noninteractive && !initialized)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
113 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
114 allow_incremental_gc = 0;
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
115 return;
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
116 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
117
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
118 #ifdef USE_SIGACTION
3307
d81b1754aab1 [xemacs-hg @ 2006-03-27 15:20:28 by crestani]
crestani
parents: 3092
diff changeset
119 memset(&act, 0, sizeof(struct sigaction));
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
120 act.sa_sigaction = vdb_fault_handler;
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
121 sigemptyset (&act.sa_mask);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
122 act.sa_flags = SA_SIGINFO;
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
123 sigaction (SIGSEGV, &act, &segv_oact);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
124 sigaction (SIGBUS, &act, &bus_oact);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
125 allow_incremental_gc = 1;
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
126 #endif /* USE_SIGACTION */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
127 #ifdef USE_SIGNAL
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
128 segv_oact = signal (SIGSEGV, (void (*)(int)) vdb_fault_handler);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
129 bus_oact = signal (SIGBUS, (void (*)(int)) vdb_fault_handler);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
130 #endif /* USE_SIGNAL */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
131 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
132
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
133 void
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
134 vdb_protect (void *ptr, EMACS_INT len)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
135 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
136 if (mprotect (ptr, len, PROT_READ))
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
137 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
138 perror ("Couldn't mprotect");
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
139 ABORT ();
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
140 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
141 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
142
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
143 void
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
144 vdb_unprotect (void *ptr, EMACS_INT len)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
145 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
146 if (mprotect (ptr, len, PROT_READ | PROT_WRITE))
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
147 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
148 perror ("Couldn't mprotect");
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
149 ABORT ();
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
150 }
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents:
diff changeset
151 }