libc: refactoring

This commit is contained in:
2019-11-28 02:35:52 +01:00
parent f104c46858
commit 4067cb45cb
75 changed files with 596 additions and 355 deletions

View File

@@ -17,7 +17,7 @@ void parent_read(int p[])
char buf[MSGSIZE];
// write link
close(p[1]);
sys_close(p[1]);
while (1) {
@@ -45,7 +45,7 @@ void parent_read(int p[])
printf("End of conversation\n");
// read link
close(p[0]);
sys_close(p[0]);
exit(0);
default:
@@ -62,7 +62,7 @@ void child_write(int p[])
int i;
// read link
close(p[0]);
sys_close(p[0]);
// write 3 times "hello" in 3 second interval
for (i = 0; i < 3; i++) {
@@ -74,7 +74,7 @@ void child_write(int p[])
write(p[1], msg2, MSGSIZE);
// here after write all bytes then write end
// doesn't close so read end block but
// doesn't sys_close so read end block but
// because of fcntl block doesn't happen..
exit(0);
}