First round of big changes: the term team has replaced proc all over the kernel, the few kern_* syscalls have been renamed to sys_* for consistency, and other small changes. The ps app is temporarily disabled until get_next_team_info is implemented.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@557 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+19
-10
@@ -97,16 +97,11 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef team_id
|
||||
* id of an team (process)
|
||||
*/
|
||||
/**
|
||||
* @typedef area_id
|
||||
* id of an area
|
||||
*/
|
||||
|
||||
typedef int32 team_id;
|
||||
typedef int32 area_id;
|
||||
|
||||
/** @} */
|
||||
@@ -205,13 +200,13 @@ int _get_next_port_info(team_id, int32 *, port_info *, size_t);
|
||||
*/
|
||||
typedef struct sem_info {
|
||||
sem_id sem;
|
||||
proc_id proc;
|
||||
team_id team;
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
int32 count;
|
||||
thread_id latest_holder;
|
||||
} sem_info;
|
||||
|
||||
sem_id create_sem_etc(int count, const char *name, proc_id owner);
|
||||
sem_id create_sem_etc(int count, const char *name, team_id owner);
|
||||
sem_id create_sem(int count, const char *name);
|
||||
int delete_sem(sem_id id);
|
||||
int delete_sem_etc(sem_id id, int return_code);
|
||||
@@ -221,8 +216,8 @@ int release_sem(sem_id id);
|
||||
int release_sem_etc(sem_id id, int count, int flags);
|
||||
int get_sem_count(sem_id id, int32* thread_count);
|
||||
int _get_sem_info(sem_id id, struct sem_info *info, size_t);
|
||||
int _get_next_sem_info(proc_id proc, uint32 *cookie, struct sem_info *info, size_t);
|
||||
int set_sem_owner(sem_id id, proc_id proc);
|
||||
int _get_next_sem_info(team_id team, uint32 *cookie, struct sem_info *info, size_t);
|
||||
int set_sem_owner(sem_id id, team_id team);
|
||||
|
||||
#define get_sem_info(sem, info) \
|
||||
_get_sem_info((sem), (info), sizeof(*(info)))
|
||||
@@ -289,7 +284,7 @@ typedef enum {
|
||||
/** information on a thread
|
||||
* @note the thread can be in any state
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
thread_id thread;
|
||||
team_id team;
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
@@ -302,6 +297,20 @@ typedef struct {
|
||||
void *stack_end;
|
||||
} thread_info;
|
||||
|
||||
/** information on a team */
|
||||
typedef struct {
|
||||
team_id team;
|
||||
int32 thread_count;
|
||||
int32 image_count;
|
||||
int32 area_count;
|
||||
thread_id debugger_nub_thread;
|
||||
port_id debugger_nub_port;
|
||||
int32 argc;
|
||||
char args[64];
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
} team_info;
|
||||
|
||||
/**
|
||||
* gives information on user and kernel time for a thread
|
||||
*/
|
||||
|
||||
@@ -51,33 +51,33 @@ bigtime_t sys_system_time();
|
||||
int sys_snooze(bigtime_t time);
|
||||
|
||||
/* sem functions */
|
||||
sem_id kern_create_sem(int count, const char *name);
|
||||
int kern_delete_sem(sem_id id);
|
||||
int kern_acquire_sem(sem_id id);
|
||||
int kern_acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout);
|
||||
int kern_release_sem(sem_id id);
|
||||
int kern_release_sem_etc(sem_id id, int count, int flags);
|
||||
sem_id sys_create_sem(int count, const char *name);
|
||||
int sys_delete_sem(sem_id id);
|
||||
int sys_acquire_sem(sem_id id);
|
||||
int sys_acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout);
|
||||
int sys_release_sem(sem_id id);
|
||||
int sys_release_sem_etc(sem_id id, int count, int flags);
|
||||
int sys_sem_get_count(sem_id id, int32* thread_count);
|
||||
int kern_get_sem_info(sem_id, struct sem_info *, size_t);
|
||||
int kern_get_next_sem_info(proc_id, uint32 *, struct sem_info *, size_t);
|
||||
int sys_set_sem_owner(sem_id id, proc_id proc);
|
||||
int sys_get_sem_info(sem_id, struct sem_info *, size_t);
|
||||
int sys_get_next_sem_info(team_id, uint32 *, struct sem_info *, size_t);
|
||||
int sys_set_sem_owner(sem_id id, team_id proc);
|
||||
|
||||
|
||||
int sys_proc_get_table(struct proc_info *pi, size_t len);
|
||||
//int sys_team_get_table(struct proc_info *pi, size_t len);
|
||||
void sys_exit(int retcode);
|
||||
proc_id sys_proc_create_proc(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
team_id sys_create_team(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
|
||||
thread_id kern_spawn_thread(int (*func)(void*), const char *, int, void *);
|
||||
thread_id kern_get_current_thread_id(void);
|
||||
int kern_suspend_thread(thread_id tid);
|
||||
int kern_resume_thread(thread_id tid);
|
||||
int kern_kill_thread(thread_id tid);
|
||||
thread_id sys_spawn_thread(int (*func)(void*), const char *, int, void *);
|
||||
thread_id sys_get_current_thread_id(void);
|
||||
int sys_suspend_thread(thread_id tid);
|
||||
int sys_resume_thread(thread_id tid);
|
||||
int sys_kill_thread(thread_id tid);
|
||||
|
||||
int sys_thread_wait_on_thread(thread_id tid, int *retcode);
|
||||
int sys_proc_kill_proc(proc_id pid);
|
||||
int sys_wait_on_thread(thread_id tid, int *retcode);
|
||||
int sys_kill_team(team_id tid);
|
||||
|
||||
proc_id sys_get_current_proc_id();
|
||||
int sys_proc_wait_on_proc(proc_id pid, int *retcode);
|
||||
team_id sys_get_current_team_id();
|
||||
int sys_wait_on_team(team_id tid, int *retcode);
|
||||
|
||||
region_id sys_vm_create_anonymous_region(const char *name, void **address, int addr_type,
|
||||
addr size, int wiring, int lock);
|
||||
@@ -94,13 +94,13 @@ int sys_port_close(port_id id);
|
||||
int sys_port_delete(port_id id);
|
||||
port_id sys_port_find(const char *port_name);
|
||||
int sys_port_get_info(port_id id, struct port_info *info);
|
||||
int sys_port_get_next_port_info(proc_id proc, uint32 *cookie, struct port_info *info);
|
||||
int sys_port_get_next_port_info(team_id team, uint32 *cookie, struct port_info *info);
|
||||
ssize_t sys_port_buffer_size(port_id port);
|
||||
ssize_t sys_port_buffer_size_etc(port_id port, uint32 flags, bigtime_t timeout);
|
||||
int32 sys_port_count(port_id port);
|
||||
ssize_t sys_port_read(port_id port, int32 *msg_code, void *msg_buffer, size_t buffer_size);
|
||||
ssize_t sys_port_read_etc(port_id port, int32 *msg_code, void *msg_buffer, size_t buffer_size, uint32 flags, bigtime_t timeout);
|
||||
int sys_port_set_owner(port_id port, team_id proc);
|
||||
int sys_port_set_owner(port_id port, team_id team);
|
||||
int sys_port_write(port_id port, int32 msg_code, const void *msg_buffer, size_t buffer_size);
|
||||
int sys_port_write_etc(port_id port, int32 msg_code, const void *msg_buffer, size_t buffer_size, uint32 flags, bigtime_t timeout);
|
||||
|
||||
@@ -123,7 +123,7 @@ area_id sys_find_region_by_name(const char *);
|
||||
/* This is a real BSD'ism :) Basically it returns the size of the
|
||||
* descriptor table for the current process as an integer.
|
||||
*/
|
||||
int kern_getdtablesize(void);
|
||||
int sys_getdtablesize(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
PROC_STATE_NORMAL, // normal state
|
||||
PROC_STATE_BIRTH, // being contructed
|
||||
PROC_STATE_DEATH // being killed
|
||||
TEAM_STATE_NORMAL, // normal state
|
||||
TEAM_STATE_BIRTH, // being contructed
|
||||
TEAM_STATE_DEATH // being killed
|
||||
};
|
||||
|
||||
#define SIG_NONE 0
|
||||
@@ -66,16 +66,14 @@ enum {
|
||||
#define SIG_KILL 2
|
||||
|
||||
/**
|
||||
* The proc structure.
|
||||
* The team structure; equivalent to a common process.
|
||||
* @note This is available only within the kernel.
|
||||
*/
|
||||
struct proc {
|
||||
/** Pointer to next proc structure */
|
||||
struct proc *next;
|
||||
/** The proc_id for this process.
|
||||
* @note This is equivalent to a team_id (???)
|
||||
*/
|
||||
proc_id id;
|
||||
struct team {
|
||||
/** Pointer to next team structure */
|
||||
struct team *next;
|
||||
/** The team_id for this process. */
|
||||
team_id id;
|
||||
/** name of the process
|
||||
* @note The maximum length is current SYS_MAX_OS_NAME_LEN chars.
|
||||
*/
|
||||
@@ -101,12 +99,12 @@ struct proc {
|
||||
addr user_env_base;
|
||||
struct thread *main_thread;
|
||||
struct thread *thread_list;
|
||||
struct arch_proc arch_info;
|
||||
struct arch_team arch_info;
|
||||
};
|
||||
|
||||
struct thread {
|
||||
struct thread *all_next;
|
||||
struct thread *proc_next;
|
||||
struct thread *team_next;
|
||||
struct thread *q_next;
|
||||
thread_id id;
|
||||
char name[SYS_MAX_OS_NAME_LEN];
|
||||
@@ -125,7 +123,7 @@ struct thread {
|
||||
addr fault_handler;
|
||||
addr entry;
|
||||
void *args;
|
||||
struct proc *proc;
|
||||
struct team *team;
|
||||
sem_id return_code_sem;
|
||||
region_id kernel_stack_region_id;
|
||||
addr kernel_stack_base;
|
||||
@@ -145,18 +143,6 @@ struct thread_queue {
|
||||
struct thread *tail;
|
||||
};
|
||||
|
||||
/**
|
||||
* Process information structure
|
||||
* @note Seem to be a lot of duplicated fields with main
|
||||
* proc structure???
|
||||
*/
|
||||
struct proc_info {
|
||||
proc_id id;
|
||||
char name[SYS_MAX_OS_NAME_LEN];
|
||||
int state;
|
||||
int num_threads;
|
||||
};
|
||||
|
||||
#if 1
|
||||
/**
|
||||
* Test routine for threads.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <thread.h>
|
||||
|
||||
int arch_proc_init_proc_struct(struct proc *p, bool kernel);
|
||||
int arch_team_init_team_struct(struct team *t, bool kernel);
|
||||
int arch_thread_init_thread_struct(struct thread *t);
|
||||
void arch_thread_context_switch(struct thread *t_from, struct thread *t_to);
|
||||
int arch_thread_initialize_kthread_stack(struct thread *t, int (*start_func)(void), void (*entry_func)(void), void (*exit_func)(void));
|
||||
|
||||
@@ -18,7 +18,7 @@ struct arch_thread {
|
||||
uint8 fpu_state[512];
|
||||
};
|
||||
|
||||
struct arch_proc {
|
||||
struct arch_team {
|
||||
// nothing here
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <thread.h>
|
||||
|
||||
int elf_load_uspace(const char *path, struct proc *p, int flags, addr *entry);
|
||||
int elf_load_uspace(const char *path, struct team *t, int flags, addr *entry);
|
||||
image_id elf_load_kspace(const char *path, const char *sym_prepend);
|
||||
int elf_unload_kspace( const char *path);
|
||||
addr elf_lookup_symbol(image_id id, const char *symbol);
|
||||
|
||||
@@ -79,9 +79,9 @@ static struct io_context *get_current_io_context(bool kernel);
|
||||
static __inline struct io_context *get_current_io_context(bool kernel)
|
||||
{
|
||||
if (kernel)
|
||||
return proc_get_kernel_proc()->ioctx;
|
||||
return team_get_kernel_team()->ioctx;
|
||||
|
||||
return thread_get_current_thread()->proc->ioctx;
|
||||
return thread_get_current_thread()->team->ioctx;
|
||||
}
|
||||
|
||||
#endif /* _FILE_H */
|
||||
|
||||
@@ -34,9 +34,9 @@ enum {
|
||||
SYSCALL_SEM_RELEASE_ETC,
|
||||
SYSCALL_GET_CURRENT_THREAD_ID,
|
||||
SYSCALL_EXIT_THREAD,
|
||||
SYSCALL_PROC_CREATE_PROC,
|
||||
SYSCALL_THREAD_WAIT_ON_THREAD,
|
||||
SYSCALL_PROC_WAIT_ON_PROC,
|
||||
SYSCALL_CREATE_TEAM,
|
||||
SYSCALL_WAIT_ON_THREAD,
|
||||
SYSCALL_WAIT_ON_TEAM,
|
||||
SYSCALL_VM_CREATE_ANONYMOUS_REGION,
|
||||
SYSCALL_VM_CLONE_REGION, /* 30 */
|
||||
SYSCALL_VM_MAP_FILE,
|
||||
@@ -47,8 +47,8 @@ enum {
|
||||
SYSCALL_KILL_THREAD,
|
||||
SYSCALL_SUSPEND_THREAD,
|
||||
SYSCALL_RESUME_THREAD,
|
||||
SYSCALL_PROC_KILL_PROC,
|
||||
SYSCALL_GET_CURRENT_PROC_ID,
|
||||
SYSCALL_KILL_TEAM,
|
||||
SYSCALL_GET_CURRENT_TEAM_ID,
|
||||
SYSCALL_GETCWD, /* 40 */
|
||||
SYSCALL_SETCWD,
|
||||
SYSCALL_PORT_CREATE,
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef int pid_t;
|
||||
typedef int thread_id;
|
||||
typedef int region_id;
|
||||
typedef int aspace_id;
|
||||
typedef int proc_id;
|
||||
typedef int team_id;
|
||||
typedef int sem_id;
|
||||
typedef int port_id;
|
||||
typedef int image_id;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#define PORT_FLAG_USE_USER_MEMCPY 0x80000000
|
||||
|
||||
int port_init(kernel_args *ka);
|
||||
int delete_owned_ports(proc_id owner);
|
||||
int delete_owned_ports(team_id owner);
|
||||
|
||||
// temp: test
|
||||
void port_test(void);
|
||||
@@ -24,7 +24,7 @@ int user_close_port(port_id id);
|
||||
int user_delete_port(port_id id);
|
||||
port_id user_find_port(const char *port_name);
|
||||
int user_get_port_info(port_id id, struct port_info *info);
|
||||
int user_get_next_port_info(proc_id proc,
|
||||
int user_get_next_port_info(team_id team,
|
||||
uint32 *cookie,
|
||||
struct port_info *info);
|
||||
ssize_t user_port_buffer_size_etc(port_id port,
|
||||
@@ -37,7 +37,7 @@ ssize_t user_read_port_etc(port_id port,
|
||||
size_t buffer_size,
|
||||
uint32 flags,
|
||||
bigtime_t timeout);
|
||||
int user_set_port_owner(port_id port, proc_id proc);
|
||||
int user_set_port_owner(port_id port, team_id team);
|
||||
int user_write_port_etc(port_id port,
|
||||
int32 msg_code,
|
||||
void *msg_buffer,
|
||||
|
||||
@@ -24,12 +24,12 @@ int user_release_sem(sem_id id);
|
||||
int user_release_sem_etc(sem_id id, int count, int flags);
|
||||
int user_get_sem_count(sem_id id, int32* thread_count);
|
||||
int user_get_sem_info(sem_id, struct sem_info *, size_t);
|
||||
int user_get_next_sem_info(proc_id, uint32 *, struct sem_info *, size_t);
|
||||
int user_set_sem_owner(sem_id id, proc_id proc);
|
||||
int user_get_next_sem_info(team_id, uint32 *, struct sem_info *, size_t);
|
||||
int user_set_sem_owner(sem_id id, team_id team);
|
||||
|
||||
|
||||
int sem_init(kernel_args *ka);
|
||||
int sem_delete_owned_sems(proc_id owner);
|
||||
int sem_delete_owned_sems(team_id owner);
|
||||
int sem_interrupt_thread(struct thread *t);
|
||||
/* #endif */
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ struct ctlname {
|
||||
#ifdef _KERNEL_MODE
|
||||
typedef int (sysctlfn)(int *, uint, void *, size_t *, void *, size_t);
|
||||
|
||||
int kern_sysctl(int *, uint, void *, size_t *, void *, size_t);
|
||||
int sys_sysctl(int *, uint, void *, size_t *, void *, size_t);
|
||||
int hw_sysctl(int *, uint, void *, size_t *, void *, size_t);
|
||||
int sysctl_int (void *, size_t *, void *, size_t, int *);
|
||||
int sysctl_rdint (void *, size_t *, void *, int);
|
||||
|
||||
@@ -44,28 +44,28 @@ extern inline thread_id thread_get_current_thread_id(void) {
|
||||
}
|
||||
int thread_wait_on_thread(thread_id id, int *retcode);
|
||||
|
||||
thread_id thread_create_user_thread(char *name, proc_id pid, addr entry, void *args);
|
||||
thread_id thread_create_user_thread(char *name, team_id tid, addr entry, void *args);
|
||||
thread_id thread_create_kernel_thread(const char *name, int (*func)(void *args), void *args);
|
||||
|
||||
struct proc *proc_get_kernel_proc(void);
|
||||
proc_id proc_create_proc(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
int proc_kill_proc(proc_id);
|
||||
int proc_wait_on_proc(proc_id id, int *retcode);
|
||||
proc_id proc_get_kernel_proc_id(void);
|
||||
proc_id proc_get_current_proc_id(void);
|
||||
char **user_proc_get_arguments(void);
|
||||
int user_proc_get_arg_count(void);
|
||||
struct team *team_get_kernel_team(void);
|
||||
team_id team_create_team(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
int team_kill_team(team_id);
|
||||
int team_wait_on_team(team_id id, int *retcode);
|
||||
team_id team_get_kernel_team_id(void);
|
||||
team_id team_get_current_team_id(void);
|
||||
char **user_team_get_arguments(void);
|
||||
int user_team_get_arg_count(void);
|
||||
|
||||
// used in syscalls.c
|
||||
int user_thread_wait_on_thread(thread_id id, int *uretcode);
|
||||
proc_id user_proc_create_proc(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
int user_proc_wait_on_proc(proc_id id, int *uretcode);
|
||||
team_id user_team_create_team(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
int user_team_wait_on_team(team_id id, int *uretcode);
|
||||
|
||||
thread_id user_thread_create_user_thread(addr, proc_id, const char*,
|
||||
thread_id user_thread_create_user_thread(addr, team_id, const char*,
|
||||
int, void *);
|
||||
|
||||
int user_thread_snooze(bigtime_t time);
|
||||
int user_proc_get_table(struct proc_info *pi, size_t len);
|
||||
//int user_proc_get_table(struct proc_info *pi, size_t len);
|
||||
int user_getrlimit(int resource, struct rlimit * rlp);
|
||||
int user_setrlimit(int resource, const struct rlimit * rlp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user