feat: implement per-process environment variables (AI)
- Created env.c/h: key=value store with ENV_MAX_VARS=32 entries per process. Supports get, set, unset, and copy operations. - Added env_block_t and cwd[128] fields to process_t struct. - process_create() initializes CWD=/ by default. - Fork inherits environment via memcpy of the entire process_t. - Added SYS_GETENV (8) and SYS_SETENV (9) system calls. - Created env-test user app that verifies: CWD default, set/get, and inheritance across fork. - Updated kernel.c to launch 'sh' as init process (for next task). - Updated README.md to check off environment variables task. Tested: env-test reads CWD=/, sets TEST=hello, reads it back, forks child which inherits TEST=hello. All verified via QEMU.
This commit is contained in:
@@ -22,9 +22,11 @@
|
||||
#define SYS_YIELD 5 /**< Yield the CPU. */
|
||||
#define SYS_WAITPID 6 /**< Wait for a child process. pid=EBX. */
|
||||
#define SYS_EXEC 7 /**< Execute a program. path=EBX, argv=ECX. */
|
||||
#define SYS_GETENV 8 /**< Get environment variable. key=EBX, buf=ECX, bufsize=EDX. */
|
||||
#define SYS_SETENV 9 /**< Set environment variable. key=EBX, value=ECX. */
|
||||
|
||||
/** Total number of system calls. */
|
||||
#define NUM_SYSCALLS 8
|
||||
#define NUM_SYSCALLS 10
|
||||
|
||||
/**
|
||||
* Initialize the system call handler.
|
||||
|
||||
Reference in New Issue
Block a user