adding environmental variables support
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@304 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -65,7 +65,7 @@ int sys_set_sem_owner(sem_id id, proc_id proc);
|
||||
|
||||
int sys_proc_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, int priority);
|
||||
proc_id sys_proc_create_proc(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);
|
||||
@@ -114,6 +114,9 @@ int sys_test_and_set(int *val, int set_to, int test_val);
|
||||
int sys_sysctl(int *, uint, void *, size_t *, void *, size_t);
|
||||
int sys_socket(int, int, int);
|
||||
|
||||
int sys_setenv(const char *, const char *, int);
|
||||
int sys_getenv(const char *, char **);
|
||||
|
||||
/* region prototypes */
|
||||
area_id sys_find_region_by_name(const char *);
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ struct proc {
|
||||
aspace_id _aspace_id;
|
||||
vm_address_space *aspace;
|
||||
vm_address_space *kaspace;
|
||||
addr user_env_base;
|
||||
struct thread *main_thread;
|
||||
struct thread *thread_list;
|
||||
struct arch_proc arch_info;
|
||||
|
||||
@@ -14,4 +14,6 @@
|
||||
|
||||
#define SYS_THREAD_ARG_LENGTH_MAX 255
|
||||
|
||||
#define SYS_THREAD_STRING_LENGTH_MAX 2048
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,7 +36,10 @@ extern "C" {
|
||||
* Size of the stack given to processes
|
||||
*/
|
||||
#define STACK_SIZE (PAGE_SIZE*16)
|
||||
|
||||
/**
|
||||
* Size of the environmental variables space for a process
|
||||
*/
|
||||
#define ENV_SIZE (PAGE_SIZE*8)
|
||||
|
||||
#define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1))
|
||||
#define ROUNDOWN(a, b) (((a) / (b)) * (b))
|
||||
|
||||
@@ -86,7 +86,9 @@ enum {
|
||||
SYSCALL_READ_DIR,
|
||||
SYSCALL_REWIND_DIR,
|
||||
SYSCALL_OPEN_DIR,
|
||||
SYSCALL_CREATE_DIR
|
||||
SYSCALL_CREATE_DIR,
|
||||
SYSCALL_SETENV,
|
||||
SYSCALL_GETENV /* 80 */
|
||||
};
|
||||
|
||||
int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret);
|
||||
|
||||
@@ -48,7 +48,7 @@ thread_id thread_create_user_thread(char *name, proc_id pid, addr entry, void *a
|
||||
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, int priority);
|
||||
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);
|
||||
@@ -58,7 +58,7 @@ int user_proc_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, int priority);
|
||||
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);
|
||||
|
||||
thread_id user_thread_create_user_thread(addr, proc_id, const char*,
|
||||
@@ -69,6 +69,9 @@ 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);
|
||||
|
||||
int user_setenv(const char *name, const char *value, int overwrite);
|
||||
int user_getenv(const char *name, char **value);
|
||||
|
||||
#if 1
|
||||
// XXX remove later
|
||||
int thread_test(void);
|
||||
|
||||
@@ -39,6 +39,8 @@ extern int optind;
|
||||
extern int optopt;
|
||||
extern int optreset;
|
||||
|
||||
extern char **environ;
|
||||
|
||||
off_t lseek(int, off_t, int);
|
||||
ssize_t read(int, void *, size_t);
|
||||
ssize_t pread(int, void *, size_t, off_t);
|
||||
|
||||
Reference in New Issue
Block a user