diff --git a/kernel-include/sys/proc_info.h b/kernel-include/sys/proc_info.h index 381aef8f3..e8ca29c4f 100644 --- a/kernel-include/sys/proc_info.h +++ b/kernel-include/sys/proc_info.h @@ -41,6 +41,7 @@ #include #include #include +#include __BEGIN_DECLS @@ -95,6 +96,37 @@ struct proc_bsdshortinfo { }; +#ifdef PRIVATE +struct proc_uniqidentifierinfo { + uint8_t p_uuid[16]; /* UUID of the main executable */ + uint64_t p_uniqueid; /* 64 bit unique identifier for process */ + uint64_t p_puniqueid; /* unique identifier for process's parent */ + uint64_t p_reserve2; /* reserved for future use */ + uint64_t p_reserve3; /* reserved for future use */ + uint64_t p_reserve4; /* reserved for future use */ +}; + + +struct proc_bsdinfowithuniqid { + struct proc_bsdinfo pbsd; + struct proc_uniqidentifierinfo p_uniqidentifier; +}; + +struct proc_archinfo { + cpu_type_t p_cputype; + cpu_subtype_t p_cpusubtype; +}; + +struct proc_pidcoalitioninfo { + uint64_t coalition_id; + uint64_t reserved1; + uint64_t reserved2; + uint64_t reserved3; +}; + +#endif + + /* pbi_flags values */ #define PROC_FLAG_SYSTEM 1 /* System process */ #define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */ @@ -118,8 +150,15 @@ struct proc_bsdshortinfo { #ifdef PRIVATE #define PROC_FLAG_DARWINBG 0x8000 /* process in darwin background */ #define PROC_FLAG_EXT_DARWINBG 0x10000 /* process in darwin background - external enforcement */ -#define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* Process is apple daemon */ -#define PROC_FLAG_DELAYIDLESLEEP 0x40000 /* Process is marked to delay idle sleep on disk IO */ +#define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* Process is apple daemon */ +#define PROC_FLAG_DELAYIDLESLEEP 0x40000 /* Process is marked to delay idle sleep on disk IO */ +#define PROC_FLAG_IOS_IMPPROMOTION 0x80000 /* Process is daemon which receives importane donation */ +#define PROC_FLAG_ADAPTIVE 0x100000 /* Process is adaptive */ +#define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000 /* Process is adaptive, and is currently important */ +#define PROC_FLAG_IMPORTANCE_DONOR 0x400000 /* Process is marked as an importance donor */ +#define PROC_FLAG_SUPPRESSED 0x800000 /* Process is suppressed */ +#define PROC_FLAG_APPLICATION 0x1000000 /* Process is an application */ +#define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */ #endif @@ -240,12 +279,18 @@ struct proc_fileinfo { uint32_t fi_status; off_t fi_offset; int32_t fi_type; - int32_t rfu_1; /* reserved */ + uint32_t fi_guardflags; }; /* stats flags in proc_fileinfo */ #define PROC_FP_SHARED 1 /* shared by more than one fd */ #define PROC_FP_CLEXEC 2 /* close on exec */ +#define PROC_FP_GUARDED 4 /* guarded fd */ + +#define PROC_FI_GUARD_CLOSE (1u << 0) +#define PROC_FI_GUARD_DUP (1u << 1) +#define PROC_FI_GUARD_SOCKET_IPC (1u << 2) +#define PROC_FI_GUARD_FILEPORT (1u << 3) /* * A copy of stat64 with static sized fields. @@ -647,6 +692,36 @@ struct proc_fileportinfo { #define PROC_PIDTHREADID64INFO 15 #define PROC_PIDTHREADID64INFO_SIZE (sizeof(struct proc_threadinfo)) +#define PROC_PID_RUSAGE 16 +#define PROC_PID_RUSAGE_SIZE 0 + +#ifdef PRIVATE +#define PROC_PIDUNIQIDENTIFIERINFO 17 +#define PROC_PIDUNIQIDENTIFIERINFO_SIZE \ + (sizeof(struct proc_uniqidentifierinfo)) + +#define PROC_PIDT_BSDINFOWITHUNIQID 18 +#define PROC_PIDT_BSDINFOWITHUNIQID_SIZE \ + (sizeof(struct proc_bsdinfowithuniqid)) + +#define PROC_PIDARCHINFO 19 +#define PROC_PIDARCHINFO_SIZE \ + (sizeof(struct proc_archinfo)) + +#define PROC_PIDCOALITIONINFO 20 +#define PROC_PIDCOALITIONINFO_SIZE (sizeof(struct proc_pidcoalitioninfo)) + +#define PROC_PIDNOTEEXIT 21 +#define PROC_PIDNOTEEXIT_SIZE (sizeof(uint32_t)) + +#define PROC_PIDREGIONPATHINFO2 22 +#define PROC_PIDREGIONPATHINFO2_SIZE (sizeof(struct proc_regionwithpathinfo)) + +#define PROC_PIDREGIONPATHINFO3 23 +#define PROC_PIDREGIONPATHINFO3_SIZE (sizeof(struct proc_regionwithpathinfo)) + +#endif + /* Flavors for proc_pidfdinfo */ #define PROC_PIDFDVNODEINFO 1 @@ -702,17 +777,42 @@ struct proc_fileportinfo { #define PROC_DIRTYCONTROL_TRACK 1 #define PROC_DIRTYCONTROL_SET 2 #define PROC_DIRTYCONTROL_GET 3 +#define PROC_DIRTYCONTROL_CLEAR 4 /* proc_track_dirty() flags */ #define PROC_DIRTY_TRACK 0x1 #define PROC_DIRTY_ALLOW_IDLE_EXIT 0x2 - -#define PROC_DIRTY_TRACK_MASK (PROC_DIRTY_TRACK|PROC_DIRTY_ALLOW_IDLE_EXIT) +#define PROC_DIRTY_DEFER 0x4 +#define PROC_DIRTY_LAUNCH_IN_PROGRESS 0x8 /* proc_get_dirty() flags */ #define PROC_DIRTY_TRACKED 0x1 #define PROC_DIRTY_ALLOWS_IDLE_EXIT 0x2 -#define PROC_DIRTY_IS_DIRTY 0x4 +#define PROC_DIRTY_IS_DIRTY 0x4 +#define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8 + +#ifdef PRIVATE + +/* Flavors for proc_pidoriginatorinfo */ +#define PROC_PIDORIGINATOR_UUID 0x1 +#define PROC_PIDORIGINATOR_UUID_SIZE (sizeof(uuid_t)) + +#define PROC_PIDORIGINATOR_BGSTATE 0x2 +#define PROC_PIDORIGINATOR_BGSTATE_SIZE (sizeof(uint32_t)) + +/* __proc_info() call numbers */ +#define PROC_INFO_CALL_LISTPIDS 0x1 +#define PROC_INFO_CALL_PIDINFO 0x2 +#define PROC_INFO_CALL_PIDFDINFO 0x3 +#define PROC_INFO_CALL_KERNMSGBUF 0x4 +#define PROC_INFO_CALL_SETCONTROL 0x5 +#define PROC_INFO_CALL_PIDFILEPORTINFO 0x6 +#define PROC_INFO_CALL_TERMINATE 0x7 +#define PROC_INFO_CALL_DIRTYCONTROL 0x8 +#define PROC_INFO_CALL_PIDRUSAGE 0x9 +#define PROC_INFO_CALL_PIDORIGINATORINFO 0xa + +#endif /* PRIVATE */ #ifdef XNU_KERNEL_PRIVATE #ifndef pshmnode diff --git a/kernel-include/sys/process_policy.h b/kernel-include/sys/process_policy.h index d9ad48272..4aec9e13e 100644 --- a/kernel-include/sys/process_policy.h +++ b/kernel-include/sys/process_policy.h @@ -34,6 +34,10 @@ #include #include +#ifndef XNU_KERNEL_PRIVATE +#include +#endif + __BEGIN_DECLS /* defns of scope */ @@ -52,6 +56,8 @@ __BEGIN_DECLS #define PROC_POLICY_ACTION_GET 11 /* get the policy attributes */ #define PROC_POLICY_ACTION_ADD 12 /* add a policy attribute */ #define PROC_POLICY_ACTION_REMOVE 13 /* remove a policy attribute */ +#define PROC_POLICY_ACTION_HOLD 14 /* hold an importance boost assertion */ +#define PROC_POLICY_ACTION_DROP 15 /* drop an importance boost assertion */ /* policies */ #define PROC_POLICY NONE 0 @@ -59,12 +65,9 @@ __BEGIN_DECLS #define PROC_POLICY_HARDWARE_ACCESS 2 /* access to various hardware */ #define PROC_POLICY_RESOURCE_STARVATION 3 /* behavior on resource starvation */ #define PROC_POLICY_RESOURCE_USAGE 4 /* behavior on resource consumption */ -#if CONFIG_EMBEDDED -#define PROC_POLICY_APP_LIFECYCLE 5 /* app life cycle management */ -#else /* CONFIG_EMBEDDED */ #define PROC_POLICY_RESERVED 5 /* behavior on resource consumption */ -#endif /* CONFIG_EMBEDDED */ #define PROC_POLICY_APPTYPE 6 /* behavior on resource consumption */ +#define PROC_POLICY_BOOST 7 /* importance boost/drop */ /* sub policies for background policy */ #define PROC_POLICY_BG_NONE 0 /* none */ @@ -72,11 +75,7 @@ __BEGIN_DECLS #define PROC_POLICY_BG_DISKTHROTTLE 2 /* disk accesses throttled */ #define PROC_POLICY_BG_NETTHROTTLE 4 /* network accesses throttled */ #define PROC_POLICY_BG_GPUDENY 8 /* no access to GPU */ -#if CONFIG_EMBEDDED -#define PROC_POLICY_BG_ALL 0x0F -#else /* CONFIG_EMBEDDED */ #define PROC_POLICY_BG_ALL 0x07 -#endif /* CONFIG_EMBEDDED */ #define PROC_POLICY_BG_DEFAULT PROC_POLICY_BG_ALL /* sub policies for hardware */ @@ -137,15 +136,13 @@ __BEGIN_DECLS #define PROC_POLICY_RSRCACT_NOTIFY_KQ 4 /* send kqueue notification */ #define PROC_POLICY_RSRCACT_NOTIFY_EXC 5 /* send exception */ +#define PROC_POLICY_CPUMON_DISABLE 0xFF /* Disable CPU usage monitor */ +#define PROC_POLICY_CPUMON_DEFAULTS 0xFE /* Set default CPU usage monitor params */ -/* type of resource for kqueue notifiction */ -#define PROC_POLICY_RSRTYPE_CPU 1 -#define PROC_POLICY_RSRTYPE_WIREDMEM 2 -#define PROC_POLICY_RSRTYPE_VIRTUALMEM 4 -#define PROC_POLICY_RSRTYPE_DISK 8 -#define PROC_POLICY_RSRTYPE_NETWORK 0x010 -#define PROC_POLICY_RSRTYPE_POWER 0x20 - +/* sub policies for importance boost/drop */ +#define PROC_POLICY_IMP_IMPORTANT 1 /* Important-level boost */ +#define PROC_POLICY_IMP_STANDARD 2 /* Standard-level boost */ +#define PROC_POLICY_IMP_DONATION 3 /* Mark a task as an importance source */ typedef struct proc_policy_attribute { uint32_t ppattr_attribute; /* the policy attribute to be modified or returned */ @@ -164,33 +161,18 @@ typedef struct proc_policy_cpuusage_attr { uint64_t ppattr_cpu_attr_deadline; /* 64bit deadline in nsecs */ } proc_policy_cpuusage_attr_t; -#if CONFIG_EMBEDDED -/* sub policies for app lifecycle management */ -#define PROC_POLICY_APPLIFE_NONE 0 /* does nothing.. */ -#define PROC_POLICY_APPLIFE_STATE 1 /* sets the app to various lifecycle states */ -#define PROC_POLICY_APPLIFE_DEVSTATUS 2 /* notes the device in inactive or short/long term */ -#define PROC_POLICY_APPLIFE_PIDBIND 3 /* a thread is to be bound to another processes app state */ -#endif /* CONFIG_EMBEDDED */ /* sub policies for PROC_POLICY_APPTYPE */ #define PROC_POLICY_APPTYPE_NONE 0 /* does nothing.. */ #define PROC_POLICY_APPTYPE_MODIFY 1 /* sets the app to various lifecycle states */ -#if CONFIG_EMBEDDED -#define PROC_POLICY_APPTYPE_THREADTHR 2 /* notes the device in inactive or short/long term */ -#endif /* CONFIG_EMBEDDED */ - - -#define PROC_POLICY_OSX_APPTYPE_NONE 0 -#if CONFIG_EMBEDDED -#define PROC_POLICY_IOS_RESV1_APPTYPE 1 /* TAL based launched */ -#define PROC_POLICY_IOS_APPLE_DAEMON 2 /* for user of IOS apple daemons */ -#define PROC_POLICY_IOS_APPTYPE 3 /* ios specific handling */ -#define PROC_POLICY_IOS_NONUITYPE 4 /* ios non graphics type */ -#else -#define PROC_POLICY_OSX_APPTYPE_TAL 1 /* TAL based launched */ -#define PROC_POLICY_OSX_APPTYPE_WIDGET 2 /* for dashboard client */ -#define PROC_POLICY_OSX_APPTYPE_DASHCLIENT 2 /* rename to move away from widget */ -#endif + +/* exported apptypes for PROC_POLICY_APPTYPE */ +#define PROC_POLICY_OSX_APPTYPE_TAL 1 /* TAL-launched app */ + +#define PROC_POLICY_OSX_APPTYPE_DASHCLIENT 2 /* Dashboard client (deprecated) */ +#define PROC_POLICY_IOS_DONATEIMP 6 /* donates priority imp (deprecated) */ +#define PROC_POLICY_IOS_HOLDIMP 7 /* hold importance assertion (deprecated) */ +#define PROC_POLICY_IOS_DROPIMP 8 /* drop importance assertion (deprecated) */ #ifndef KERNEL int process_policy(int scope, int action, int policy, int policy_subtype, proc_policy_attribute_t * attrp, pid_t target_pid, uint64_t target_threadid); diff --git a/kernel-include/sys/resource.h b/kernel-include/sys/resource.h index 311e1f601..6a4164fa8 100644 --- a/kernel-include/sys/resource.h +++ b/kernel-include/sys/resource.h @@ -68,25 +68,25 @@ #include #include -#ifndef KERNEL +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#include +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + +#ifndef KERNEL #include #endif /* [XSI] The timeval structure shall be defined as described in * */ -#define __need_struct_timeval +#include #ifdef KERNEL -#define __need_struct_user32_timeval -#define __need_struct_user64_timeval +#include +#include #endif -#include /* The id_t type shall be defined as described in */ -#ifndef _ID_T -#define _ID_T -typedef __darwin_id_t id_t; /* can hold pid_t, gid_t, or uid_t */ -#endif +#include /* @@ -107,10 +107,26 @@ typedef __uint64_t rlim_t; #define PRIO_PGRP 1 /* Second argument is a GID */ #define PRIO_USER 2 /* Second argument is a UID */ -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define PRIO_DARWIN_THREAD 3 /* Second argument is always 0 (current thread) */ #define PRIO_DARWIN_PROCESS 4 /* Second argument is a PID */ +#ifdef PRIVATE + +#define PRIO_DARWIN_GPU 5 /* Second argument is a PID */ + +#define PRIO_DARWIN_GPU_ALLOW 0x1 +#define PRIO_DARWIN_GPU_DENY 0x2 + +#define PRIO_DARWIN_ROLE 6 /* Second argument is a PID */ + +#define PRIO_DARWIN_ROLE_DEFAULT 0x0 /* Default state */ +#define PRIO_DARWIN_ROLE_UI_FOCAL 0x1 /* On screen, focal UI */ +#define PRIO_DARWIN_ROLE_UI 0x2 /* On screen, non-focal UI */ +#define PRIO_DARWIN_ROLE_NON_UI 0x3 /* Off screen, non-focal UI */ + +#endif /* PRIVATE */ + /* * Range limitations for the value of the third parameter to setpriority(). */ @@ -126,11 +142,11 @@ typedef __uint64_t rlim_t; /* * use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to - * the GPU. + * the GPU. (deprecated) */ #define PRIO_DARWIN_NONUI 0x1001 -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ @@ -157,9 +173,9 @@ typedef __uint64_t rlim_t; struct rusage { struct timeval ru_utime; /* user time used (PL) */ struct timeval ru_stime; /* system time used (PL) */ -#if defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE) +#if __DARWIN_C_LEVEL < __DARWIN_C_FULL long ru_opaque[14]; /* implementation defined */ -#else /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#else /* * Informational aliases for source compatibility with programs * that need more information than that provided by standards, @@ -181,12 +197,128 @@ struct rusage { long ru_nvcsw; /* voluntary context switches (atomic) */ long ru_nivcsw; /* involuntary " */ #define ru_last ru_nivcsw /* internal: ruadd() range end */ -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ +}; + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +/* + * Flavors for proc_pid_rusage(). + */ +#define RUSAGE_INFO_V0 0 +#define RUSAGE_INFO_V1 1 +#define RUSAGE_INFO_V2 2 +#define RUSAGE_INFO_V3 3 +#define RUSAGE_INFO_CURRENT RUSAGE_INFO_V3 + +typedef void *rusage_info_t; + +struct rusage_info_v0 { + uint8_t ri_uuid[16]; + uint64_t ri_user_time; + uint64_t ri_system_time; + uint64_t ri_pkg_idle_wkups; + uint64_t ri_interrupt_wkups; + uint64_t ri_pageins; + uint64_t ri_wired_size; + uint64_t ri_resident_size; + uint64_t ri_phys_footprint; + uint64_t ri_proc_start_abstime; + uint64_t ri_proc_exit_abstime; +}; + +struct rusage_info_v1 { + uint8_t ri_uuid[16]; + uint64_t ri_user_time; + uint64_t ri_system_time; + uint64_t ri_pkg_idle_wkups; + uint64_t ri_interrupt_wkups; + uint64_t ri_pageins; + uint64_t ri_wired_size; + uint64_t ri_resident_size; + uint64_t ri_phys_footprint; + uint64_t ri_proc_start_abstime; + uint64_t ri_proc_exit_abstime; + uint64_t ri_child_user_time; + uint64_t ri_child_system_time; + uint64_t ri_child_pkg_idle_wkups; + uint64_t ri_child_interrupt_wkups; + uint64_t ri_child_pageins; + uint64_t ri_child_elapsed_abstime; +}; + +struct rusage_info_v2 { + uint8_t ri_uuid[16]; + uint64_t ri_user_time; + uint64_t ri_system_time; + uint64_t ri_pkg_idle_wkups; + uint64_t ri_interrupt_wkups; + uint64_t ri_pageins; + uint64_t ri_wired_size; + uint64_t ri_resident_size; + uint64_t ri_phys_footprint; + uint64_t ri_proc_start_abstime; + uint64_t ri_proc_exit_abstime; + uint64_t ri_child_user_time; + uint64_t ri_child_system_time; + uint64_t ri_child_pkg_idle_wkups; + uint64_t ri_child_interrupt_wkups; + uint64_t ri_child_pageins; + uint64_t ri_child_elapsed_abstime; + uint64_t ri_diskio_bytesread; + uint64_t ri_diskio_byteswritten; +}; + +struct rusage_info_v3 { + uint8_t ri_uuid[16]; + uint64_t ri_user_time; + uint64_t ri_system_time; + uint64_t ri_pkg_idle_wkups; + uint64_t ri_interrupt_wkups; + uint64_t ri_pageins; + uint64_t ri_wired_size; + uint64_t ri_resident_size; + uint64_t ri_phys_footprint; + uint64_t ri_proc_start_abstime; + uint64_t ri_proc_exit_abstime; + uint64_t ri_child_user_time; + uint64_t ri_child_system_time; + uint64_t ri_child_pkg_idle_wkups; + uint64_t ri_child_interrupt_wkups; + uint64_t ri_child_pageins; + uint64_t ri_child_elapsed_abstime; + uint64_t ri_diskio_bytesread; + uint64_t ri_diskio_byteswritten; + uint64_t ri_cpu_time_qos_default; + uint64_t ri_cpu_time_qos_maintenance; + uint64_t ri_cpu_time_qos_background; + uint64_t ri_cpu_time_qos_utility; + uint64_t ri_cpu_time_qos_legacy; + uint64_t ri_cpu_time_qos_user_initiated; + uint64_t ri_cpu_time_qos_user_interactive; + uint64_t ri_billed_system_time; + uint64_t ri_serviced_system_time; }; +typedef struct rusage_info_v3 rusage_info_current; + +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #ifdef KERNEL +struct rusage_superset { + struct rusage ru; + rusage_info_current ri; +}; + +struct rusage_info_child { + uint64_t ri_child_user_time; + uint64_t ri_child_system_time; + uint64_t ri_child_pkg_idle_wkups; + uint64_t ri_child_interrupt_wkups; + uint64_t ri_child_pageins; + uint64_t ri_child_elapsed_abstime; +}; + struct user64_rusage { struct user64_timeval ru_utime; /* user time used */ struct user64_timeval ru_stime; /* system time used */ @@ -251,15 +383,15 @@ struct user32_rusage { #define RLIMIT_STACK 3 /* stack size */ #define RLIMIT_CORE 4 /* core file size */ #define RLIMIT_AS 5 /* address space (resident set size) */ -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define RLIMIT_RSS RLIMIT_AS /* source compatibility alias */ #define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */ #define RLIMIT_NPROC 7 /* number of processes */ -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #define RLIMIT_NOFILE 8 /* number of open files */ -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define RLIM_NLIMITS 9 /* total number of resource limits */ -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #define _RLIMIT_POSIX_FLAG 0x1000 /* Set bit for strict POSIX */ /* @@ -271,25 +403,66 @@ struct rlimit { rlim_t rlim_max; /* maximum value for rlim_cur */ }; -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +/* + * proc_rlimit_control() + * + * Resource limit flavors + */ +#define RLIMIT_WAKEUPS_MONITOR 0x1 /* Configure the wakeups monitor. */ +#define RLIMIT_CPU_USAGE_MONITOR 0x2 /* Configure the CPU usage monitor. */ +#define RLIMIT_THREAD_CPULIMITS 0x3 /* Configure a blocking, per-thread, CPU limits. */ + +/* + * Flags for wakeups monitor control. + */ +#define WAKEMON_ENABLE 0x01 +#define WAKEMON_DISABLE 0x02 +#define WAKEMON_GET_PARAMS 0x04 +#define WAKEMON_SET_DEFAULTS 0x08 +#define WAKEMON_MAKE_FATAL 0x10 /* Configure the task so that violations are fatal. */ +/* + * Flags for CPU usage monitor control. + */ +#define CPUMON_MAKE_FATAL 0x1000 + +struct proc_rlimit_control_wakeupmon { + uint32_t wm_flags; + int32_t wm_rate; +}; + /* I/O type */ #define IOPOL_TYPE_DISK 0 +#if PRIVATE +#define IOPOL_TYPE_VFS_HFS_CASE_SENSITIVITY 1 +#endif /* scope */ #define IOPOL_SCOPE_PROCESS 0 #define IOPOL_SCOPE_THREAD 1 +#define IOPOL_SCOPE_DARWIN_BG 2 /* I/O Priority */ -#define IOPOL_DEFAULT 0 -#define IOPOL_NORMAL 1 -#define IOPOL_PASSIVE 2 -#define IOPOL_THROTTLE 3 -#define IOPOL_UTILITY 4 +#define IOPOL_DEFAULT 0 +#define IOPOL_IMPORTANT 1 +#define IOPOL_PASSIVE 2 +#define IOPOL_THROTTLE 3 +#define IOPOL_UTILITY 4 +#define IOPOL_STANDARD 5 + +/* compatibility with older names */ +#define IOPOL_APPLICATION IOPOL_STANDARD +#define IOPOL_NORMAL IOPOL_IMPORTANT + +#if PRIVATE +#define IOPOL_VFS_HFS_CASE_SENSITIVITY_DEFAULT 0 +#define IOPOL_VFS_HFS_CASE_SENSITIVITY_FORCE_CASE_SENSITIVE 1 +#endif #ifdef PRIVATE /* - * Structures for use in communicating via iopolicysys() between Lic and the - * kernel. Not to be used by uesr programs directly. + * Structures for use in communicating via iopolicysys() between Libc and the + * kernel. Not to be used by user programs directly. */ /* @@ -308,21 +481,21 @@ struct _iopol_param_t { }; #endif /* PRIVATE */ -#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ #ifndef KERNEL __BEGIN_DECLS int getpriority(int, id_t); -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL int getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); -#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ int getrlimit(int, struct rlimit *) __DARWIN_ALIAS(getrlimit); int getrusage(int, struct rusage *); int setpriority(int, id_t, int); -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL int setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); -#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ int setrlimit(int, const struct rlimit *) __DARWIN_ALIAS(setrlimit); __END_DECLS diff --git a/platform-include/sys/proc_info.h b/platform-include/sys/proc_info.h index 12a0fd0b0..e8ca29c4f 100644 --- a/platform-include/sys/proc_info.h +++ b/platform-include/sys/proc_info.h @@ -96,6 +96,35 @@ struct proc_bsdshortinfo { }; +#ifdef PRIVATE +struct proc_uniqidentifierinfo { + uint8_t p_uuid[16]; /* UUID of the main executable */ + uint64_t p_uniqueid; /* 64 bit unique identifier for process */ + uint64_t p_puniqueid; /* unique identifier for process's parent */ + uint64_t p_reserve2; /* reserved for future use */ + uint64_t p_reserve3; /* reserved for future use */ + uint64_t p_reserve4; /* reserved for future use */ +}; + + +struct proc_bsdinfowithuniqid { + struct proc_bsdinfo pbsd; + struct proc_uniqidentifierinfo p_uniqidentifier; +}; + +struct proc_archinfo { + cpu_type_t p_cputype; + cpu_subtype_t p_cpusubtype; +}; + +struct proc_pidcoalitioninfo { + uint64_t coalition_id; + uint64_t reserved1; + uint64_t reserved2; + uint64_t reserved3; +}; + +#endif /* pbi_flags values */ @@ -118,6 +147,19 @@ struct proc_bsdshortinfo { #define PROC_FLAG_PA_SUSP 0x1000 /* The process is currently suspended due to resource starvation */ #define PROC_FLAG_PSUGID 0x2000 /* process has set privileges since last exec */ #define PROC_FLAG_EXEC 0x4000 /* process has called exec */ +#ifdef PRIVATE +#define PROC_FLAG_DARWINBG 0x8000 /* process in darwin background */ +#define PROC_FLAG_EXT_DARWINBG 0x10000 /* process in darwin background - external enforcement */ +#define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* Process is apple daemon */ +#define PROC_FLAG_DELAYIDLESLEEP 0x40000 /* Process is marked to delay idle sleep on disk IO */ +#define PROC_FLAG_IOS_IMPPROMOTION 0x80000 /* Process is daemon which receives importane donation */ +#define PROC_FLAG_ADAPTIVE 0x100000 /* Process is adaptive */ +#define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000 /* Process is adaptive, and is currently important */ +#define PROC_FLAG_IMPORTANCE_DONOR 0x400000 /* Process is marked as an importance donor */ +#define PROC_FLAG_SUPPRESSED 0x800000 /* Process is suppressed */ +#define PROC_FLAG_APPLICATION 0x1000000 /* Process is an application */ +#define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */ +#endif struct proc_taskinfo { @@ -653,6 +695,32 @@ struct proc_fileportinfo { #define PROC_PID_RUSAGE 16 #define PROC_PID_RUSAGE_SIZE 0 +#ifdef PRIVATE +#define PROC_PIDUNIQIDENTIFIERINFO 17 +#define PROC_PIDUNIQIDENTIFIERINFO_SIZE \ + (sizeof(struct proc_uniqidentifierinfo)) + +#define PROC_PIDT_BSDINFOWITHUNIQID 18 +#define PROC_PIDT_BSDINFOWITHUNIQID_SIZE \ + (sizeof(struct proc_bsdinfowithuniqid)) + +#define PROC_PIDARCHINFO 19 +#define PROC_PIDARCHINFO_SIZE \ + (sizeof(struct proc_archinfo)) + +#define PROC_PIDCOALITIONINFO 20 +#define PROC_PIDCOALITIONINFO_SIZE (sizeof(struct proc_pidcoalitioninfo)) + +#define PROC_PIDNOTEEXIT 21 +#define PROC_PIDNOTEEXIT_SIZE (sizeof(uint32_t)) + +#define PROC_PIDREGIONPATHINFO2 22 +#define PROC_PIDREGIONPATHINFO2_SIZE (sizeof(struct proc_regionwithpathinfo)) + +#define PROC_PIDREGIONPATHINFO3 23 +#define PROC_PIDREGIONPATHINFO3_SIZE (sizeof(struct proc_regionwithpathinfo)) + +#endif /* Flavors for proc_pidfdinfo */ @@ -723,7 +791,49 @@ struct proc_fileportinfo { #define PROC_DIRTY_IS_DIRTY 0x4 #define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8 - +#ifdef PRIVATE + +/* Flavors for proc_pidoriginatorinfo */ +#define PROC_PIDORIGINATOR_UUID 0x1 +#define PROC_PIDORIGINATOR_UUID_SIZE (sizeof(uuid_t)) + +#define PROC_PIDORIGINATOR_BGSTATE 0x2 +#define PROC_PIDORIGINATOR_BGSTATE_SIZE (sizeof(uint32_t)) + +/* __proc_info() call numbers */ +#define PROC_INFO_CALL_LISTPIDS 0x1 +#define PROC_INFO_CALL_PIDINFO 0x2 +#define PROC_INFO_CALL_PIDFDINFO 0x3 +#define PROC_INFO_CALL_KERNMSGBUF 0x4 +#define PROC_INFO_CALL_SETCONTROL 0x5 +#define PROC_INFO_CALL_PIDFILEPORTINFO 0x6 +#define PROC_INFO_CALL_TERMINATE 0x7 +#define PROC_INFO_CALL_DIRTYCONTROL 0x8 +#define PROC_INFO_CALL_PIDRUSAGE 0x9 +#define PROC_INFO_CALL_PIDORIGINATORINFO 0xa + +#endif /* PRIVATE */ + +#ifdef XNU_KERNEL_PRIVATE +#ifndef pshmnode +struct pshmnode; +#endif + +#ifndef psemnode +struct psemnode ; +#endif + +#ifndef pipe +struct pipe; +#endif + +extern int fill_socketinfo(socket_t so, struct socket_info *si); +extern int fill_pshminfo(struct pshmnode * pshm, struct pshm_info * pinfo); +extern int fill_pseminfo(struct psemnode * psem, struct psem_info * pinfo); +extern int fill_pipeinfo(struct pipe * cpipe, struct pipe_info * pinfo); +extern int fill_kqueueinfo(struct kqueue * kq, struct kqueue_info * kinfo); +extern int fill_procworkqueue(proc_t, struct proc_workqueueinfo *); +#endif /* XNU_KERNEL_PRIVATE */ __END_DECLS diff --git a/src/duct/src/CMakeLists.txt b/src/duct/src/CMakeLists.txt index 714aa545c..571db042c 100644 --- a/src/duct/src/CMakeLists.txt +++ b/src/duct/src/CMakeLists.txt @@ -22,6 +22,8 @@ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${SUFFIX}/darling") SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -add_library(system_duct SHARED commpage.c libnotify.c numcpus.c CRGetCrashLogMessage.c acl.c bootstrap.c dyld.c dirhelper.c) +add_library(system_duct SHARED commpage.c libnotify.c numcpus.c + CRGetCrashLogMessage.c acl.c bootstrap.c dyld.c dirhelper.c dns_sd.c + sa_dst_compare.c) install(TARGETS system_duct DESTINATION lib${SUFFIX}/darling) diff --git a/src/duct/src/dns_sd.c b/src/duct/src/dns_sd.c new file mode 100644 index 000000000..16403be9c --- /dev/null +++ b/src/duct/src/dns_sd.c @@ -0,0 +1,30 @@ +#include + +// We don't have Bonjour (libsystem_dnssd) yet. + +int DNSServiceCreateConnection(void** ptr) +{ + *ptr = NULL; + return 1; +} + +int DNSServiceQueryRecord() +{ + return 1; +} + +int DNSServiceProcessResult() +{ + return 1; +} + +int DNSServiceRefDeallocate() +{ + return 1; +} + +int DNSServiceRefSockFD() +{ + return 1; +} + diff --git a/src/duct/src/sa_dst_compare.c b/src/duct/src/sa_dst_compare.c new file mode 100644 index 000000000..61e1c2f15 --- /dev/null +++ b/src/duct/src/sa_dst_compare.c @@ -0,0 +1,7 @@ +// This function is called from _gai_addr_sort() +// No implementation seems to be available. + +int sa_dst_compare() +{ + return 0; +} diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index cbc9dd0a6..4d1a1df8d 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -6,7 +6,7 @@ add_subdirectory(emulation/linux) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse -msse2 -msse3 -w -fblocks -ggdb") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__DARWIN_UNIX03 -fPIC -w -nostdinc") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib -Wl,--version-script=${DARLING_TOP_DIRECTORY}/darwin.map") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/darwin.map") if(CMAKE_SIZEOF_VOID_P EQUAL 4 OR CMAKE_INSTALL_LIBDIR STREQUAL "lib32") set(BITS 32) diff --git a/src/kernel/darwin.map b/src/kernel/darwin.map new file mode 100644 index 000000000..9905ed9d3 --- /dev/null +++ b/src/kernel/darwin.map @@ -0,0 +1,7 @@ +DARWIN { + global: + *; + local: + darwin_errno; +}; + diff --git a/src/kernel/libsyscall/CMakeLists.txt b/src/kernel/libsyscall/CMakeLists.txt index 372635360..64ea02a40 100644 --- a/src/kernel/libsyscall/CMakeLists.txt +++ b/src/kernel/libsyscall/CMakeLists.txt @@ -12,6 +12,7 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/os") include_directories("${DARLING_TOP_DIRECTORY}/platform-include") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../libc/include") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../duct/include") +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/wrappers/libproc") include_directories("${CMAKE_CURRENT_BINARY_DIR}") add_definitions(-DPRIVATE -D__DARWIN_C_LEVEL=20150101) add_definitions('-D__XNU_PRIVATE_EXTERN=') @@ -37,6 +38,9 @@ mig(mach/thread_act.defs) mig(mach/vm_map.defs) set(syscall_sources + wrappers/libproc/libproc.c + wrappers/libproc/proc_listpidspath.c + #wrappers/coalition.c # wrappers/__commpage_gettimeofday.c #wrappers/csr.c @@ -556,4 +560,6 @@ mig(mach/task.defs) mig(mach/thread_act.defs) mig(mach/vm_map.defs) +set_source_files_properties(custom/errno.c PROPERTIES COMPILE_FLAGS "-no-integrated-as") + add_library(libsyscall OBJECT ${syscall_sources}) diff --git a/src/kernel/libsyscall/custom/errno.c b/src/kernel/libsyscall/custom/errno.c index 86f754a65..6cdf00234 100644 --- a/src/kernel/libsyscall/custom/errno.c +++ b/src/kernel/libsyscall/custom/errno.c @@ -46,7 +46,13 @@ typedef uint64_t cerror_return_t; extern void _pthread_exit_if_canceled(int error); #undef errno -int errno; + + +// __attribute__((visibility("hidden"))) +int darwin_errno; +__asm__(".symver darwin_errno, errno@DARWIN"); + +#define errno darwin_errno int * __error(void) diff --git a/src/kernel/libsyscall/sys/__ptrace.S b/src/kernel/libsyscall/sys/__ptrace.S index 27ae99c31..ed2790cad 100644 --- a/src/kernel/libsyscall/sys/__ptrace.S +++ b/src/kernel/libsyscall/sys/__ptrace.S @@ -32,7 +32,7 @@ #ifdef DARLING # define ___ptrace __ptrace -# define _errno errno +# define _errno darwin_errno #endif #if defined(__i386__) diff --git a/src/kernel/libsyscall/wrappers/libproc/libproc_internal.h b/src/kernel/libsyscall/wrappers/libproc/libproc_internal.h index a39de570f..39be79194 100644 --- a/src/kernel/libsyscall/wrappers/libproc/libproc_internal.h +++ b/src/kernel/libsyscall/wrappers/libproc/libproc_internal.h @@ -26,6 +26,7 @@ #include #include +#include #include __BEGIN_DECLS diff --git a/src/libc/gen/stack_logging_disk.c b/src/libc/gen/stack_logging_disk.c index 00a0caed9..8d107f670 100644 --- a/src/libc/gen/stack_logging_disk.c +++ b/src/libc/gen/stack_logging_disk.c @@ -732,6 +732,7 @@ disable_stack_logging(void) */ static ssize_t robust_write(int fd, const void *buf, size_t nbyte) { + __asm__(".symver errno, errno@DARWIN"); extern int errno; ssize_t written = write(fd, buf, nbyte); if (written == -1 && errno == EBADF) { diff --git a/src/libc/gen/wordexp.c b/src/libc/gen/wordexp.c index 467603d26..9392ff364 100644 --- a/src/libc/gen/wordexp.c +++ b/src/libc/gen/wordexp.c @@ -38,6 +38,7 @@ #include extern size_t malloc_good_size(size_t size); +__asm__(".symver errno, errno@DARWIN"); extern int errno; pthread_once_t re_init_c = PTHREAD_ONCE_INIT; diff --git a/src/libc/posix1e/CMakeLists.txt b/src/libc/posix1e/CMakeLists.txt index 3349ee5bf..ee49b0940 100644 --- a/src/libc/posix1e/CMakeLists.txt +++ b/src/libc/posix1e/CMakeLists.txt @@ -1,6 +1,7 @@ project(libc-posix1e) cmake_minimum_required(VERSION 2.4.0) +include_directories(${DARLING_TOP_DIRECTORY}/src/libinfo/membership.subproj) set(posix1e_sources acl.c @@ -8,7 +9,7 @@ set(posix1e_sources acl_file.c acl_flag.c acl_perm.c - #acl_translate.c # doesn't build, ducted + acl_translate.c # doesn't build, ducted ) add_library(libc-posix1e OBJECT ${posix1e_sources}) diff --git a/src/libc/sys/errno.c b/src/libc/sys/errno.c index 1beeff967..7c20fa537 100644 --- a/src/libc/sys/errno.c +++ b/src/libc/sys/errno.c @@ -29,6 +29,8 @@ #include #undef errno + +__asm__(".symver errno, errno@DARWIN"); extern int errno; int *__error(void) { pthread_t self = pthread_self(); diff --git a/src/libc/threads/cprocs.c b/src/libc/threads/cprocs.c index ffcad5873..ef572ffaa 100644 --- a/src/libc/threads/cprocs.c +++ b/src/libc/threads/cprocs.c @@ -135,6 +135,7 @@ _cproc_fork_child() */ #undef errno +__asm__(".symver errno, errno@DARWIN"); extern int errno; extern int *__error(void); extern int __pthread_canceled(int); diff --git a/src/libdyld/CMakeLists.txt b/src/libdyld/CMakeLists.txt index f2339632e..9557fe646 100644 --- a/src/libdyld/CMakeLists.txt +++ b/src/libdyld/CMakeLists.txt @@ -10,6 +10,7 @@ if(COMMAND cmake_policy) endif(COMMAND cmake_policy) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/darwin.map") include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../util) diff --git a/src/libdyld/darwin.map b/src/libdyld/darwin.map new file mode 100644 index 000000000..2ca151221 --- /dev/null +++ b/src/libdyld/darwin.map @@ -0,0 +1,33 @@ +DARWIN { + global: + NSLookupAndBindSymbol; + NSLookupSymbolInModule; + NSNameOfSymbol; + NSAddressOfSymbol; + NSIsSymbolNameDefined; + NSModuleForSymbol; + NSIsSymbolNameDefinedInImage; + NSNameOfModule; + NSLibraryNameForModule; + NSVersionOfRunTimeLibrary; + NSVersionOfLinkTimeLibrary; + _NSGetExecutablePath; + + _dyld_image_count; + _dyld_get_image_header; + _dyld_get_image_vmaddr_slide; + _dyld_get_image_slide; + _dyld_get_image_name; + getsectdata; + _dyld_register_func_for_add_image; + _dyld_register_func_for_remove_image; + _dyld_deregister_func_for_add_image; + _dyld_deregister_func_for_remove_image; + _dyld_bind_fully_image_containing_address; + __dyld_bind_fully_image_containing_address; + __dyld_make_delayed_module_initializer_calls; + __dyld_mod_term_funcs; + dyld_image_path_containing_address; + _dyld_find_unwind_sections; +}; + diff --git a/src/libdyld/dl_public.cpp b/src/libdyld/dl_public.cpp index a07b23732..b20868ecf 100644 --- a/src/libdyld/dl_public.cpp +++ b/src/libdyld/dl_public.cpp @@ -32,6 +32,7 @@ void Darling::dl_setLastError(const std::string& str) g_lastErrorRead = false; } +__asm__(".symver __darwin_dlopen, dlopen@DARWIN"); void* __darwin_dlopen(const char* filename, int flag) { std::string resolved; @@ -99,6 +100,7 @@ void* __darwin_dlopen(const char* filename, int flag) return obj; } +__asm__(".symver __darwin_dlclose, dlclose@DARWIN"); int __darwin_dlclose(void* handle) { if (!handle) @@ -110,6 +112,7 @@ int __darwin_dlclose(void* handle) return 0; } +__asm__(".symver __darwin_dlerror, dlerror@DARWIN"); const char* __darwin_dlerror(void) { if (g_lastErrorRead || !g_lastError[0]) @@ -141,6 +144,7 @@ static void removeSuffix(std::string& str, const char* suf) str.resize(pos); } +__asm__(".symver __darwin_dlsym, dlsym@DARWIN"); void* __darwin_dlsym(void* handle, const char* symbol) { std::string name = symbol; @@ -199,6 +203,7 @@ void* __darwin_dlsym(void* handle, const char* symbol) return addr; } +__asm__(".symver __darwin_dladdr, dladdr@DARWIN"); int __darwin_dladdr(void *addr, Dl_info *info) { MachOObject* obj; diff --git a/src/libinfo/CMakeLists.txt b/src/libinfo/CMakeLists.txt index f0bcb4047..8df5cdfc8 100644 --- a/src/libinfo/CMakeLists.txt +++ b/src/libinfo/CMakeLists.txt @@ -23,7 +23,9 @@ add_subdirectory(gen.subproj) add_subdirectory(util.subproj) add_subdirectory(dns.subproj) add_subdirectory(nis.subproj) +add_subdirectory(rpc.subproj) add_subdirectory(lookup.subproj) +add_subdirectory(membership.subproj) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${SUFFIX}/darling") SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) @@ -33,7 +35,9 @@ add_library(system_info SHARED $ $ $ $ + $ $ + $ ) target_link_libraries(system_info system_c resolv) diff --git a/src/libinfo/lookup.subproj/mdns_module.c b/src/libinfo/lookup.subproj/mdns_module.c index 4a8a9f889..82115d301 100644 --- a/src/libinfo/lookup.subproj/mdns_module.c +++ b/src/libinfo/lookup.subproj/mdns_module.c @@ -1,3 +1,4 @@ +// Modified by Lubos Dolezel for Darling build /* * Copyright (c) 2008-2011 Apple Inc. All rights reserved. * @@ -217,7 +218,9 @@ _mdns_debug_message(const char *str, ...) if (_mdns_debug & MDNS_DEBUG_STDOUT) fprintf(stdout, "%s", out); if (_mdns_debug & MDNS_DEBUG_STDERR) fprintf(stderr, "%s", out); +#ifndef DARLING // No ASL in Darling yet if (_mdns_debug & MDNS_DEBUG_ASL) asl_log_message(ASL_LEVEL_NOTICE, "%s", out); +#endif free(out); va_end(v); diff --git a/src/libinfo/membership.subproj/CMakeLists.txt b/src/libinfo/membership.subproj/CMakeLists.txt new file mode 100644 index 000000000..f49632e60 --- /dev/null +++ b/src/libinfo/membership.subproj/CMakeLists.txt @@ -0,0 +1,17 @@ +project(libinfo-membership) + +cmake_minimum_required(VERSION 2.4.0) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libc/locale) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libc/locale/FreeBSD) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libc/pthreads) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libc/stdtime/FreeBSD) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../external/libdispatch/) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../lookup.subproj) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +set(info-membership_sources + membership.c +) + +add_library(info-membership OBJECT ${info-membership_sources}) diff --git a/src/libinfo/rpc.subproj/CMakeLists.txt b/src/libinfo/rpc.subproj/CMakeLists.txt new file mode 100644 index 000000000..82f833065 --- /dev/null +++ b/src/libinfo/rpc.subproj/CMakeLists.txt @@ -0,0 +1,21 @@ +project(libinfo-rpc) + +cmake_minimum_required(VERSION 2.4.0) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libc/locale) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libc/locale/FreeBSD) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libc/pthreads) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libc/stdtime/FreeBSD) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../external/libdispatch/) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../external/libdispatch/private) +include_directories(${DARLING_TOP_DIRECTORY}/src/libresolv) +include_directories(${DARLING_TOP_DIRECTORY}/src/libresolv/dnsinfo) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fblocks") + +set(info-rpc_sources + bindresvport.c +) + +add_library(info-rpc OBJECT ${info-rpc_sources}) diff --git a/src/libsystem/CMakeLists.txt b/src/libsystem/CMakeLists.txt index 4eadd9a4c..321f740e0 100644 --- a/src/libsystem/CMakeLists.txt +++ b/src/libsystem/CMakeLists.txt @@ -38,7 +38,7 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) add_library(system SHARED ${libsystem_sources}) target_link_libraries(system system_malloc system_c system_kernel keymgr - system_m system_info system_notify unwind libdispatch_shared objc launch) + system_m system_info system_notify unwind libdispatch_shared objc launch dyld) install(TARGETS system DESTINATION lib${SUFFIX}/darling)