Files
mop3/kernel/proc/resource.h
kamkow1 c8fb575bdd
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 2m7s
Build documentation / build-and-deploy (push) Successful in 39s
Change formatting rules
2026-04-24 01:54:48 +02:00

48 lines
1.2 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;
spin_lock_t lock;
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