Files
mop3/kernel/proc/resource.h
kamkow1 e5ebd7f3ba
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 2m21s
Build documentation / build-and-deploy (push) Successful in 54s
Use a big-lock for kernel sychronization instead of fine-grained locking
2026-04-27 18:06:02 +02:00

47 lines
1.1 KiB
C

#ifndef _KERNEL_PROC_RESOURCE_H
#define _KERNEL_PROC_RESOURCE_H
#include <libk/list.h>
#include <libk/rbtree.h>
#include <libk/std.h>
#include <proc/mail.h>
#include <proc/mutex.h>
#include <proc/stream.h>
#include <sync/spin_lock.h>
#define PR_MUTEX 0
#define PR_MAIL 1
#define PR_STREAM 2
struct proc;
struct procgroup;
struct cpu;
struct reschedule_ctx;
struct proc_resource {
int type;
int rid;
struct rb_node_link resource_tree_link;
union {
struct proc_mutex mutex;
struct proc_mail mail;
struct proc_stream stream;
} u;
struct {
void (*cleanup)(struct proc_resource* resource, struct reschedule_ctx* rctx);
} ops;
};
struct proc_resource* proc_find_resource(struct procgroup* procgroup, int rid);
struct proc_resource* proc_create_resource_mutex(struct procgroup* procgroup);
struct proc_resource* proc_create_resource_mail(struct procgroup* procgroup);
struct proc_resource* proc_create_resource_stream(struct procgroup* procgroup);
void proc_delete_resource(struct procgroup* procgroup, struct proc_resource* resource,
struct reschedule_ctx* rctx);
#endif // _KERNEL_PROC_RESOURCE_H