Skip to content

Commit 692cc0f

Browse files
committed
eliminate mach_task_self from linux_stubs
guard stray usage of mach_task_self with #if HAVE_MACH and remove mach_test_self() from linux_stubs.
1 parent 5ad4d2b commit 692cc0f

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

src/data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ _dispatch_data_destroy_buffer(const void* buffer, size_t size,
155155
free((void*)buffer);
156156
} else if (destructor == DISPATCH_DATA_DESTRUCTOR_NONE) {
157157
// do nothing
158+
#if HAVE_MACH
158159
} else if (destructor == DISPATCH_DATA_DESTRUCTOR_VM_DEALLOCATE) {
159160
mach_vm_size_t vm_size = size;
160161
mach_vm_address_t vm_addr = (uintptr_t)buffer;
161162
mach_vm_deallocate(mach_task_self(), vm_addr, vm_size);
163+
#endif
162164
} else {
163165
if (!queue) {
164166
queue = dispatch_get_global_queue(

src/shims/linux_stubs.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ void mach_vm_deallocate() { LINUX_PORT_ERROR(); }
4242
mach_port_t pthread_mach_thread_np(void) {
4343
return (pid_t)syscall(SYS_gettid);
4444
}
45-
mach_port_t mach_task_self(void) {
46-
return (mach_port_t)pthread_self();
47-
}
4845

4946
/*
5047
* Stubbed out static data

src/shims/linux_stubs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ typedef void (*dispatch_mach_handler_function_t)(void*, dispatch_mach_reason_t,
6262

6363
typedef void (*dispatch_mach_msg_destructor_t)(void*);
6464

65-
mach_port_t mach_task_self();
66-
6765
// Print a warning when an unported code path executes.
6866
#define LINUX_PORT_ERROR() do { printf("LINUX_PORT_ERROR_CALLED %s:%d: %s\n",__FILE__,__LINE__,__FUNCTION__); } while (0)
6967

0 commit comments

Comments
 (0)