|
HomeCore 0.1.3 (07b5544)
Bare-metal personal computer firmware for Cortex-M
|
Per-session execution state shared by the shell and libc path hooks. More...
Data Structures | |
| struct | session_t |
| Execution state of one shell session. More... | |
Functions | |
| int | session_init (session_t *session, const user_t *user) |
| Initialize a session for a user in the user's home directory. | |
| int | session_chdir (session_t *session, const char *path) |
| Change a session's working directory. | |
| session_t * | session_current (void) |
| Get the current session. | |
| session_t * | session_set_current (session_t *session) |
| Make a session current. | |
Per-session execution state shared by the shell and libc path hooks.
One session is current at a time. It is stored in a single global pointer, which a future scheduler must make task-local. The default session runs as root with working directory /. These functions are not interrupt-safe.
Initialize a session for a user in the user's home directory.
| [out] | session | Session to initialize. Unchanged on failure. |
| user | Identity with a name and an absolute home directory. Must outlive the session. |
| 0 | The session is initialized with status 0. |
| -1 | errno is EINVAL for a missing argument, name, or home, or a relative home; otherwise it is set by session_chdir(). |
| int session_chdir | ( | session_t * | session, |
| const char * | path | ||
| ) |
Change a session's working directory.
| session | Session to update. |
| path | Absolute path, or a path relative to the current directory. |
| 0 | cwd now names the directory. |
| -1 | cwd is unchanged; errno is EINVAL, ENOENT, ENOTDIR, or ENAMETOOLONG. |
| session_t * session_current | ( | void | ) |
Get the current session.
libc path operations resolve relative paths against this session.
NULL.