LF OS
Hobby operating system for amd64 with high ambitions
|
#include <tpa.h>
#include <vm.h>
#include <panic.h>
#include <mutex.h>
#include <log.h>
#include <scheduler.h>
#include <errno.h>
Go to the source code of this file.
Data Structures | |
struct | mutex_data |
Functions | |
void | init_mutex (void) |
mutex_t | mutex_create (void) |
void | mutex_destroy (mutex_t mutex) |
bool | mutex_lock (mutex_t mutex, pid_t holder) |
bool | mutex_unlock (mutex_t mutex, pid_t holder) |
void | mutex_unlock_holder (pid_t pid) |
void | sc_handle_locking_create_mutex (uint64_t *mutex, uint64_t *error) |
void | sc_handle_locking_destroy_mutex (uint64_t mutex, uint64_t *error) |
void | sc_handle_locking_lock_mutex (uint64_t mutex, bool trylock, uint64_t *error) |
void | sc_handle_locking_unlock_mutex (uint64_t mutex, uint64_t *error) |
Variables | |
static tpa_t * | mutexes |
static uint64_t | next_mutex = 1 |
struct mutex_data |
void init_mutex | ( | void | ) |
Definition at line 20 of file mutex.c.
References kernel_alloc, mutexes, and tpa_new().
mutex_t mutex_create | ( | void | ) |
Definition at line 24 of file mutex.c.
References mutexes, next_mutex, panic_message(), mutex_data::state, and tpa_set().
void mutex_destroy | ( | mutex_t | mutex | ) |
Definition at line 38 of file mutex.c.
References logw, mutex, mutexes, panic_message(), mutex_data::state, tpa_get(), and tpa_set().
Definition at line 52 of file mutex.c.
References mutex_data::holder, mutex, mutexes, panic_message(), mutex_data::state, and tpa_get().
Definition at line 68 of file mutex.c.
References mutex_data::holder, logw, mutex, wait_data::mutex, mutexes, panic_message(), scheduler_waitable_done(), mutex_data::state, tpa_get(), and wait_reason_mutex.
void mutex_unlock_holder | ( | pid_t | pid | ) |
Definition at line 95 of file mutex.c.
References mutex_data::holder, logd, logw, mutex, mutex_unlock(), mutexes, pid, mutex_data::state, tpa_get(), and tpa_next().
Definition at line 117 of file mutex.c.
References ENOMEM, error, logw, mutex, mutex_create(), and next_mutex.
Definition at line 128 of file mutex.c.
References EBUSY, EINVAL, error, mutex, mutex_destroy(), mutexes, mutex_data::state, and tpa_get().
Definition at line 144 of file mutex.c.
References EBUSY, EINVAL, error, mutex_data::holder, logw, mutex, wait_data::mutex, mutex_lock(), mutexes, scheduler_current_process, scheduler_wait_for(), mutex_data::state, tpa_get(), trylock, and wait_reason_mutex.
Definition at line 184 of file mutex.c.
References EINVAL, EPERM, error, mutex_data::holder, mutex, mutex_unlock(), mutexes, scheduler_current_process, mutex_data::state, and tpa_get().