summaryrefslogtreecommitdiff
path: root/src/user/app
diff options
context:
space:
mode:
authordzwdz2022-07-26 19:31:06 +0200
committerdzwdz2022-07-26 19:31:06 +0200
commita3e27d361919392eeb0086ed93b105d8301c7913 (patch)
tree91996a17172b650416bda82a472336b9d0edcdf0 /src/user/app
parent7a29c68ce0dc190cd6350746210441bc41d7da91 (diff)
user: move the POSIX-y stuff to the proper header files
Diffstat (limited to 'src/user/app')
-rw-r--r--src/user/app/init/driver/ansiterm.c2
-rw-r--r--src/user/app/init/driver/ps2.c2
-rw-r--r--src/user/app/init/driver/termcook.c5
-rw-r--r--src/user/app/init/driver/tmpfs.c2
-rw-r--r--src/user/app/init/main.c9
-rw-r--r--src/user/app/init/shell.c8
-rw-r--r--src/user/app/init/tests/main.c6
-rw-r--r--src/user/app/init/tests/pipe.c5
-rw-r--r--src/user/app/init/tests/semaphore.c6
-rw-r--r--src/user/app/init/tests/stress.c4
-rw-r--r--src/user/app/init/tests/tests.h (renamed from src/user/app/init/tests/main.h)2
-rw-r--r--src/user/app/testelf/main.c3
12 files changed, 30 insertions, 24 deletions
diff --git a/src/user/app/init/driver/ansiterm.c b/src/user/app/init/driver/ansiterm.c
index dde2183..4b66d6f 100644
--- a/src/user/app/init/driver/ansiterm.c
+++ b/src/user/app/init/driver/ansiterm.c
@@ -1,6 +1,6 @@
+#include "driver.h"
#include <camellia/syscalls.h>
#include <stdbool.h>
-#include <user/app/init/driver/driver.h>
struct vga_cell {
unsigned char c;
diff --git a/src/user/app/init/driver/ps2.c b/src/user/app/init/driver/ps2.c
index 45458c8..6aed2fb 100644
--- a/src/user/app/init/driver/ps2.c
+++ b/src/user/app/init/driver/ps2.c
@@ -1,7 +1,7 @@
+#include "driver.h"
#include <camellia/syscalls.h>
#include <shared/container/ring.h>
#include <stdbool.h>
-#include <user/app/init/driver/driver.h>
static const char keymap_lower[] = {
diff --git a/src/user/app/init/driver/termcook.c b/src/user/app/init/driver/termcook.c
index 868d5d3..59cef77 100644
--- a/src/user/app/init/driver/termcook.c
+++ b/src/user/app/init/driver/termcook.c
@@ -1,6 +1,7 @@
+#include "driver.h"
#include <camellia/syscalls.h>
-#include <user/app/init/driver/driver.h>
-#include <user/lib/stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
static void w_output(handle_t output, const char *buf, size_t len) {
size_t pos = 0;
diff --git a/src/user/app/init/driver/tmpfs.c b/src/user/app/init/driver/tmpfs.c
index 200e62d..83c42c7 100644
--- a/src/user/app/init/driver/tmpfs.c
+++ b/src/user/app/init/driver/tmpfs.c
@@ -1,7 +1,7 @@
#include <camellia/syscalls.h>
#include <shared/mem.h>
#include <stddef.h>
-#include <user/lib/malloc.h>
+#include <stdlib.h>
struct node {
const char *name;
diff --git a/src/user/app/init/main.c b/src/user/app/init/main.c
index 772a9e3..9c664a0 100644
--- a/src/user/app/init/main.c
+++ b/src/user/app/init/main.c
@@ -1,18 +1,15 @@
+#include "driver/driver.h"
#include <camellia/flags.h>
#include <camellia/syscalls.h>
#include <stdint.h>
-#include <user/app/init/driver/driver.h>
-#include <user/app/init/shell.h>
-#include <user/app/init/tests/main.h>
+#include <stdio.h>
+#include <unistd.h>
#include <user/lib/elfload.h>
#include <user/lib/fs/misc.h>
-#include <user/lib/stdlib.h>
__attribute__((visibility("hidden")))
extern char _image_base[];
-void read_file(const char *path, size_t len);
-
__attribute__((section(".text.startup")))
int main(void) {
elf_selfreloc();
diff --git a/src/user/app/init/shell.c b/src/user/app/init/shell.c
index 76a0dbc..0c8b9b4 100644
--- a/src/user/app/init/shell.c
+++ b/src/user/app/init/shell.c
@@ -1,9 +1,11 @@
+#include "shell.h"
+#include "tests/tests.h"
#include <camellia/syscalls.h>
#include <stdbool.h>
-#include <user/app/init/shell.h>
-#include <user/app/init/tests/main.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
#include <user/lib/elfload.h>
-#include <user/lib/stdlib.h>
static bool isspace(char c) {
return c == ' ' || c == '\t' || c == '\n';
diff --git a/src/user/app/init/tests/main.c b/src/user/app/init/tests/main.c
index 4f8e858..cf59925 100644
--- a/src/user/app/init/tests/main.c
+++ b/src/user/app/init/tests/main.c
@@ -1,10 +1,12 @@
#define TEST_MACROS
+#include "tests.h"
#include <camellia/errno.h>
#include <camellia/execbuf.h>
#include <camellia/flags.h>
#include <camellia/syscalls.h>
-#include <user/app/init/tests/main.h>
-#include <user/lib/stdlib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
static void run_forked(void (*fn)()) {
if (!fork()) {
diff --git a/src/user/app/init/tests/pipe.c b/src/user/app/init/tests/pipe.c
index 227007a..f7005f8 100644
--- a/src/user/app/init/tests/pipe.c
+++ b/src/user/app/init/tests/pipe.c
@@ -1,8 +1,9 @@
#define TEST_MACROS
+#include "tests.h"
#include <camellia/flags.h>
#include <camellia/syscalls.h>
-#include <user/app/init/tests/main.h>
-#include <user/lib/stdlib.h>
+#include <string.h>
+#include <unistd.h>
static const char *pipe_msgs[2] = {"hello", "world"};
diff --git a/src/user/app/init/tests/semaphore.c b/src/user/app/init/tests/semaphore.c
index b55db9e..fc0cc10 100644
--- a/src/user/app/init/tests/semaphore.c
+++ b/src/user/app/init/tests/semaphore.c
@@ -1,9 +1,11 @@
#define TEST_MACROS
+#include "tests.h"
#include <camellia/flags.h>
#include <camellia/syscalls.h>
-#include <user/app/init/tests/main.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
#include <user/lib/esemaphore.h>
-#include <user/lib/stdlib.h>
static void odd(handle_t out, struct evil_sem *sem1, struct evil_sem *sem2) {
_syscall_write(out, "1", 1, -1);
diff --git a/src/user/app/init/tests/stress.c b/src/user/app/init/tests/stress.c
index f797611..e620f0a 100644
--- a/src/user/app/init/tests/stress.c
+++ b/src/user/app/init/tests/stress.c
@@ -1,8 +1,8 @@
#define TEST_MACROS
+#include "tests.h"
#include <camellia/flags.h>
#include <camellia/syscalls.h>
-#include <user/app/init/tests/main.h>
-#include <user/lib/stdlib.h>
+#include <unistd.h>
static void run_forked(void (*fn)()) {
if (!fork()) {
diff --git a/src/user/app/init/tests/main.h b/src/user/app/init/tests/tests.h
index ed11c5e..23ed1e3 100644
--- a/src/user/app/init/tests/main.h
+++ b/src/user/app/init/tests/tests.h
@@ -1,4 +1,6 @@
#pragma once
+#include <camellia/syscalls.h>
+#include <stdio.h>
void stress_all(void);
void test_all(void);
diff --git a/src/user/app/testelf/main.c b/src/user/app/testelf/main.c
index 8c5b6a4..de7b965 100644
--- a/src/user/app/testelf/main.c
+++ b/src/user/app/testelf/main.c
@@ -1,8 +1,7 @@
#include <camellia/syscalls.h>
-#include <shared/printf.h>
+#include <stdio.h>
#include <user/lib/elf.h>
#include <user/lib/elfload.h>
-#include <user/lib/stdlib.h>
const char *str = "Hello!\n", *str2 = "World.\n";