From f22bc4b5be3bc7c49e92b392192ebd915f116a15 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 18:02:50 +0000 Subject: [PATCH 01/16] header files to stub out types/functions for linux port --- os/base.h | 10 ++++++ os/linux_base.h | 94 +++++++++++++++++++++++++++++++++++++++++++++++++ os/stubs.h | 17 +++++++++ 3 files changed, 121 insertions(+) create mode 100644 os/base.h create mode 100644 os/linux_base.h create mode 100644 os/stubs.h diff --git a/os/base.h b/os/base.h new file mode 100644 index 000000000..cd06dedea --- /dev/null +++ b/os/base.h @@ -0,0 +1,10 @@ +// Stub out Apple internal header file to redirect to linux_base.h. +// Maybe not the best fix in the long run, but avoids having to #ifdef +// the include of in all of the other files.... + +#ifndef __OS_BASE__ +#define __OS_BASE__ + +#include + +#endif diff --git a/os/linux_base.h b/os/linux_base.h new file mode 100644 index 000000000..d3eb363de --- /dev/null +++ b/os/linux_base.h @@ -0,0 +1,94 @@ + +#ifndef __OS_LINUX_BASE__ +#define __OS_LINUX_BASE__ + + +// marker for hacks we have made to make progress +#define __LINUX_PORT_HDD__ 1 + +/* + * Stub out defines for some mach types and related macros + */ + +typedef uint32_t mach_port_t; + +#define MACH_PORT_NULL 0 +#define MACH_PORT_DEAD -1 + + +typedef uint32_t mach_error_t; + +typedef uint32_t dispatch_mach_msg_t; + +typedef uint32_t dispatch_mach_t; + +typedef uint32_t dispatch_mach_reason_t; + +typedef uint32_t mach_vm_size_t; + +typedef uintptr_t mach_vm_address_t; + +typedef struct +{ +} mach_msg_header_t; + + +typedef void (*dispatch_mach_handler_function_t)(void*); +typedef void (*dispatch_mach_msg_destructor_t)(void*); + +/* + * Stub out defines for other missing types + */ + +struct kevent64_s +{ +}; + +/* + * Stub out misc linking and compilation attributes + */ + +#ifdef OS_EXPORT +#undef OS_EXPORT +#endif +#define OS_EXPORT + +#ifdef DISPATCH_EXPORT +#undef DISPATCH_EXPORT +#endif +#define DISPATCH_EXPORT + +#ifdef DISPATCH_NONNULL_ALL +#undef DISPATCH_NONNULL_ALL +#endif +#define DISPATCH_NONNULL_ALL + +#ifdef OS_WARN_RESULT_NEEDS_RELEASE +#undef OS_WARN_RESULT_NEEDS_RELEASE +#endif + +#ifdef OS_WARN_RESULT +#undef OS_WARN_RESULT +#endif +#define OS_WARN_RESULT + +#ifdef OS_NOTHROW +#undef OS_NOTHROW +#endif +#define OS_NOTHROW + + +// NOTE (Dave), these and similar macros come from Availabity.h on OS X +#define __OSX_AVAILABLE_BUT_DEPRECATED(a,b,c,d) // +#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(a,b,c,d,msg) // + + +// Print a warning when an unported code path executes. +#define LINUX_PORT_ERROR() do { printf("LINUX_PORT_ERROR_CALLED %s:%d: %s\n",__FILE__,__LINE__,__FUNCTION__); } while (0) + + +// Functions we are stubbing out +#include + + +#endif /* __OS_LINUX_BASE__ */ diff --git a/os/stubs.h b/os/stubs.h new file mode 100644 index 000000000..d707b9104 --- /dev/null +++ b/os/stubs.h @@ -0,0 +1,17 @@ +#ifndef __OS_STUBS__ +#define __OS_STUBS__ + + + +int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, + void *newp, size_t newlen); + +mach_port_t pthread_mach_thread_np(); + +mach_port_t mach_task_self(); + +void mach_vm_deallocate(mach_port_t, mach_vm_address_t, mach_vm_size_t); + +#endif + + From f013a9933d05b46e03fa49db121e6610282a2e4c Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 18:05:02 +0000 Subject: [PATCH 02/16] ignore autotools and libtool generated files --- .gitignore | 13 +++++++++++++ m4/.gitignore | 5 +++++ src/.gitignore | 4 ++++ 3 files changed, 22 insertions(+) create mode 100644 m4/.gitignore create mode 100644 src/.gitignore diff --git a/.gitignore b/.gitignore index 7c7e9588c..20254db67 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,16 @@ project.xcworkspace Build .build +# build files generated by autotools +Makefile +Makefile.in +config.log +configure +aclocal.m4 +autom4te.cache +config.log +config.status +config +configure +libtool + diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 000000000..38066ddf7 --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,5 @@ +libtool.m4 +ltoptions.m4 +ltsugar.m4 +ltversion.m4 +lt~obsolete.m4 diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 000000000..034f45e4b --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,4 @@ +provider.h +.libs +*.lo + From fdeae8a0fa231b25c43d2217f9d40d4c0c38c4d4 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 18:05:58 +0000 Subject: [PATCH 03/16] guard include of mach.h with HAVE_MACH --- private/voucher_private.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/private/voucher_private.h b/private/voucher_private.h index e4c31a696..8d50c85b5 100644 --- a/private/voucher_private.h +++ b/private/voucher_private.h @@ -400,7 +400,9 @@ dispatch_queue_create_with_accounting_override_voucher(const char *label, * voucher ports directly. */ +#ifdef HAVE_MACH #include +#endif /*! * @function voucher_create_with_mach_msg From 4f9b58c1ed3617fda781dffe85b1cbe28837e912 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 18:06:33 +0000 Subject: [PATCH 04/16] synthesize declarations of missing observer types --- src/inline_internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/inline_internal.h b/src/inline_internal.h index 5cc4cd884..82c2e7466 100644 --- a/src/inline_internal.h +++ b/src/inline_internal.h @@ -513,6 +513,18 @@ _dispatch_queue_get_bound_thread(dispatch_queue_t dq) return dq->dq_thread; } +#if __LINUX_PORT_HDD__ +// START HACK: DAVE. These types are not defined anywhere in libdispatch sources, +// so make something plausible up... +typedef struct dispatch_pthread_root_queue_observer_hooks_s { + void (*queue_will_execute)(dispatch_queue_t); + void (*queue_did_execute)(dispatch_queue_t); +} dispatch_pthread_root_queue_observer_hooks_s; + +typedef struct dispatch_pthread_root_queue_observer_hooks_s * + dispatch_pthread_root_queue_observer_hooks_t; +#endif + DISPATCH_ALWAYS_INLINE static inline dispatch_pthread_root_queue_observer_hooks_t _dispatch_get_pthread_root_queue_observer_hooks(void) From da3b73d2e60d47f705e45c2182094c08fbd5aaaa Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 19:06:27 +0000 Subject: [PATCH 05/16] WIP on stubbing out missing pieces to get code to compile --- os/linux_base.h | 30 ++++++++++++++++++++++++++---- os/stubs.h | 1 + src/init.c | 7 ++++++- src/io.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 74 insertions(+), 7 deletions(-) diff --git a/os/linux_base.h b/os/linux_base.h index d3eb363de..4c03fca2e 100644 --- a/os/linux_base.h +++ b/os/linux_base.h @@ -18,22 +18,27 @@ typedef uint32_t mach_port_t; typedef uint32_t mach_error_t; +typedef uint32_t mach_vm_size_t; + +typedef uint32_t mach_msg_return_t; + +typedef uintptr_t mach_vm_address_t; + typedef uint32_t dispatch_mach_msg_t; typedef uint32_t dispatch_mach_t; typedef uint32_t dispatch_mach_reason_t; -typedef uint32_t mach_vm_size_t; - -typedef uintptr_t mach_vm_address_t; typedef struct { } mach_msg_header_t; -typedef void (*dispatch_mach_handler_function_t)(void*); +typedef void (*dispatch_mach_handler_function_t)(void*, dispatch_mach_reason_t, + dispatch_mach_msg_t, mach_error_t); + typedef void (*dispatch_mach_msg_destructor_t)(void*); /* @@ -42,8 +47,25 @@ typedef void (*dispatch_mach_msg_destructor_t)(void*); struct kevent64_s { + uint64_t ident; + int16_t filter; + uint16_t flags; + uint32_t fflags; + int64_t data; + uint64_t udata; + uint64_t ext[2]; }; +typedef uint32_t voucher_activity_mode_t; + +struct voucher_offsets_s { + uint32_t vo_version; +}; + + +// bogus... +#define PAGE_SIZE 4096 + /* * Stub out misc linking and compilation attributes */ diff --git a/os/stubs.h b/os/stubs.h index d707b9104..8ad0b0c35 100644 --- a/os/stubs.h +++ b/os/stubs.h @@ -12,6 +12,7 @@ mach_port_t mach_task_self(); void mach_vm_deallocate(mach_port_t, mach_vm_address_t, mach_vm_size_t); +char* mach_error_string(mach_msg_return_t); #endif diff --git a/src/init.c b/src/init.c index 3e6226d60..92619e71b 100644 --- a/src/init.c +++ b/src/init.c @@ -162,7 +162,9 @@ const struct dispatch_tsd_indexes_s dispatch_tsd_indexes = { .dti_qos_class_index = dispatch_priority_key, }; #else // DISPATCH_USE_DIRECT_TSD +#ifndef __LINUX_PORT_HDD__ #error Not implemented on this platform +#endif #endif // DISPATCH_USE_DIRECT_TSD // 6618342 Contact the team that owns the Instrument DTrace probe before @@ -1157,7 +1159,10 @@ const struct dispatch_source_type_s _dispatch_source_type_vnode = { .flags = EV_CLEAR|EV_UDATA_SPECIFIC, }, .mask = NOTE_DELETE|NOTE_WRITE|NOTE_EXTEND|NOTE_ATTRIB|NOTE_LINK| - NOTE_RENAME|NOTE_REVOKE + NOTE_RENAME +#if HAVE_DECL_NOTE_REVOKE + |NOTE_REVOKE +#endif #if HAVE_DECL_NOTE_NONE |NOTE_NONE #endif diff --git a/src/io.c b/src/io.c index 0ad5b5373..f9256a710 100644 --- a/src/io.c +++ b/src/io.c @@ -387,9 +387,14 @@ dispatch_io_create_with_path(dispatch_io_type_t type, const char *path, int err = 0; struct stat st; _dispatch_io_syscall_switch_noerr(err, - (path_data->oflag & O_NOFOLLOW) == O_NOFOLLOW || - (path_data->oflag & O_SYMLINK) == O_SYMLINK ? + (path_data->oflag & O_NOFOLLOW) == O_NOFOLLOW +#ifdef __LINUX_PORT_HDD__ + ? lstat(path_data->path, &st) : stat(path_data->path, &st), +#else + || (path_data->oflag & O_SYMLINK) == O_SYMLINK ? + lstat(path_data->path, &st) : stat(path_data->path, &st), +#endif case 0: err = _dispatch_io_validate_type(channel, st.st_mode); break; @@ -1777,17 +1782,37 @@ _dispatch_stream_cleanup_operations(dispatch_stream_t stream, dispatch_operation_t op, tmp; typeof(*stream->operations) *operations; operations = &stream->operations[DISPATCH_IO_RANDOM]; +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + // NOT CORRECT (doesn't support removal during iteration) + TAILQ_FOREACH(op, operations, operation_list) { + if (!channel || op->channel == channel) { + _dispatch_stream_complete_operation(stream, op); + } + } +#else TAILQ_FOREACH_SAFE(op, operations, operation_list, tmp) { if (!channel || op->channel == channel) { _dispatch_stream_complete_operation(stream, op); } } +#endif operations = &stream->operations[DISPATCH_IO_STREAM]; +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + // NOT CORRECT (doesn't support removal during iteration) + TAILQ_FOREACH(op, operations, operation_list) { + if (!channel || op->channel == channel) { + _dispatch_stream_complete_operation(stream, op); + } + } +#else TAILQ_FOREACH_SAFE(op, operations, operation_list, tmp) { if (!channel || op->channel == channel) { _dispatch_stream_complete_operation(stream, op); } } +#endif if (stream->source_running && !_dispatch_stream_operation_avail(stream)) { dispatch_suspend(stream->source); stream->source_running = false; @@ -1799,11 +1824,21 @@ _dispatch_disk_cleanup_operations(dispatch_disk_t disk, dispatch_io_t channel) { // On pick queue dispatch_operation_t op, tmp; +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + // NOT CORRECT (doesn't support removal during iteration) + TAILQ_FOREACH(op, &disk->operations, operation_list) { + if (!channel || op->channel == channel) { + _dispatch_disk_complete_operation(disk, op); + } + } +#else TAILQ_FOREACH_SAFE(op, &disk->operations, operation_list, tmp) { if (!channel || op->channel == channel) { _dispatch_disk_complete_operation(disk, op); } } +#endif } #pragma mark - @@ -2064,6 +2099,9 @@ _dispatch_disk_perform(void *ctxt) static void _dispatch_operation_advise(dispatch_operation_t op, size_t chunk_size) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); +#else int err; struct radvisory advise; // No point in issuing a read advise for the next chunk if we are already @@ -2090,6 +2128,7 @@ _dispatch_operation_advise(dispatch_operation_t op, size_t chunk_size) // TODO: set disk status on error default: (void)dispatch_assume_zero(err); break; ); +#endif } static int From d7fe4b08720d194fe8379f38b41c0130c241ad9b Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 20:48:04 +0000 Subject: [PATCH 06/16] tweaks to get it to compile --- src/queue.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/queue.c b/src/queue.c index 5868e8799..608435f9a 100644 --- a/src/queue.c +++ b/src/queue.c @@ -868,7 +868,7 @@ _dispatch_root_queue_init_pthread_pool(dispatch_root_queue_context_t qc, (void)dispatch_assume(pqc->dpq_thread_mediator.dsema_port); #elif USE_POSIX_SEM /* XXXRW: POSIX semaphores don't support LIFO? */ - int ret = sem_init(&pqc->dpq_thread_mediator.dsema_sem), 0, 0); + int ret = sem_init(&(pqc->dpq_thread_mediator.dsema_sem), 0, 0); (void)dispatch_assume_zero(ret); #endif } @@ -1703,6 +1703,18 @@ _dispatch_queue_specific_queue_dispose(dispatch_queue_specific_queue_t dqsq) { dispatch_queue_specific_t dqs, tmp; +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + // NOT CORRECT (doesn't support removal during iteration) + TAILQ_FOREACH(dqs, &dqsq->dqsq_contexts, dqs_list) { + if (dqs->dqs_destructor) { + dispatch_async_f(_dispatch_get_root_queue( + _DISPATCH_QOS_CLASS_DEFAULT, false), dqs->dqs_ctxt, + dqs->dqs_destructor); + } + free(dqs); + } +#else TAILQ_FOREACH_SAFE(dqs, &dqsq->dqsq_contexts, dqs_list, tmp) { if (dqs->dqs_destructor) { dispatch_async_f(_dispatch_get_root_queue( @@ -1711,6 +1723,7 @@ _dispatch_queue_specific_queue_dispose(dispatch_queue_specific_queue_t dqsq) } free(dqs); } +#endif _dispatch_queue_destroy((dispatch_queue_t)dqsq); } @@ -3020,6 +3033,8 @@ _dispatch_barrier_sync_slow(dispatch_queue_t dq, void (^work)(void)) work = _dispatch_Block_copy(work); func = _dispatch_call_block_and_release; } +#else + } #endif _dispatch_barrier_sync_f(dq, work, func, pp); } From 2ab2c26d6a76273ee05cb5fa26f4eff5ad9d9910 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 21:04:26 +0000 Subject: [PATCH 07/16] slightly suspect changes to get semaphore.c to compile. The existing code was clearly wrong, but this might not be the right way to fix it either... --- src/semaphore.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/semaphore.c b/src/semaphore.c index f356fb876..85ef4231f 100644 --- a/src/semaphore.c +++ b/src/semaphore.c @@ -712,10 +712,10 @@ _dispatch_thread_semaphore_create(void) } return s4; #elif USE_POSIX_SEM - sem_t s4; - int ret = sem_init(&s4, 0, 0); + sem_t* s4 = malloc(sizeof(sem_t)); + int ret = sem_init(s4, 0, 0); DISPATCH_SEMAPHORE_VERIFY_RET(ret); - return s4; + return (_dispatch_thread_semaphore_t)s4; #elif USE_WIN32_SEM HANDLE tmp; while (!dispatch_assume(tmp = CreateSemaphore(NULL, 0, LONG_MAX, NULL))) { @@ -738,8 +738,8 @@ _dispatch_thread_semaphore_dispose(_dispatch_thread_semaphore_t sema) DISPATCH_VERIFY_MIG(kr); DISPATCH_SEMAPHORE_VERIFY_KR(kr); #elif USE_POSIX_SEM - sem_t s4 = (sem_t)sema; - int ret = sem_destroy(&s4); + sem_t *s4 = (sem_t*)sema; + int ret = sem_destroy(s4); DISPATCH_SEMAPHORE_VERIFY_RET(ret); #elif USE_WIN32_SEM // XXX: signal the semaphore? @@ -762,8 +762,8 @@ _dispatch_thread_semaphore_signal(_dispatch_thread_semaphore_t sema) kern_return_t kr = semaphore_signal(s4); DISPATCH_SEMAPHORE_VERIFY_KR(kr); #elif USE_POSIX_SEM - sem_t s4 = (sem_t)sema; - int ret = sem_post(&s4); + sem_t *s4 = (sem_t*)sema; + int ret = sem_post(s4); DISPATCH_SEMAPHORE_VERIFY_RET(ret); #elif USE_WIN32_SEM int ret; @@ -788,10 +788,10 @@ _dispatch_thread_semaphore_wait(_dispatch_thread_semaphore_t sema) } while (slowpath(kr == KERN_ABORTED)); DISPATCH_SEMAPHORE_VERIFY_KR(kr); #elif USE_POSIX_SEM - sem_t s4 = (sem_t)sema; + sem_t *s4 = (sem_t*)sema; int ret; do { - ret = sem_wait(&s4); + ret = sem_wait(s4); } while (slowpath(ret != 0)); DISPATCH_SEMAPHORE_VERIFY_RET(ret); #elif USE_WIN32_SEM From 35984ca0a829b5be4b3be927a8ad744074010bd9 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 21:34:28 +0000 Subject: [PATCH 08/16] WIP on getting code to compile --- os/linux_base.h | 9 +++++++++ src/source.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ src/transform.c | 34 ++++++++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/os/linux_base.h b/os/linux_base.h index 4c03fca2e..f73bf3e54 100644 --- a/os/linux_base.h +++ b/os/linux_base.h @@ -15,6 +15,7 @@ typedef uint32_t mach_port_t; #define MACH_PORT_NULL 0 #define MACH_PORT_DEAD -1 +#define EVFILT_MACHPORT -8 typedef uint32_t mach_error_t; @@ -65,6 +66,14 @@ struct voucher_offsets_s { // bogus... #define PAGE_SIZE 4096 +#define SIZE_T_MAX 0x7fffffff + +#define NOTE_VM_PRESSURE 0 +#define NOTE_ABSOLUTE 0 +#define NOTE_NSECONDS 0 +#define NOTE_LEEWAY 0 +#define NOTE_CRITICAL 0 +#define NOTE_BACKGROUND 0 /* * Stub out misc linking and compilation attributes diff --git a/src/source.c b/src/source.c index dde7db9af..e4b3e02a9 100644 --- a/src/source.c +++ b/src/source.c @@ -1192,9 +1192,17 @@ _dispatch_kevent_merge(_dispatch_kevent_qos_s *ke) dk = (void*)ke->udata; dispatch_assert(dk); +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + // NOT CORRECT (doesn't support removal during iteration) + TAILQ_FOREACH(dri, &dk->dk_sources, dr_list) { + _dispatch_source_merge_kevent(_dispatch_source_from_refs(dri), ke); + } +#else TAILQ_FOREACH_SAFE(dri, &dk->dk_sources, dr_list, dr_next) { _dispatch_source_merge_kevent(_dispatch_source_from_refs(dri), ke); } +#endif } #if DISPATCH_USE_GUARDED_FD_CHANGE_FDGUARD @@ -3094,6 +3102,30 @@ _dispatch_mach_notify_merge(mach_port_t name, uint32_t flag, bool final) unreg = _dispatch_kevent_resume(dk, flag, 0); } DISPATCH_MACH_KEVENT_ARMED(dk) = 0; +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + // NOT CORRECT (doesn't support removal during iteration) + TAILQ_FOREACH(dri, &dk->dk_sources, dr_list) { + dispatch_source_t dsi = _dispatch_source_from_refs(dri); + if (dx_type(dsi) == DISPATCH_MACH_CHANNEL_TYPE) { + dispatch_mach_t dm = (dispatch_mach_t)dsi; + _dispatch_mach_merge_kevent(dm, &kev); + if (unreg && dm->dm_dkev) { + _dispatch_mach_kevent_unregister(dm); + } + } else { + _dispatch_source_merge_kevent(dsi, &kev); + if (unreg) { + _dispatch_source_kevent_unregister(dsi); + } + } + if (!dr_next || DISPATCH_MACH_KEVENT_ARMED(dk)) { + // current merge is last in list (dk might have been freed) + // or it re-armed the notification + return; + } + } +#else TAILQ_FOREACH_SAFE(dri, &dk->dk_sources, dr_list, dr_next) { dispatch_source_t dsi = _dispatch_source_from_refs(dri); if (dx_type(dsi) == DISPATCH_MACH_CHANNEL_TYPE) { @@ -3114,6 +3146,7 @@ _dispatch_mach_notify_merge(mach_port_t name, uint32_t flag, bool final) return; } } +#endif } static kern_return_t @@ -3966,9 +3999,17 @@ _dispatch_mach_disconnect(dispatch_mach_t dm) } if (!TAILQ_EMPTY(&dm->dm_refs->dm_replies)) { dispatch_mach_reply_refs_t dmr, tmp; +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + // NOT CORRECT (doesn't support removal during iteration) + TAILQ_FOREACH(dmr, &dm->dm_refs->dm_replies, dmr_list){ + _dispatch_mach_reply_kevent_unregister(dm, dmr, true); + } +#else TAILQ_FOREACH_SAFE(dmr, &dm->dm_refs->dm_replies, dmr_list, tmp){ _dispatch_mach_reply_kevent_unregister(dm, dmr, true); } +#endif } } @@ -4735,6 +4776,10 @@ _dispatch_source_debug(dispatch_source_t ds, char* buf, size_t bufsiz) static size_t _dispatch_mach_debug_attr(dispatch_mach_t dm, char* buf, size_t bufsiz) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + return (size_t)0; +#else dispatch_queue_t target = dm->do_targetq; return dsnprintf(buf, bufsiz, "target = %s[%p], receive = 0x%x, " "send = 0x%x, send-possible = 0x%x%s, checkin = 0x%x%s, " @@ -4748,10 +4793,15 @@ _dispatch_mach_debug_attr(dispatch_mach_t dm, char* buf, size_t bufsiz) dm->dm_refs->dm_checkin ? " (pending)" : "", dm->dm_refs->dm_sending, dm->dm_refs->dm_disconnect_cnt, (bool)(dm->ds_atomic_flags & DSF_CANCELED)); +#endif } size_t _dispatch_mach_debug(dispatch_mach_t dm, char* buf, size_t bufsiz) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + return (size_t)0; +#else size_t offset = 0; offset += dsnprintf(&buf[offset], bufsiz - offset, "%s[%p] = { ", dm->dq_label && !dm->dm_cancel_handler_called ? dm->dq_label : @@ -4760,6 +4810,7 @@ _dispatch_mach_debug(dispatch_mach_t dm, char* buf, size_t bufsiz) offset += _dispatch_mach_debug_attr(dm, &buf[offset], bufsiz - offset); offset += dsnprintf(&buf[offset], bufsiz - offset, "}"); return offset; +#endif } #if DISPATCH_DEBUG diff --git a/src/transform.c b/src/transform.c index e6fa4017e..98da41fef 100644 --- a/src/transform.c +++ b/src/transform.c @@ -20,7 +20,9 @@ #include "internal.h" +#ifdef __APPLE__ #include +#endif #if defined(__LITTLE_ENDIAN__) #define DISPATCH_DATA_FORMAT_TYPE_UTF16_HOST DISPATCH_DATA_FORMAT_TYPE_UTF16LE @@ -195,19 +197,29 @@ _dispatch_transform_detect_utf(dispatch_data_t data) static uint16_t _dispatch_transform_swap_to_host(uint16_t x, int32_t byteOrder) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + return x; +#else if (byteOrder == OSLittleEndian) { - return OSSwapLittleToHostInt16(x); + return OSSwapLittleToHostInt16(x); } return OSSwapBigToHostInt16(x); +#endif } static uint16_t _dispatch_transform_swap_from_host(uint16_t x, int32_t byteOrder) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + return x; +#else if (byteOrder == OSLittleEndian) { return OSSwapHostToLittleInt16(x); } return OSSwapHostToBigInt16(x); +#endif } #pragma mark - @@ -519,25 +531,45 @@ _dispatch_transform_from_utf16(dispatch_data_t data, int32_t byteOrder) static dispatch_data_t _dispatch_transform_from_utf16le(dispatch_data_t data) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + return (dispatch_data_t)0; +#else return _dispatch_transform_from_utf16(data, OSLittleEndian); +#endif } static dispatch_data_t _dispatch_transform_from_utf16be(dispatch_data_t data) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + return (dispatch_data_t)0; +#else return _dispatch_transform_from_utf16(data, OSBigEndian); +#endif } static dispatch_data_t _dispatch_transform_to_utf16le(dispatch_data_t data) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + return (dispatch_data_t)0; +#else return _dispatch_transform_to_utf16(data, OSLittleEndian); +#endif } static dispatch_data_t _dispatch_transform_to_utf16be(dispatch_data_t data) { +#ifdef __LINUX_PORT_HDD__ + LINUX_PORT_ERROR(); + return (dispatch_data_t)0; +#else return _dispatch_transform_to_utf16(data, OSBigEndian); +#endif } #pragma mark - From efa2a28b8122ff02d0abccae6562260cdb9f22a1 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 21:51:59 +0000 Subject: [PATCH 09/16] ignore .la files --- src/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/.gitignore b/src/.gitignore index 034f45e4b..65f9ee2aa 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,4 +1,5 @@ provider.h .libs *.lo +*.la From 9a39fefeb1f5279bceb3592e01f4a453dbd55355 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 30 Nov 2015 21:52:38 +0000 Subject: [PATCH 10/16] clang on linux just ignores -compatibility_version instead of failing with an unknown error message (despite the fact that ld won't actually understand the argument, so linking will actually fail in the end). This is a hack to generate workable makefiles; it may not be the right fix... --- configure.ac | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 223084c61..7ad785968 100644 --- a/configure.ac +++ b/configure.ac @@ -273,15 +273,17 @@ AS_IF([test "x$dispatch_cv_cc_omit_leaf_fp" != "xno"], [ ]) AC_SUBST([OMIT_LEAF_FP_FLAGS]) -AC_CACHE_CHECK([for darwin linker], [dispatch_cv_ld_darwin], [ - saveLDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -dynamiclib -compatibility_version 1.2.3 -current_version 4.5.6 -dead_strip" - AC_LINK_IFELSE([AC_LANG_PROGRAM([ - extern int foo; int foo;], [foo = 0;])], - [dispatch_cv_ld_darwin="yes"], [dispatch_cv_ld_darwin="no"]) - LDFLAGS="$saveLDFLAGS" +AS_IF([test "x$have_mach" = "xtrue"], [ + AC_CACHE_CHECK([for darwin linker], [dispatch_cv_ld_darwin], [ + saveLDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -dynamiclib -compatibility_version 1.2.3 -current_version 4.5.6 -dead_strip" + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + extern int foo; int foo;], [foo = 0;])], + [dispatch_cv_ld_darwin="yes"], [dispatch_cv_ld_darwin="no"]) + LDFLAGS="$saveLDFLAGS" + ]) ]) -AM_CONDITIONAL(HAVE_DARWIN_LD, [test "x$dispatch_cv_ld_darwin" != "xno"]) +AM_CONDITIONAL(HAVE_DARWIN_LD, [test "x$dispatch_cv_ld_darwin" == "xyes"]) # # Temporary: some versions of clang do not mark __builtin_trap() as From 9f4f1032979f49e7f7102264d9cdac73ae4feea1 Mon Sep 17 00:00:00 2001 From: David Grove Date: Tue, 1 Dec 2015 16:02:11 +0000 Subject: [PATCH 11/16] Update list of header files to be installed for dispatch and os. Move stubs.h to stubs_internal.h and include it from internal.h (so we don't need to install stubs to get a complete set of header files). --- dispatch/Makefile.am | 1 + os/Makefile.am | 4 +++- os/linux_base.h | 4 ---- src/internal.h | 1 + os/stubs.h => src/stubs_internal.h | 7 ++++--- 5 files changed, 9 insertions(+), 8 deletions(-) rename os/stubs.h => src/stubs_internal.h (64%) diff --git a/dispatch/Makefile.am b/dispatch/Makefile.am index 6dc850b21..6233f4c98 100644 --- a/dispatch/Makefile.am +++ b/dispatch/Makefile.am @@ -6,6 +6,7 @@ dispatchdir=$(includedir)/dispatch dispatch_HEADERS= \ base.h \ + block.h \ data.h \ dispatch.h \ group.h \ diff --git a/os/Makefile.am b/os/Makefile.am index 2189f16b1..7d8b994d0 100644 --- a/os/Makefile.am +++ b/os/Makefile.am @@ -5,7 +5,9 @@ osdir=$(includedir)/os os_HEADERS= \ - object.h + object.h \ + base.h \ + linux_base.h noinst_HEADERS= \ object_private.h diff --git a/os/linux_base.h b/os/linux_base.h index f73bf3e54..48ea7d3af 100644 --- a/os/linux_base.h +++ b/os/linux_base.h @@ -118,8 +118,4 @@ struct voucher_offsets_s { #define LINUX_PORT_ERROR() do { printf("LINUX_PORT_ERROR_CALLED %s:%d: %s\n",__FILE__,__LINE__,__FUNCTION__); } while (0) -// Functions we are stubbing out -#include - - #endif /* __OS_LINUX_BASE__ */ diff --git a/src/internal.h b/src/internal.h index 98626c643..e736be479 100644 --- a/src/internal.h +++ b/src/internal.h @@ -82,6 +82,7 @@ #include +#include "stubs_internal.h" #include #include #include diff --git a/os/stubs.h b/src/stubs_internal.h similarity index 64% rename from os/stubs.h rename to src/stubs_internal.h index 8ad0b0c35..d009cae34 100644 --- a/os/stubs.h +++ b/src/stubs_internal.h @@ -1,7 +1,8 @@ -#ifndef __OS_STUBS__ -#define __OS_STUBS__ - +// forward declarations for functions we are stubbing out +// in the intial linux port. +#ifndef __DISPATCH__STUBS__INTERNAL +#define __DISPATCH__STUBS__INTERNAL int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen); From 8d8bb462e8be1e1c1b79f21f5b61863d009c4fde Mon Sep 17 00:00:00 2001 From: David Grove Date: Wed, 2 Dec 2015 01:40:23 +0000 Subject: [PATCH 12/16] stub out missing functions and statics with dummy definitions --- src/Makefile.am | 1 + src/stubs.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/stubs.c diff --git a/src/Makefile.am b/src/Makefile.am index 630a4806d..ee7f1b536 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,6 +15,7 @@ libdispatch_la_SOURCES= \ queue.c \ semaphore.c \ source.c \ + stubs.c \ time.c \ transform.c \ protocol.defs \ diff --git a/src/stubs.c b/src/stubs.c new file mode 100644 index 000000000..6653cc138 --- /dev/null +++ b/src/stubs.c @@ -0,0 +1,48 @@ +#include "pthread.h" + +// void _dispatch_source_type_timer() { } +//void dispatch_source_create() { } +//void dispatch_source_set_event_handler_f() { } +//void dispatch_source_set_timer() { } +//void dispatch_resume() { } +//void dispatch_main() { } +void _voucher_create_accounting_voucher() { } +void pthread_workqueue_attr_destroy_np() { } +void dispatch_timer__program_semaphore() { } +void kqueue() { } +void _dispatch_mach_msg_dispose() { } +void dispatch_timer__wake_semaphore() { } +void _dispatch_mach_probe() { } +void voucher_copy() { } +void _dispatch_block_create() { } +void _dispatch_mach_invoke() { } +void _dispatch_mach_msg_debug() { } +void _dispatch_mach_dispose() { } +void TRASHIT() { } +void _dispatch_mach_msg_invoke() { } +void pthread_workqueue_attr_setovercommit_np() { } +void _dispatch_runloop_queue_probe() { } +void _voucher_thread_cleanup() { } +void _dispatch_continuation_free_to_heap() { } +void _dispatch_runloop_queue_xref_dispose() { } +void pthread_workqueue_attr_setqueuepriority_np() { } +void dispatch_timer__configure_semaphore() { } +void _voucher_init() { } +void strlcpy() { } +void _dispatch_runloop_queue_dispose() { } +void kevent64() { } +void mach_error_string() { } +void pthread_workqueue_additem_np() { } +void _dispatch_block_special_invoke() { } +void _dispatch_continuation_alloc_from_heap() { } +void dispatch_timer__fire_semaphore() { } +void mach_vm_deallocate() { } +void pthread_mach_thread_np() { } +void pthread_workqueue_create_np() { } +void mach_task_self() { } +void pthread_workqueue_attr_init_np() { } +void _voucher_atfork_child() { } +void sysctlbyname() { } + +pthread_key_t dispatch_voucher_key; +pthread_key_t dispatch_pthread_root_queue_observer_hooks_key; From f38ebb9ec0b6319a2bcd3f038d1f5c986b3bad74 Mon Sep 17 00:00:00 2001 From: David Grove Date: Wed, 2 Dec 2015 17:05:57 +0000 Subject: [PATCH 13/16] remove workaround; type now defined in proper header file --- src/inline_internal.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/inline_internal.h b/src/inline_internal.h index 82c2e7466..5cc4cd884 100644 --- a/src/inline_internal.h +++ b/src/inline_internal.h @@ -513,18 +513,6 @@ _dispatch_queue_get_bound_thread(dispatch_queue_t dq) return dq->dq_thread; } -#if __LINUX_PORT_HDD__ -// START HACK: DAVE. These types are not defined anywhere in libdispatch sources, -// so make something plausible up... -typedef struct dispatch_pthread_root_queue_observer_hooks_s { - void (*queue_will_execute)(dispatch_queue_t); - void (*queue_did_execute)(dispatch_queue_t); -} dispatch_pthread_root_queue_observer_hooks_s; - -typedef struct dispatch_pthread_root_queue_observer_hooks_s * - dispatch_pthread_root_queue_observer_hooks_t; -#endif - DISPATCH_ALWAYS_INLINE static inline dispatch_pthread_root_queue_observer_hooks_t _dispatch_get_pthread_root_queue_observer_hooks(void) From a6ede63da17adff79ddbdb3d70ba88b7a663c1d8 Mon Sep 17 00:00:00 2001 From: David Grove Date: Wed, 2 Dec 2015 17:07:16 +0000 Subject: [PATCH 14/16] update stubs and typedefs after merge of pull-request 2 from master --- os/linux_base.h | 9 +++++++++ src/stubs.c | 7 ------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/os/linux_base.h b/os/linux_base.h index 48ea7d3af..e674d89e2 100644 --- a/os/linux_base.h +++ b/os/linux_base.h @@ -31,6 +31,15 @@ typedef uint32_t dispatch_mach_t; typedef uint32_t dispatch_mach_reason_t; +typedef uint32_t voucher_activity_mode_t; + +typedef uint32_t voucher_activity_trace_id_t; + +typedef uint32_t voucher_activity_id_t; + +typedef uint32_t _voucher_activity_buffer_hook_t;; + +typedef uint32_t voucher_activity_flag_t; typedef struct { diff --git a/src/stubs.c b/src/stubs.c index 6653cc138..dec839e00 100644 --- a/src/stubs.c +++ b/src/stubs.c @@ -6,14 +6,12 @@ //void dispatch_source_set_timer() { } //void dispatch_resume() { } //void dispatch_main() { } -void _voucher_create_accounting_voucher() { } void pthread_workqueue_attr_destroy_np() { } void dispatch_timer__program_semaphore() { } void kqueue() { } void _dispatch_mach_msg_dispose() { } void dispatch_timer__wake_semaphore() { } void _dispatch_mach_probe() { } -void voucher_copy() { } void _dispatch_block_create() { } void _dispatch_mach_invoke() { } void _dispatch_mach_msg_debug() { } @@ -22,26 +20,21 @@ void TRASHIT() { } void _dispatch_mach_msg_invoke() { } void pthread_workqueue_attr_setovercommit_np() { } void _dispatch_runloop_queue_probe() { } -void _voucher_thread_cleanup() { } -void _dispatch_continuation_free_to_heap() { } void _dispatch_runloop_queue_xref_dispose() { } void pthread_workqueue_attr_setqueuepriority_np() { } void dispatch_timer__configure_semaphore() { } -void _voucher_init() { } void strlcpy() { } void _dispatch_runloop_queue_dispose() { } void kevent64() { } void mach_error_string() { } void pthread_workqueue_additem_np() { } void _dispatch_block_special_invoke() { } -void _dispatch_continuation_alloc_from_heap() { } void dispatch_timer__fire_semaphore() { } void mach_vm_deallocate() { } void pthread_mach_thread_np() { } void pthread_workqueue_create_np() { } void mach_task_self() { } void pthread_workqueue_attr_init_np() { } -void _voucher_atfork_child() { } void sysctlbyname() { } pthread_key_t dispatch_voucher_key; From 16d8a2cde8521e133c79579ca1fdc412a6dbcf9c Mon Sep 17 00:00:00 2001 From: David Grove Date: Wed, 2 Dec 2015 22:26:40 +0000 Subject: [PATCH 15/16] fix stubbed functions to have the right prototype and abort in their bodies when called --- src/stubs.c | 104 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 68 insertions(+), 36 deletions(-) diff --git a/src/stubs.c b/src/stubs.c index dec839e00..745f9fe1a 100644 --- a/src/stubs.c +++ b/src/stubs.c @@ -1,41 +1,73 @@ +#include + +#include + #include "pthread.h" -// void _dispatch_source_type_timer() { } -//void dispatch_source_create() { } -//void dispatch_source_set_event_handler_f() { } -//void dispatch_source_set_timer() { } -//void dispatch_resume() { } -//void dispatch_main() { } -void pthread_workqueue_attr_destroy_np() { } -void dispatch_timer__program_semaphore() { } -void kqueue() { } -void _dispatch_mach_msg_dispose() { } -void dispatch_timer__wake_semaphore() { } -void _dispatch_mach_probe() { } -void _dispatch_block_create() { } -void _dispatch_mach_invoke() { } -void _dispatch_mach_msg_debug() { } -void _dispatch_mach_dispose() { } -void TRASHIT() { } -void _dispatch_mach_msg_invoke() { } -void pthread_workqueue_attr_setovercommit_np() { } -void _dispatch_runloop_queue_probe() { } -void _dispatch_runloop_queue_xref_dispose() { } -void pthread_workqueue_attr_setqueuepriority_np() { } -void dispatch_timer__configure_semaphore() { } -void strlcpy() { } -void _dispatch_runloop_queue_dispose() { } -void kevent64() { } -void mach_error_string() { } -void pthread_workqueue_additem_np() { } -void _dispatch_block_special_invoke() { } -void dispatch_timer__fire_semaphore() { } -void mach_vm_deallocate() { } -void pthread_mach_thread_np() { } -void pthread_workqueue_create_np() { } -void mach_task_self() { } -void pthread_workqueue_attr_init_np() { } -void sysctlbyname() { } +#define program_invocation_short_name "hi" + +#include "os/base.h" +#include "internal.h" + + +#undef LINUX_PORT_ERROR +#define LINUX_PORT_ERROR() do { printf("LINUX_PORT_ERROR_CALLED %s:%d: %s\n",__FILE__,__LINE__,__FUNCTION__); abort(); } while (0) + +int kqueue() { LINUX_PORT_ERROR(); } + +void _dispatch_mach_msg_dispose() { LINUX_PORT_ERROR(); } + +unsigned long _dispatch_mach_probe(dispatch_mach_t dm) { + LINUX_PORT_ERROR(); +} + +dispatch_block_t _dispatch_block_create(dispatch_block_flags_t flags, + voucher_t voucher, pthread_priority_t priority, + dispatch_block_t block) { + LINUX_PORT_ERROR(); +} + +void _dispatch_mach_invoke() { LINUX_PORT_ERROR(); } + +size_t _dispatch_mach_msg_debug(dispatch_mach_msg_t dmsg, char* buf, size_t bufsiz) { + LINUX_PORT_ERROR(); +} +void _dispatch_mach_dispose() { LINUX_PORT_ERROR(); } +void TRASHIT() { LINUX_PORT_ERROR(); } +void _dispatch_mach_msg_invoke() { LINUX_PORT_ERROR(); } + +unsigned long _dispatch_runloop_queue_probe(dispatch_queue_t dq) { + LINUX_PORT_ERROR(); +} +void _dispatch_runloop_queue_xref_dispose() { LINUX_PORT_ERROR(); } + +void strlcpy() { LINUX_PORT_ERROR(); } +void _dispatch_runloop_queue_dispose() { LINUX_PORT_ERROR(); } +void kevent64() { LINUX_PORT_ERROR(); } +char* mach_error_string(mach_msg_return_t x) { + LINUX_PORT_ERROR(); +} + +void mach_vm_deallocate() { LINUX_PORT_ERROR(); } + +mach_port_t pthread_mach_thread_np() { + return (mach_port_t)pthread_self(); +} + +mach_port_t mach_task_self() { + return (mach_port_t)pthread_self(); +} + +int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) { + LINUX_PORT_ERROR(); +} pthread_key_t dispatch_voucher_key; pthread_key_t dispatch_pthread_root_queue_observer_hooks_key; + +unsigned short dispatch_timer__program_semaphore; +unsigned short dispatch_timer__wake_semaphore; +unsigned short dispatch_timer__fire_semaphore; +unsigned short dispatch_timer__configure_semaphore; +void (*_dispatch_block_special_invoke)(void*); From 650f82a41478749b11353c81d810fdc13b94522b Mon Sep 17 00:00:00 2001 From: David Grove Date: Thu, 3 Dec 2015 01:16:32 +0000 Subject: [PATCH 16/16] license headers on added files --- os/linux_base.h | 17 +++++++++++++++++ src/stubs.c | 29 +++++++++++++++++++++++++++++ src/stubs_internal.h | 18 ++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/os/linux_base.h b/os/linux_base.h index e674d89e2..e6bde00ca 100644 --- a/os/linux_base.h +++ b/os/linux_base.h @@ -1,3 +1,20 @@ +/* + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ #ifndef __OS_LINUX_BASE__ #define __OS_LINUX_BASE__ diff --git a/src/stubs.c b/src/stubs.c index 745f9fe1a..cf425757e 100644 --- a/src/stubs.c +++ b/src/stubs.c @@ -1,3 +1,28 @@ +/* + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + + +/* + * This file contains stubbed out functions we are using during + * the initial linux port. When the port is complete, this file + * should be empty (and thus removed). + */ + #include #include @@ -63,6 +88,10 @@ int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, LINUX_PORT_ERROR(); } +/* + * Stubbed out static data + */ + pthread_key_t dispatch_voucher_key; pthread_key_t dispatch_pthread_root_queue_observer_hooks_key; diff --git a/src/stubs_internal.h b/src/stubs_internal.h index d009cae34..2f3433949 100644 --- a/src/stubs_internal.h +++ b/src/stubs_internal.h @@ -1,3 +1,21 @@ +/* + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + // forward declarations for functions we are stubbing out // in the intial linux port.