kernel: finish work of removing interruptible mutexes

This commit is contained in:
Matheus
2024-12-24 21:30:25 -03:00
parent 48643c4868
commit a6c169e5e6
42 changed files with 169 additions and 169 deletions
+5 -5
View File
@@ -24,7 +24,7 @@ pid_t proc_allocate_pid(void) {
}
proc_t *proc_get_from_pid(int pid) {
MUTEX_ACQUIRE(&proc_pid_table_mutex, false);
MUTEX_ACQUIRE(&proc_pid_table_mutex);
void *_proc = NULL;
hashtable_get(&pid_table, &_proc, &pid, sizeof(pid));
proc_t *proc = _proc;
@@ -37,7 +37,7 @@ proc_t *proc_get_from_pid(int pid) {
}
int proc_signal_all(int signal, proc_t *sender) {
MUTEX_ACQUIRE(&proc_pid_table_mutex, false);
MUTEX_ACQUIRE(&proc_pid_table_mutex);
pid_t senderpgid = sender ? jobctl_getpgid(sender) : 0;
@@ -108,7 +108,7 @@ proc_t *proc_create() {
proc->umask = 022; // default umask
// add to pid table
MUTEX_ACQUIRE(&proc_pid_table_mutex, false);
MUTEX_ACQUIRE(&proc_pid_table_mutex);
if (hashtable_set(&pid_table, proc, &proc->pid, sizeof(proc->pid), true)) {
MUTEX_RELEASE(&proc_pid_table_mutex);
free(proc->fd);
@@ -255,7 +255,7 @@ void proc_exit(void) {
itimer_pause(&proc->timer.profiling, NULL, NULL);
// zombify the proc
MUTEX_ACQUIRE(&proc->mutex, false);
MUTEX_ACQUIRE(&proc->mutex);
VOP_RELEASE(proc->root);
VOP_RELEASE(proc->cwd);
@@ -264,7 +264,7 @@ void proc_exit(void) {
proc_t *lastchild = proc->child;
MUTEX_ACQUIRE(&init_proc->mutex, false);
MUTEX_ACQUIRE(&init_proc->mutex);
int belowzombiecount = 0;
+1 -1
View File
@@ -35,7 +35,7 @@ syscallret_t syscall_fork(context_t *ctx) {
if (ret.errno)
goto cleanup;
MUTEX_ACQUIRE(&proc->mutex, false);
MUTEX_ACQUIRE(&proc->mutex);
nproc->parent = proc;
nproc->sibling = proc->child;
+2 -2
View File
@@ -72,7 +72,7 @@ syscallret_t syscall_futex(context_t *, uint32_t *futexp, int op, uint32_t value
if (ret.errno)
return ret;
MUTEX_ACQUIRE(&futexmutex, false);
MUTEX_ACQUIRE(&futexmutex);
bool doleave = true;
uint32_t word;
@@ -130,7 +130,7 @@ syscallret_t syscall_futex(context_t *, uint32_t *futexp, int op, uint32_t value
if (desc.event)
revents = desc.event->revents;
MUTEX_ACQUIRE(&futexmutex, false);
MUTEX_ACQUIRE(&futexmutex);
if (revents == 0 || ret.errno == EINTR) {
// timed out or interrupted
+1 -1
View File
@@ -85,7 +85,7 @@ syscallret_t syscall_openat(context_t *context, int dirfd, char *path, int flags
goto cleanup;
if (vnode->type == V_TYPE_REGULAR && (flags & O_TRUNC) && (flags & FILE_WRITE)) {
MUTEX_ACQUIRE(&vnode->size_lock, false);
MUTEX_ACQUIRE(&vnode->size_lock);
VOP_LOCK(vnode);
ret.errno = VOP_RESIZE(vnode, 0, &current_thread()->proc->cred);
+1 -1
View File
@@ -17,7 +17,7 @@ syscallret_t syscall_print(context_t *context, char *message) {
initialized = true;
}
MUTEX_ACQUIRE(&mutex, false);
MUTEX_ACQUIRE(&mutex);
arch_e9_puts(message);
arch_e9_putc('\n');
MUTEX_RELEASE(&mutex);
+2 -2
View File
@@ -36,7 +36,7 @@ syscallret_t syscall_getitimer(context_t *context, int which, itimerval_t *value
return ret;
}
MUTEX_ACQUIRE(&current_thread()->proc->timer.mutex, false);
MUTEX_ACQUIRE(&current_thread()->proc->timer.mutex);
uintmax_t oldremaining, oldrepeat;
itimer_pause(itimer, &oldremaining, &oldrepeat);
@@ -76,7 +76,7 @@ syscallret_t syscall_setitimer(context_t *context, int which, itimerval_t *unew,
return ret;
}
MUTEX_ACQUIRE(&current_thread()->proc->timer.mutex, false);
MUTEX_ACQUIRE(&current_thread()->proc->timer.mutex);
uintmax_t oldremaining, oldrepeat;
itimer_pause(itimer, &oldremaining, &oldrepeat);
+1 -1
View File
@@ -43,7 +43,7 @@ syscallret_t syscall_setsockopt(context_t *, int fd, int level, int optname, voi
socket_t *socket = SOCKFS_SOCKET_FROM_NODE(file->vnode);
MUTEX_ACQUIRE(&socket->mutex, false);
MUTEX_ACQUIRE(&socket->mutex);
switch (optname) {
case SO_BINDTODEVICE: {
if (val) {
+1 -1
View File
@@ -17,7 +17,7 @@ syscallret_t syscall_ftruncate(int fd, size_t size) {
goto cleanup;
}
MUTEX_ACQUIRE(&file->vnode->size_lock, false);
MUTEX_ACQUIRE(&file->vnode->size_lock);
VOP_LOCK(file->vnode);
ret.errno = VOP_RESIZE(file->vnode, size, &current_thread()->proc->cred);
+2 -2
View File
@@ -21,7 +21,7 @@ syscallret_t syscall_waitpid(context_t *context, pid_t pid, int *status, int opt
thread_t *thread = current_thread();
proc_t *proc = thread->proc;
MUTEX_ACQUIRE(&proc->mutex, false);
MUTEX_ACQUIRE(&proc->mutex);
proc_t *prev = NULL;
proc_t *iterator = proc->child;
@@ -53,7 +53,7 @@ syscallret_t syscall_waitpid(context_t *context, pid_t pid, int *status, int opt
ret.errno = EINTR;
return ret;
}
MUTEX_ACQUIRE(&proc->mutex, false);
MUTEX_ACQUIRE(&proc->mutex);
prev = NULL;
iterator = proc->child;
desired = NULL; // set as null to be certain another thread didn't get it
+1 -1
View File
@@ -72,7 +72,7 @@ static void timekeeper_sync_isr(isr_t *, context_t *) {
// their offsets to the passed microseconds of the calling CPU in ticks. this isn't 100% precise but its not
// exactly possible to be
void timekeeper_sync(void) {
MUTEX_ACQUIRE(&sync_mutex, false);
MUTEX_ACQUIRE(&sync_mutex);
bool int_status = interrupt_set(false);
sync_go_ahead = false;
+1 -1
View File
@@ -11,7 +11,7 @@ static MUTEX_DEFINE(allocate_mutex);
static SPINLOCK_DEFINE(tree_lock);
topology_node_t *topology_create_node(void) {
MUTEX_ACQUIRE(&allocate_mutex, false);
MUTEX_ACQUIRE(&allocate_mutex);
if (unlikely(slab_cache == NULL)) {
slab_cache = slab_newcache(sizeof(topology_node_t), 0, NULL, NULL);
__assert(slab_cache);