diff options
author | Niklas Halle <niklas@niklashalle.net> | 2020-05-21 14:11:38 +0200 |
---|---|---|
committer | Niklas Halle <niklas@niklashalle.net> | 2020-05-21 14:11:38 +0200 |
commit | 8da59918c22df70eaec28150867c7e8bfd4bc1ae (patch) | |
tree | 755641437d6a3edc4383ff185b92424429a6097d /02_exercise/beispiele | |
parent | 47f29d306e120f8233e87d43bccd8c97ccf88831 (diff) | |
download | betriebssysteme-8da59918c22df70eaec28150867c7e8bfd4bc1ae.tar.gz betriebssysteme-8da59918c22df70eaec28150867c7e8bfd4bc1ae.zip |
sdfghj
Diffstat (limited to '02_exercise/beispiele')
-rw-r--r-- | 02_exercise/beispiele/pipe_bidirect/log.txt | 22 | ||||
-rw-r--r-- | 02_exercise/beispiele/pipe_example/pipe.c | 16 |
2 files changed, 26 insertions, 12 deletions
diff --git a/02_exercise/beispiele/pipe_bidirect/log.txt b/02_exercise/beispiele/pipe_bidirect/log.txt index fbdc2c7..c59b0bb 100644 --- a/02_exercise/beispiele/pipe_bidirect/log.txt +++ b/02_exercise/beispiele/pipe_bidirect/log.txt @@ -1,5 +1,19 @@ -[15234]: ping -[15233]: pong -[15234]: ping -[15233]: pong +[3225581]: ping +[3225580]: pong +[3225581]: ping +[3225580]: pong +[3225581]: ping +[3225580]: pong +[3225581]: ping +[3225580]: pong +[3225581]: ping +[3225580]: pong +[3225581]: ping +[3225580]: pong +[3225581]: ping +[3225580]: pong +[3225581]: ping +[3225580]: pong +[3225581]: ping +[3225580]: pong Programmabbruch durch Nutzer diff --git a/02_exercise/beispiele/pipe_example/pipe.c b/02_exercise/beispiele/pipe_example/pipe.c index 3589c63..422e4d5 100644 --- a/02_exercise/beispiele/pipe_example/pipe.c +++ b/02_exercise/beispiele/pipe_example/pipe.c @@ -35,26 +35,26 @@ void term(const char *msg) { int main(void) { int ret = pipe(pipe_fds); - + if (ret < 0) term("Couldn't create pipe"); - + char out_buf[] = "hello"; ret = write(pipe_fds[1], out_buf, strlen(out_buf) + 1); - + if (ret < 0) term("Couldn't write to pipe"); - + printf("send msg: %s\n", out_buf); - + char in_buf[BUF_SIZE]; memset(in_buf, 0, BUF_SIZE); - + ret = read(pipe_fds[0], in_buf, BUF_SIZE - 1); - + if (ret < 0) term("Couldn't read from pipe"); - + printf("recv msg: %s\n", in_buf); return 0; } |