mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
feat: Add SLAB allocator, Ramdisk, Kernel Namespaces, Event Tracing, NetFilter Firewall, 8-Bit Melodies, and Shell Scripting (sh)
This commit is contained in:
1 parent
9f9a19bab0
commit
2f1f785cee
17 files changed
+1021
-115
No files matched your search
@@ -0,0 +1,37 @@
|
||||
#ifndef _KERNEL_NAMESPACE_H
|
||||
#define _KERNEL_NAMESPACE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define CLONE_NEWPID 0x20000000
|
||||
#define CLONE_NEWUTS 0x04000000
|
||||
#define CLONE_NEWIPC 0x08000000
|
||||
#define CLONE_NEWNET 0x40000000
|
||||
#define CLONE_NEWNS 0x00020000
|
||||
|
||||
#define MAX_NAMESPACES 16
|
||||
|
||||
typedef struct uts_namespace {
|
||||
char hostname[64];
|
||||
char domainname[64];
|
||||
} uts_namespace_t;
|
||||
|
||||
typedef struct nsproxy {
|
||||
uint32_t id;
|
||||
char name[32];
|
||||
uts_namespace_t uts;
|
||||
uint32_t pid_offset;
|
||||
bool isolated_mounts;
|
||||
bool in_use;
|
||||
} nsproxy_t;
|
||||
|
||||
void namespace_init(void);
|
||||
nsproxy_t* namespace_create(const char* name, uint32_t flags);
|
||||
nsproxy_t* namespace_get_current(void);
|
||||
int namespace_switch(uint32_t id);
|
||||
size_t namespace_get_count(void);
|
||||
const nsproxy_t* namespace_get(size_t index);
|
||||
|
||||
#endif // _KERNEL_NAMESPACE_H
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef _KERNEL_TRACE_H
|
||||
#define _KERNEL_TRACE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define TRACE_BUFFER_SIZE 256
|
||||
#define TRACE_MSG_LEN 96
|
||||
|
||||
typedef enum {
|
||||
TRACE_CAT_SYS = 0,
|
||||
TRACE_CAT_IRQ,
|
||||
TRACE_CAT_SCHED,
|
||||
TRACE_CAT_MM,
|
||||
TRACE_CAT_NET,
|
||||
TRACE_CAT_FS,
|
||||
TRACE_CAT_MAX
|
||||
} trace_category_t;
|
||||
|
||||
typedef struct trace_entry {
|
||||
uint64_t timestamp;
|
||||
uint32_t cpu_id;
|
||||
uint32_t pid;
|
||||
trace_category_t category;
|
||||
char message[TRACE_MSG_LEN];
|
||||
} trace_entry_t;
|
||||
|
||||
void trace_init(void);
|
||||
void trace_record(trace_category_t cat, const char* msg);
|
||||
void trace_enable(bool enable);
|
||||
bool trace_is_enabled(void);
|
||||
void trace_clear(void);
|
||||
size_t trace_get_count(void);
|
||||
const trace_entry_t* trace_get_entry(size_t index);
|
||||
|
||||
#endif // _KERNEL_TRACE_H
|
||||
Reference in new issue
Block a user