]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/sys/proc_info.h
xnu-3789.1.32.tar.gz
[apple/xnu.git] / bsd / sys / proc_info.h
index e8ca29c4f11aeee50789cc6b967918f06041c3de..8f22d8007aa02592bfd84a141d51e96df036cc9a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2005-2016 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/kern_control.h>
+#include <sys/event.h>
 #include <net/if.h>
 #include <net/route.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <mach/machine.h>
+#include <uuid/uuid.h>
+
+#ifdef PRIVATE
+#include <mach/coalition.h> /* COALITION_NUM_TYPES */
+#endif
 
 __BEGIN_DECLS
 
@@ -118,12 +124,20 @@ struct proc_archinfo {
 };
 
 struct proc_pidcoalitioninfo {
-       uint64_t coalition_id;
+       uint64_t coalition_id[COALITION_NUM_TYPES];
        uint64_t reserved1;
        uint64_t reserved2;
        uint64_t reserved3;
 };
 
+struct proc_originatorinfo {
+       uuid_t                  originator_uuid;        /* UUID of the originator process */
+       pid_t                   originator_pid;         /* pid of the originator process */
+       uint64_t                p_reserve2;
+       uint64_t                p_reserve3;
+       uint64_t                p_reserve4;
+};
+
 #endif
 
 
@@ -270,9 +284,9 @@ struct proc_workqueueinfo {
 /*
  *     workqueue state (pwq_state field)
  */
-#define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT   0x1
-#define WQ_EXCEEDED_TOTAL_THREAD_LIMIT         0x2
-
+#define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1
+#define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2
+#define WQ_FLAGS_AVAILABLE 0x4
 
 struct proc_fileinfo {
        uint32_t                fi_openflags;
@@ -286,12 +300,28 @@ struct 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_FP_CLFORK 8       /* close on fork */
 
 #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)
 
+struct proc_exitreasonbasicinfo {
+       uint32_t                        beri_namespace;
+       uint64_t                        beri_code;
+       uint64_t                        beri_flags;
+       uint32_t                        beri_reason_buf_size;
+} __attribute__((packed));
+
+struct proc_exitreasoninfo {
+       uint32_t                        eri_namespace;
+       uint64_t                        eri_code;
+       uint64_t                        eri_flags;
+       uint32_t                        eri_reason_buf_size;
+       uint64_t                        eri_kcd_buf;
+} __attribute__((packed));
+
 /*
  * A copy of stat64 with static sized fields.
  */
@@ -605,8 +635,23 @@ struct kqueue_info {
        uint32_t                kq_state;
        uint32_t                rfu_1;  /* reserved */
 };
-#define PROC_KQUEUE_SELECT     1
-#define PROC_KQUEUE_SLEEP      2
+
+/* keep in sync with KQ_* in sys/eventvar.h */
+#define PROC_KQUEUE_SELECT     0x01
+#define PROC_KQUEUE_SLEEP      0x02
+#define PROC_KQUEUE_32         0x08
+#define PROC_KQUEUE_64         0x10
+#define PROC_KQUEUE_QOS                0x20
+
+#ifdef PRIVATE
+struct kevent_extinfo {
+       struct kevent_qos_s kqext_kev;
+       uint64_t kqext_sdata;
+       int kqext_status;
+       int kqext_sfflags;
+       uint64_t kqext_reserved[2];
+};
+#endif /* PRIVATE */
 
 struct kqueue_fdinfo {
        struct proc_fileinfo    pfi;
@@ -633,6 +678,7 @@ struct appletalk_fdinfo {
 #define PROX_FDTYPE_KQUEUE     5
 #define PROX_FDTYPE_PIPE       6
 #define PROX_FDTYPE_FSEVENTS   7
+#define PROX_FDTYPE_NETPOLICY  9
 
 struct proc_fdinfo {
        int32_t                 proc_fd;
@@ -644,6 +690,7 @@ struct proc_fileportinfo {
        uint32_t                proc_fdtype;
 };
 
+
 /* Flavors for proc_pidinfo() */
 #define PROC_PIDLISTFDS                        1
 #define PROC_PIDLISTFD_SIZE            (sizeof(struct proc_fdinfo))
@@ -720,6 +767,12 @@ struct proc_fileportinfo {
 #define PROC_PIDREGIONPATHINFO3                23
 #define PROC_PIDREGIONPATHINFO3_SIZE   (sizeof(struct proc_regionwithpathinfo))
 
+#define PROC_PIDEXITREASONINFO         24
+#define PROC_PIDEXITREASONINFO_SIZE    (sizeof(struct proc_exitreasoninfo))
+
+#define PROC_PIDEXITREASONBASICINFO    25
+#define PROC_PIDEXITREASONBASICINFOSIZE        (sizeof(struct proc_exitreasonbasicinfo))
+
 #endif
 
 /* Flavors for proc_pidfdinfo */
@@ -748,6 +801,13 @@ struct proc_fileportinfo {
 #define PROC_PIDFDATALKINFO            8
 #define PROC_PIDFDATALKINFO_SIZE       (sizeof(struct appletalk_fdinfo))
 
+#ifdef PRIVATE
+#define PROC_PIDFDKQUEUE_EXTINFO       9
+#define PROC_PIDFDKQUEUE_EXTINFO_SIZE  (sizeof(struct kevent_extinfo))
+#define PROC_PIDFDKQUEUE_KNOTES_MAX    (1024 * 128)
+#endif /* PRIVATE */
+
+
 /* Flavors for proc_pidfileportinfo */
 
 #define PROC_PIDFILEPORTVNODEPATHINFO  2       /* out: vnode_fdinfowithpath */
@@ -800,6 +860,29 @@ struct proc_fileportinfo {
 #define PROC_PIDORIGINATOR_BGSTATE     0x2
 #define PROC_PIDORIGINATOR_BGSTATE_SIZE (sizeof(uint32_t))
 
+#define PROC_PIDORIGINATOR_PID_UUID     0x3
+#define PROC_PIDORIGINATOR_PID_UUID_SIZE (sizeof(struct proc_originatorinfo))
+
+/* Flavors for proc_listcoalitions */
+#define LISTCOALITIONS_ALL_COALS       1
+#define LISTCOALITIONS_ALL_COALS_SIZE   (sizeof(struct procinfo_coalinfo))
+
+#define LISTCOALITIONS_SINGLE_TYPE     2
+#define LISTCOALITIONS_SINGLE_TYPE_SIZE (sizeof(struct procinfo_coalinfo))
+
+/* reasons for proc_can_use_foreground_hw */
+#define PROC_FGHW_OK                     0 /* pid may use foreground HW */
+#define PROC_FGHW_DAEMON_OK              1
+#define PROC_FGHW_DAEMON_LEADER         10 /* pid is in a daemon coalition */
+#define PROC_FGHW_LEADER_NONUI          11 /* coalition leader is in a non-focal state */
+#define PROC_FGHW_LEADER_BACKGROUND     12 /* coalition leader is in a background state */
+#define PROC_FGHW_DAEMON_NO_VOUCHER     13 /* pid is a daemon with no adopted voucher */
+#define PROC_FGHW_NO_VOUCHER_ATTR       14 /* pid has adopted a voucher with no bank/originator attribute */
+#define PROC_FGHW_NO_ORIGINATOR         15 /* pid has adopted a voucher for a process that's gone away */
+#define PROC_FGHW_ORIGINATOR_BACKGROUND 16 /* pid has adopted a voucher for an app that's in the background */
+#define PROC_FGHW_VOUCHER_ERROR         98 /* error in voucher / originator callout */
+#define PROC_FGHW_ERROR                 99 /* syscall parameter/permissions error */
+
 /* __proc_info() call numbers */
 #define PROC_INFO_CALL_LISTPIDS         0x1
 #define PROC_INFO_CALL_PIDINFO          0x2
@@ -811,6 +894,8 @@ struct proc_fileportinfo {
 #define PROC_INFO_CALL_DIRTYCONTROL     0x8
 #define PROC_INFO_CALL_PIDRUSAGE        0x9
 #define PROC_INFO_CALL_PIDORIGINATORINFO 0xa
+#define PROC_INFO_CALL_LISTCOALITIONS   0xb
+#define PROC_INFO_CALL_CANUSEFGHW       0xc
 
 #endif /* PRIVATE */
 
@@ -832,7 +917,15 @@ 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 pid_kqueue_extinfo(proc_t, struct kqueue * kq, user_addr_t buffer,
+                             uint32_t buffersize, int32_t * retval);
+extern int pid_kqueue_udatainfo(proc_t p, struct kqueue *kq, uint64_t *buf,
+                               uint32_t bufsize);
 extern int fill_procworkqueue(proc_t, struct proc_workqueueinfo *);
+extern boolean_t workqueue_get_pwq_exceeded(void *v, boolean_t *exceeded_total,
+                                            boolean_t *exceeded_constrained);
+extern uint32_t workqueue_get_pwq_state_kdp(void *proc);
+
 #endif /* XNU_KERNEL_PRIVATE */
 
 __END_DECLS