42 logw(
"mutex",
"Tried to destroy non-existing mutex %u",
mutex);
45 else if(data->
state) {
72 logw(
"mutex",
"Tried to destroy non-existing mutex %u",
mutex);
75 else if(!data->
state) {
76 logw(
"mutex",
"Tried to unlock unlocked mutex %u",
mutex);
99 logd(
"mutex",
"Looking at the holder of %d",
mutex);
107 logw(
"mutex",
"Mutex %d was held by %d but we are unlocking, probably because the process is dead - mutex leak possible",
120 logw(
"mutex",
"Mutex namespace overflow!");
135 else if(data->
state) {
166 logw(
"mutex",
"Unexpected mutex_lock error - we checked the same conditions. Mutex %u, new holder %d, current state %s, held by %d",
193 else if(!data->
state) {
#define logd(component, fmt,...)
#define logw(component, fmt,...)
void sc_handle_locking_destroy_mutex(uint64_t mutex, uint64_t *error)
void mutex_destroy(mutex_t mutex)
void sc_handle_locking_unlock_mutex(uint64_t mutex, uint64_t *error)
pid_t holder
PID of the process who holds the current lock.
mutex_t mutex_create(void)
bool mutex_unlock(mutex_t mutex, pid_t holder)
static uint64_t next_mutex
void mutex_unlock_holder(pid_t pid)
int state
Current state of this mutex, 0 = unlocked.
void sc_handle_locking_create_mutex(uint64_t *mutex, uint64_t *error)
bool mutex_lock(mutex_t mutex, pid_t holder)
void sc_handle_locking_lock_mutex(uint64_t mutex, bool trylock, uint64_t *error)
void panic_message(const char *message)
void scheduler_wait_for(pid_t pid, enum wait_reason reason, union wait_data data)
void scheduler_waitable_done(enum wait_reason reason, union wait_data data, size_t max_amount)
volatile pid_t scheduler_current_process
static uint16_t bool uint64_t * error
tpa_t * tpa_new(allocator_t *alloc, uint64_t entry_size, uint64_t page_size, tpa_t *tpa)
size_t tpa_next(tpa_t *tpa, size_t cur)
void * tpa_get(tpa_t *tpa, uint64_t idx)
void tpa_set(tpa_t *tpa, uint64_t idx, void *data)