41 lines
941 B
C
41 lines
941 B
C
#ifndef _KERNEL_PROC_RESOURCE_H
|
|
#define _KERNEL_PROC_RESOURCE_H
|
|
|
|
#include <libk/rbtree.h>
|
|
#include <libk/std.h>
|
|
#include <proc/mem.h>
|
|
#include <proc/mutex.h>
|
|
#include <sync/spin_lock.h>
|
|
|
|
#define PR_MEM 0
|
|
#define PR_MUTEX 1
|
|
|
|
#define RV_PRIVATE 0
|
|
#define RV_PUBLIC 1
|
|
|
|
struct proc;
|
|
struct proc_resource;
|
|
|
|
struct proc_resource {
|
|
int type;
|
|
int rid;
|
|
int visibility;
|
|
spin_lock_t lock;
|
|
atomic_int refs;
|
|
struct rb_node_link proc_resource_tree_link;
|
|
union {
|
|
struct proc_resource_mem mem;
|
|
struct proc_mutex mutex;
|
|
} u;
|
|
struct {
|
|
void (*cleanup) (struct proc* proc, struct proc_resource* resource);
|
|
} ops;
|
|
};
|
|
|
|
struct proc_resource* proc_create_resource (struct proc* proc, int rid, int type, int vis,
|
|
void* data);
|
|
void proc_drop_resource (struct proc* proc, struct proc_resource* resource);
|
|
void proc_cleanup_resources (struct proc* proc);
|
|
|
|
#endif // _KERNEL_PROC_RESOURCE_H
|