aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2017-04-19 11:37:40 +0200
committerAlex Auvolat <alex@adnab.me>2017-04-19 11:37:40 +0200
commit8e88e765ee17296a85c5ae372471ed248ce321db (patch)
tree94c375f5ec15d215dac16c6f9e386f24283c07df /src/lib
parent96da27494f89d75f8aec0c8894440c3f7482f54b (diff)
downloadkogata-8e88e765ee17296a85c5ae372471ed248ce321db.tar.gz
kogata-8e88e765ee17296a85c5ae372471ed248ce321db.zip
Mini reorganization
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/include/assert.h5
l---------src/lib/include/lua/lprefix.h1
-rw-r--r--src/lib/libc/debug.c1
-rw-r--r--src/lib/libc/stdio.c7
4 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/include/assert.h b/src/lib/include/assert.h
deleted file mode 100644
index 655d6f6..0000000
--- a/src/lib/include/assert.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#include <kogata/debug.h>
-
-/* vim: set sts=0 ts=4 sw=4 tw=0 noet :*/
diff --git a/src/lib/include/lua/lprefix.h b/src/lib/include/lua/lprefix.h
new file mode 120000
index 0000000..3c5a9cb
--- /dev/null
+++ b/src/lib/include/lua/lprefix.h
@@ -0,0 +1 @@
+../../lua/lprefix.h \ No newline at end of file
diff --git a/src/lib/libc/debug.c b/src/lib/libc/debug.c
index f862fe6..d88b204 100644
--- a/src/lib/libc/debug.c
+++ b/src/lib/libc/debug.c
@@ -4,6 +4,7 @@
#include <kogata/syscall.h>
#include <kogata/debug.h>
#include <kogata/printf.h>
+#include <kogata/mutex.h>
void sys_panic(const char* msg, const char* file, int line) {
dbg_printf("PANIC in user process\n %s\n at %s:%d\n", msg, file, line);
diff --git a/src/lib/libc/stdio.c b/src/lib/libc/stdio.c
index dcbcf83..864fb34 100644
--- a/src/lib/libc/stdio.c
+++ b/src/lib/libc/stdio.c
@@ -322,15 +322,18 @@ int fflush(FILE* stream) {
dbg_printf("FFLUSH %p\n", stream);
if (!(stream->file_mode & FM_WRITE)) return 0;
- if (stream == NULL || stream->fd == 0) return EOF;
+ if (stream == NULL || stream->fd == 0) {
+ return EOF;
+ }
if (stream->buf_mode != 0 && stream->out_buf_used > 0) {
size_t ret = sc_write(stream->fd, stream->pos, stream->out_buf_used, stream->out_buf);
- stream->out_buf_used = 0;
if (ret != stream->out_buf_used) {
return EOF;
}
+
+ stream->out_buf_used = 0;
if (!(stream->st.type & (FT_CHARDEV | FT_CHANNEL | FT_DIR))) {
stream->pos += ret;
}