summaryrefslogtreecommitdiff
path: root/src/user/lib/stdlib.h
blob: 1982e857bc8468328f0fcb69c80cd3de17e65d41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include <shared/mem.h>
#include <shared/types.h>
#include <stdbool.h>
#include <stddef.h>
#include <user/lib/malloc.h>

int printf(const char *fmt, ...);
int snprintf(char *str, size_t len, const char *fmt, ...);

int _klogf(const char *fmt, ...); // for kernel debugging only

typedef struct {
	int fd;
	int pos;
	bool eof;
} libc_file;
libc_file *file_open(const char *path, int flags);
libc_file *file_reopen(libc_file*, const char *path, int flags);
libc_file *file_clone(const libc_file*);
int file_read(libc_file*, char *buf, size_t len);
int file_write(libc_file*, const char *buf, size_t len);
void file_close(libc_file*);

extern libc_file *stdin, *stdout;

int fork(void);
int close(handle_t h);