|
PatchworkOS
|
Keys for sharing file descriptors between processes. More...
Data Structures | |
| struct | key_entry_t |
| Key entry. More... | |
Functions | |
| 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. | |
| file_t * | key_claim (key_t *key) |
| Claims a shared file using the provided key. | |
Keys for sharing file descriptors between processes.
Keys are used with the share() and claim() system calls to send files between processes.
Each key is a 64-bit one-time use randomly generated token that globally identifies a shared file.
Claims a shared file using the provided key.
| key | Pointer to the key identifying the shared file. |
NULL and errno is set. Definition at line 151 of file key.c.
References CONTAINER_OF, EINVAL, ENOENT, key_entry_t::entry, errno, key_entry_t::file, file, free(), keyList, keyLock, keyMap, list_remove(), map_get(), map_key_buffer(), map_remove(), NULL, and RWLOCK_WRITE_SCOPE.
Referenced by SYSCALL_DEFINE().
| void key_init | ( | void | ) |
Initializes the key subsystem.
Definition at line 60 of file key.c.
References ERR, keyList, keyLock, keyMap, list_init(), map_init(), NULL, panic(), and rwlock_init().
Referenced by vfs_init().
Generates a key that can be used to retrieve the file within the specified timeout.
| key | Output pointer to store the generated key. |
| file | The file to share. |
| timeout | The time until the shared file expires. If CLOCKS_NEVER, it never expires. |
ERR and errno is set. Definition at line 70 of file key.c.
References CLOCKS_NEVER, DEREF, EINVAL, key_entry_t::entry, ERR, errno, key_entry_t::expiry, key_entry_t::file, file, free(), key_entry_t::key, key_generate(), keyList, keyLock, keyMap, list_entry_init(), LIST_FOR_EACH, list_length(), list_prepend(), list_push(), malloc(), map_entry_init(), map_insert(), map_key_buffer(), key_entry_t::mapEntry, NULL, REF, RWLOCK_WRITE_SCOPE, and timer_uptime().
Referenced by SYSCALL_DEFINE().