projects
/
sbcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More efficient integer division by multiplication
[sbcl.git]
/
src
/
runtime
/
darwin-os.c
diff --git
a/src/runtime/darwin-os.c
b/src/runtime/darwin-os.c
index
63fc6e6
..
5e6642f
100644
(file)
--- a/
src/runtime/darwin-os.c
+++ b/
src/runtime/darwin-os.c
@@
-36,8
+36,6
@@
os_get_runtime_executable_path(int external)
if (_NSGetExecutablePath(path, &size) == -1)
return NULL;
if (_NSGetExecutablePath(path, &size) == -1)
return NULL;
- else
- path[size] = '\0';
return copied_string(path);
}
return copied_string(path);
}
@@
-67,6
+65,7
@@
mach_exception_handler(void *port)
signal handlers run in the relevant thread directly. */
mach_port_t mach_exception_handler_port_set = MACH_PORT_NULL;
signal handlers run in the relevant thread directly. */
mach_port_t mach_exception_handler_port_set = MACH_PORT_NULL;
+mach_port_t current_mach_task = MACH_PORT_NULL;
pthread_t
setup_mach_exception_handling_thread()
pthread_t
setup_mach_exception_handling_thread()
@@
-75,8
+74,10
@@
setup_mach_exception_handling_thread()
pthread_t mach_exception_handling_thread = NULL;
pthread_attr_t attr;
pthread_t mach_exception_handling_thread = NULL;
pthread_attr_t attr;
+ current_mach_task = mach_task_self();
+
/* allocate a mach_port for this process */
/* allocate a mach_port for this process */
- ret = mach_port_allocate(mach_task_self(),
+ ret = mach_port_allocate(current_mach_task,
MACH_PORT_RIGHT_PORT_SET,
&mach_exception_handler_port_set);
MACH_PORT_RIGHT_PORT_SET,
&mach_exception_handler_port_set);
@@
-101,11
+102,11
@@
kern_return_t
mach_thread_init(mach_port_t thread_exception_port)
{
kern_return_t ret;
mach_thread_init(mach_port_t thread_exception_port)
{
kern_return_t ret;
- /* allocate a named port for the thread */
+ mach_port_t current_mach_thread;
+ /* allocate a named port for the thread */
FSHOW((stderr, "Allocating mach port %x\n", thread_exception_port));
FSHOW((stderr, "Allocating mach port %x\n", thread_exception_port));
-
- ret = mach_port_allocate_name(mach_task_self(),
+ ret = mach_port_allocate_name(current_mach_task,
MACH_PORT_RIGHT_RECEIVE,
thread_exception_port);
if (ret) {
MACH_PORT_RIGHT_RECEIVE,
thread_exception_port);
if (ret) {
@@
-113,7
+114,7
@@
mach_thread_init(mach_port_t thread_exception_port)
}
/* establish the right for the thread_exception_port to send messages */
}
/* establish the right for the thread_exception_port to send messages */
- ret = mach_port_insert_right(mach_task_self(),
+ ret = mach_port_insert_right(current_mach_task,
thread_exception_port,
thread_exception_port,
MACH_MSG_TYPE_MAKE_SEND);
thread_exception_port,
thread_exception_port,
MACH_MSG_TYPE_MAKE_SEND);
@@
-121,20
+122,26
@@
mach_thread_init(mach_port_t thread_exception_port)
lose("mach_port_insert_right failed with return_code %d\n", ret);
}
lose("mach_port_insert_right failed with return_code %d\n", ret);
}
- ret = thread_set_exception_ports(mach_thread_self(),
+ current_mach_thread = mach_thread_self();
+ ret = thread_set_exception_ports(current_mach_thread,
EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION,
thread_exception_port,
EXCEPTION_DEFAULT,
THREAD_STATE_NONE);
if (ret) {
EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION,
thread_exception_port,
EXCEPTION_DEFAULT,
THREAD_STATE_NONE);
if (ret) {
- lose("thread_set_exception_port failed with return_code %d\n", ret);
+ lose("thread_set_exception_ports failed with return_code %d\n", ret);
+ }
+
+ ret = mach_port_deallocate (current_mach_task, current_mach_thread);
+ if (ret) {
+ lose("mach_port_deallocate failed with return_code %d\n", ret);
}
}
- ret = mach_port_move_member(mach_task_self(),
+ ret = mach_port_move_member(current_mach_task,
thread_exception_port,
mach_exception_handler_port_set);
if (ret) {
thread_exception_port,
mach_exception_handler_port_set);
if (ret) {
- lose("mach_port_ failed with return_code %d\n", ret);
+ lose("mach_port_move_member failed with return_code %d\n", ret);
}
return ret;
}
return ret;