From 631fdbefc89a6202c5b8e2bf0e15a6ca7df809ef Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 20 Sep 2018 02:02:28 +0200 Subject: newlib and pipes --- userspace/Makefile | 1 + userspace/crt0.s | 2 +- userspace/fd.c | 9 +++++++++ userspace/nonl.c | 15 +++++++++++++++ userspace/sysfs_write.c | 2 +- 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 userspace/fd.c create mode 100644 userspace/nonl.c (limited to 'userspace') diff --git a/userspace/Makefile b/userspace/Makefile index d39f15f..b3c962b 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -45,6 +45,7 @@ ext2.img: $(PROGS) @mkdir -p mnt/bin @mkdir -p mnt/doc/test @mkdir -p mnt/sys # mountpoint for sysfs + @mkdir -p mnt/pipes # mountpoint for pipes @cp test.txt mnt/doc/test/ @cp $(PROGS) mnt/bin @cp fonts/binfont.bin mnt/ diff --git a/userspace/crt0.s b/userspace/crt0.s index 9ef2a67..26ad47c 100644 --- a/userspace/crt0.s +++ b/userspace/crt0.s @@ -31,7 +31,7 @@ call main # push exit code and pass to _exit syscall push %eax -call _exit +call exit # this should never be reached! .wait: diff --git a/userspace/fd.c b/userspace/fd.c new file mode 100644 index 0000000..09cb28e --- /dev/null +++ b/userspace/fd.c @@ -0,0 +1,9 @@ +#include +#include + +int main() +{ + dup(stdout); + printf("dup\n"); + +} diff --git a/userspace/nonl.c b/userspace/nonl.c new file mode 100644 index 0000000..3940453 --- /dev/null +++ b/userspace/nonl.c @@ -0,0 +1,15 @@ +#include +#include + +void atex() +{ + printf("atex\n"); +} +int main() +{ + printf("nonextline"); +// fflush(stdout); + +// atexit(&atex); + return EXIT_SUCCESS; +} diff --git a/userspace/sysfs_write.c b/userspace/sysfs_write.c index b35f063..9f91632 100644 --- a/userspace/sysfs_write.c +++ b/userspace/sysfs_write.c @@ -5,5 +5,5 @@ int main() uint32_t data=0xaabbccdd; fwrite(&data,4,1,f); // fclose(f); // not automatically by newlib? - fflush(f); +// fflush(f); } -- cgit v1.2.3