|
PatchworkOS
|
#include <kernel/fs/key.h>#include <kernel/cpu/syscalls.h>#include <kernel/drivers/rand.h>#include <kernel/log/panic.h>#include <kernel/sched/thread.h>#include <kernel/sched/timer.h>#include <kernel/sync/rwlock.h>#include <errno.h>#include <stdlib.h>Go to the source code of this file.
Functions | |
| static key_t | key_generate (void) |
| static void | key_timer_handler (interrupt_frame_t *frame, cpu_t *self) |
| void | key_init (void) |
| Initializes the key subsystem. | |
| uint64_t | key_share (key_t *key, file_t *file, clock_t timeout) |
| Generates a key that can be used to retrieve the file within the specified timeout. | |
| SYSCALL_DEFINE (SYS_SHARE, uint64_t, key_t *key, fd_t fd, clock_t timeout) | |
| file_t * | key_claim (key_t *key) |
| Claims a shared file using the provided key. | |
| SYSCALL_DEFINE (SYS_CLAIM, fd_t, key_t *key) | |
Variables | |
| static map_t | keyMap |
| static list_t | keyList |
| static rwlock_t | keyLock |
|
static |
Definition at line 17 of file key.c.
References ERR, keyLock, keyMap, map_get(), map_key_buffer(), NULL, panic(), rand_gen(), and RWLOCK_READ_SCOPE.
Referenced by key_share().
|
static |
Definition at line 35 of file key.c.
References DEREF, key_entry_t::entry, key_entry_t::expiry, key_entry_t::file, free(), key_entry_t::key, keyList, keyLock, keyMap, LIST_FOR_EACH_SAFE, list_remove(), map_key_buffer(), map_remove(), RWLOCK_WRITE_SCOPE, and timer_uptime().
Definition at line 177 of file key.c.
References DEREF_DEFER, EFAULT, ERR, errno, file, key_claim(), NULL, thread_t::process, sched_thread(), thread_copy_from_user(), vfs_ctx_alloc_fd(), and process_t::vfsCtx.
Definition at line 119 of file key.c.
References DEREF_DEFER, EBADF, EFAULT, ERR, errno, file, key_share(), NULL, thread_t::process, sched_thread(), process_t::space, space_check_access(), thread_copy_to_user(), vfs_ctx_get_file(), and process_t::vfsCtx.
|
static |
Definition at line 14 of file key.c.
Referenced by key_claim(), key_init(), key_share(), and key_timer_handler().
|
static |
Definition at line 15 of file key.c.
Referenced by key_claim(), key_generate(), key_init(), key_share(), and key_timer_handler().
|
static |
Definition at line 13 of file key.c.
Referenced by key_claim(), key_generate(), key_init(), key_share(), and key_timer_handler().