/* See COPYRIGHT for copyright information. */
-#ifndef ROS_KERN_ENV_H
-#define ROS_KERN_ENV_H
+#pragma once
/* Note that the old include/ros/env.h is merged into this file */
#include <ros/memlayout.h>
TAILQ_HEAD(vcore_tailq, vcore);
/* 'struct proc_list' declared in sched.h (not ideal...) */
+struct username {
+ char name[128];
+ spinlock_t name_lock;
+};
+void __set_username(struct username *u, char *name);
+void set_username(struct username *u, char *name);
+
#define PROC_PROGNAME_SZ 20
// TODO: clean this up.
struct proc {
TAILQ_ENTRY(proc) sibling_link;
spinlock_t proc_lock;
struct user_context scp_ctx; /* context for an SCP. TODO: move to vc0 */
- char user[64]; /* user name */
+ struct username user;
+
+ /* This is effectively a (potentially short) version of argv[0].
+ */
char progname[PROC_PROGNAME_SZ];
+
+ /* This is the full path of the binary which the current proc structure
+ * is tracking.
+ */
+ char *binary_path;
+
pid_t pid;
/* 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
/* Scheduler mgmt (info, data, whatever) */
struct sched_proc_data ksched_data;
- /* Cache color map: bitmap of the cache colors currently allocated to this
- * process */
- uint8_t* cache_colors_map;
- size_t next_cache_color;
-
- /* Keeps track of this process's current memory allocation
- * (i.e. its heap pointer) */
- void* heap_top;
+ /* The args_base pointer is a user pointer which points to the base of
+ * the executable boot block (where args, environment, aux vectors, ...)
+ * are stored.
+ */
+ void *args_base;
// Address space
pgdir_t env_pgdir; // Kernel virtual address of page dir
// Per process info and data pages
procinfo_t *procinfo; // KVA of per-process shared info table (RO)
procdata_t *procdata; // KVA of per-process shared data table (RW)
-
+
// The backring pointers for processing asynchronous system calls from the user
// Note this is the actual backring, not a pointer to it somewhere else
syscall_back_ring_t syscallbackring;
-
+
// The front ring pointers for pushing asynchronous system events out to the user
// Note this is the actual frontring, not a pointer to it somewhere else
sysevent_front_ring_t syseventfrontring;
/* VMMCP */
struct vmm vmm;
+
+ struct strace *strace;
};
/* Til we remove all Env references */
typedef struct proc env_t;
/* Process Flags */
-#define PROC_TRANSITION_TO_M 0x0001
+#define PROC_TRANSITION_TO_M (1 << 0)
+#define PROC_TRACED (1 << 1)
extern atomic_t num_envs; // Number of envs
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);
-#endif // !ROS_KERN_ENV_H
+static inline void set_traced_proc(struct proc *p, bool traced)
+{
+ if (traced)
+ p->env_flags |= PROC_TRACED;
+ else
+ p->env_flags &= ~PROC_TRACED;
+}
+
+static inline bool is_traced_proc(const struct proc *p)
+{
+ return (p->env_flags & PROC_TRACED) != 0;
+}