#include <ros/procdata.h>
#include <ros/procinfo.h>
#include <ros/resource.h>
-#include <arch/trap.h>
+#include <trap.h>
#include <ros/common.h>
#include <arch/arch.h>
#include <sys/queue.h>
#include <atomic.h>
#include <mm.h>
#include <vfs.h>
+#include <schedule.h>
+#include <devalarm.h>
+#include <ns.h>
-/* List def for the three vcore lists */
TAILQ_HEAD(vcore_tailq, vcore);
+/* 'struct proc_list' declared in sched.h (not ideal...) */
// TODO: clean this up.
struct proc {
- TAILQ_ENTRY(proc) proc_link NOINIT; // Free list link pointers
- TAILQ_ENTRY(proc) proc_arsc_link NOINIT; // Free list link pointers for the arsc list
+ TAILQ_ENTRY(proc) proc_arsc_link;
+ TAILQ_ENTRY(proc) sibling_link;
spinlock_t proc_lock;
- trapframe_t env_tf; // Saved registers
- ancillary_state_t env_ancillary_state; // State saved when descheduled
+ struct user_context scp_ctx; /* context for an SCP. TODO: move to vc0 */
+ char user[64]; /* user name */
pid_t pid;
- pid_t ppid; // Parent's PID
- pid_t exitcode; // exit() param or main() return value
- struct semaphore state_change;
+ /* Tempting to add a struct proc *parent, but we'd need to protect the use
+ * of that reference from concurrent parent-death (letting init inherit
+ * children, etc), which is basically what we do when we do pid2proc. If we
+ * do add *parent, it'll be a weak ref, and you'll need to lock the child to
+ * kref_get or to remove the pointer. */
+ pid_t ppid; /* parent's pid, not a reference */
+ struct proc_list children; /* protected by the proc lock for now */
+ int exitcode; /* exit() param or main() return value */
+ struct cond_var child_wait; /* signal for dying or o/w waitable child */
uint32_t state; // Status of the process
struct kref p_kref; /* Refcnt */
uint32_t env_flags;
struct vcore_tailq online_vcs;
struct vcore_tailq bulk_preempted_vcs;
struct vcore_tailq inactive_vcs;
+ /* Scheduler mgmt (info, data, whatever) */
+ struct sched_proc_data ksched_data;
/* Cache color map: bitmap of the cache colors currently allocated to this
* process */
struct namespace *ns;
struct fs_struct fs_env;
struct files_struct open_files;
+ struct pgrp *pgrp;
/* UCQ hashlocks */
struct hashlock *ucq_hashlock;
struct small_hashlock ucq_hl_noref; /* don't reference directly */
+ /* For devalarm */
+ struct proc_alarm_set alarmset;
+ struct cv_lookup_tailq abortable_sleepers;
+ spinlock_t abort_list_lock;
};
/* Til we remove all Env references */
extern atomic_t num_envs; // Number of envs
int env_setup_vm(env_t *e);
-void env_push_ancillary_state(env_t* e);
-void env_pop_ancillary_state(env_t* e);
void env_user_mem_free(env_t* e, void* start, size_t len);
void env_pagetable_free(env_t* e);
typedef int (*mem_walk_callback_t)(env_t* e, pte_t* pte, void* va, void* arg);
int env_user_mem_walk(env_t* e, void* start, size_t len, mem_walk_callback_t callback, void* arg);
-// The following three functions do not return
-void env_pop_tf(trapframe_t *tf) __attribute__((noreturn));
-
#endif // !ROS_KERN_ENV_H