xnoe-os/src/common/common.h

58 lines
1.2 KiB
C

#ifndef COMMON_H
#define COMMON_H
#include "../kernel/types.h"
#include <stdarg.h>
typedef enum {
File,
Directory,
CharacterDev,
BlockDev,
NoExist
} FSType;
typedef struct {
uint16_t length;
uint8_t* path;
} PathEntry;
typedef struct {
PathEntry path;
FSType type;
uint32_t sizeBytes;
} FSDirectoryEntry;
typedef struct {
uint32_t count;
uint32_t stringsLength;
FSDirectoryEntry entries[];
} FSDirectoryListing;
#define syscall_hdlr_0(a, b, c) \
a b();
#define syscall_hdlr_1(a, b, c, d, e) \
a b(d e);
#define syscall_hdlr_2(a, b, c, d, e, f, g) \
a b(d e, f g);
#define syscall_hdlr_3(a, b, c, d, e, f, g, h, i) \
a b(d e, f g, h i);
#include "syscalls.h"
char* getenv(char* key);
void setenv(char* key, char* value);
uint32_t strlen(char* s);
bool strcmp(char* a, char* b);
void memset(void* ptr, char c, uint32_t count);
void memcpy(void* dst, void* src, uint32_t count);
void print(char* string);
int int_to_decimal(unsigned int number, char* string_buffer);
int int_to_hex(unsigned int number, char* string_buffer);
void printf(const char* string, ...);
uint32_t exec(uint32_t fh);
uint32_t execv(uint32_t fh, char** argv);
#endif