Merge branch 'master' of gitlab.ibr.cs.tu-bs.de:vss/teaching/ws25/v_bsb2/Gruppe_003
This commit is contained in:
@@ -6,25 +6,25 @@ char sbuf[8194], rbuf[8194]; // (2 * 4KiB) + 2
|
||||
void main() {
|
||||
fork();
|
||||
fork();
|
||||
int other = fork();
|
||||
int ppid = sys_getpid();
|
||||
write(1, "app", 3, 0, ppid);
|
||||
//if (ppid == other) { // child
|
||||
// sbuf[0] = 3;
|
||||
// sbuf[8192] = sys_getpid();
|
||||
// sbuf[8193] = 1;
|
||||
// send(other, sbuf, 8193, rbuf, 8193);
|
||||
int other = fork();
|
||||
//write(1, "app", 3, 0, ppid);
|
||||
if (ppid == other) { // child
|
||||
sbuf[0] = 3;
|
||||
sbuf[8192] = sys_getpid();
|
||||
sbuf[8193] = 1;
|
||||
send(other, sbuf, 8193, rbuf, 8193);
|
||||
|
||||
// char msg[] = "REPLY: AA\n";
|
||||
// msg[7] += rbuf[0] + sbuf[8193];
|
||||
// msg[8] += 4 + ppid;
|
||||
// write(0, msg, 10);
|
||||
//} else { // parent
|
||||
// receive(rbuf, 8193);
|
||||
// rbuf[0] = rbuf[0] + rbuf[8192];
|
||||
// rbuf[8193] = 7;
|
||||
// reply(rbuf, 8193);
|
||||
//}
|
||||
char msg[] = "REPLY: AA\n";
|
||||
msg[7] += rbuf[0] + sbuf[8193];
|
||||
msg[8] += 4 + ppid;
|
||||
write(0, msg, 10,0, ppid);
|
||||
} else { // parent
|
||||
receive(rbuf, 8193);
|
||||
rbuf[0] = rbuf[0] + rbuf[8192];
|
||||
rbuf[8193] = 7;
|
||||
reply(rbuf, 8193);
|
||||
}
|
||||
|
||||
sys_exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user