summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-10-09 16:21:32 +0200
committerMiguel <m.i@gmx.at>2018-10-09 16:21:32 +0200
commit63e5017d9863d4ed215782e469e8ee2c6ff8473d (patch)
treef12d149ffa34e6a39f4bce4fe9a001e4ca8c6027 /userspace
parenta6a11437a390fb7e95fe995214d82bf5dbfe1eaf (diff)
fix pipers
Diffstat (limited to 'userspace')
-rw-r--r--userspace/bigmem.c14
-rw-r--r--userspace/files/file.txt40
-rw-r--r--userspace/fsh.c1
-rw-r--r--userspace/init.c9
-rw-r--r--userspace/xterm/xterm.c25
5 files changed, 69 insertions, 20 deletions
diff --git a/userspace/bigmem.c b/userspace/bigmem.c
new file mode 100644
index 0000000..5d474aa
--- /dev/null
+++ b/userspace/bigmem.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main()
+{
+ for(int i=1;i<100;i++)
+ {
+ printf("allocating memory: %d byte\n",i*1024*1024);
+ char *mem=calloc(i*1024*1024,1);
+ printf("OK (addr=0x%08X)",mem);
+ }
+
+ return EXIT_SUCCESS;
+}
diff --git a/userspace/files/file.txt b/userspace/files/file.txt
index 7a8a521..f42c4c8 100644
--- a/userspace/files/file.txt
+++ b/userspace/files/file.txt
@@ -80,7 +80,47 @@ both eyes so that they made a half-garland on the
projecting steel. There was no part of the hook
that a great fish could feel which was not sweet
smelling and good tasting.
+
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
+smelling and good tasting.
smelling and good tasting.
smelling and good tasting.
smelling and good tasting.
+Before it was really light he had his baits out
+and was drifting with the current. One bait was
+down forty fathoms. The second was at seventy-five
+and the third and fourth were down in the blue
+water at one hundred and one hundred and
+twenty-five fathoms. Each bait hung head down with
+the shank of the hook inside the bait fish, tied
+and sewed solid and all the projecting part of the
+hook, the curve and the point, was covered with
+fresh sardines. Each sardine was hooked through
+both eyes so that they made a half-garland on the
+projecting steel. There was no part of the hook
+that a great fish could feel which was not sweet
+smelling and good tasting.
diff --git a/userspace/fsh.c b/userspace/fsh.c
index 76c0954..0b3acfd 100644
--- a/userspace/fsh.c
+++ b/userspace/fsh.c
@@ -59,7 +59,6 @@ void prompt()
int main(int argc, char **argv)
{
- while(1);
for(int i=0;i<argc;i++)
{
diff --git a/userspace/init.c b/userspace/init.c
index a2b2425..1592d39 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -6,7 +6,10 @@
int main(int argc, char **argv)
{
- _execve("/bin/xterm",NULL,NULL);
+ char *argv1[]={"xterm","/bin/fsh",0};
+ char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
+
+ _execve("/bin/xterm",argv1,env1);
int pid=_fork();
@@ -45,8 +48,8 @@ int main(int argc, char **argv)
return 0;
//
- char *argv1[]={"/bin/fsh",0};
- char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
+// char *argv1[]={"/bin/fsh",0};
+ // char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
// loop forever and spawn shells if the top-shell exits
diff --git a/userspace/xterm/xterm.c b/userspace/xterm/xterm.c
index 31feea7..4680ab8 100644
--- a/userspace/xterm/xterm.c
+++ b/userspace/xterm/xterm.c
@@ -1,6 +1,6 @@
-#include <stdio.h>
+extern char**environ;
-int main()
+int main(int argc, char **argv)
{
_gui_win();
@@ -10,13 +10,11 @@ int main()
_pipe(xterm_in);
_pipe(xterm_out);
-
vesa_init();
void *tty=terminal_init_vesa();
int pid=_fork();
-
if(!pid)
{
_close(xterm_in[1]);
@@ -26,30 +24,25 @@ int main()
_dup2(xterm_out[1],1);// stdout
_dup2(xterm_out[1],2);// stderr
- while(1);
-
- char *argv1[]={"/bin/fsh",0};
- char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
+ _close(xterm_in[0]);
+ _close(xterm_out[1]);
- while(1);
-
- _execve("/bin/fsh",argv1,env1); // replace process with our foolshell :)
+ _execve(argv[1],argv,environ); // replace process with our foolshell or whatever
}
_close(xterm_in[0]);
_close(xterm_out[1]);
- _dup2(xterm_in[1],1); // compositor writes here.
-
- while(1);
+ _dup2(xterm_in[1],0); // compositor writes here.
+ _close(xterm_in[1]);
while(1)
{
char buf[1];
+
_read(xterm_out[0],buf,1); // show what foolshell writes to its stdout/stderr
- _gui_rect(); //lock
terminal_put(tty,buf[0]);
- _gui_rect(); //unlock
+ _gui_rect();
}
}