44 lines
1.1 KiB
C
44 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/mutex.h>
|
|
#include <proc/stream.h>
|
|
#include <sync/spin_lock.h>
|
|
|
|
#define PR_MUTEX 0
|
|
#define PR_STREAM 1
|
|
|
|
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_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
|