-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrc2.c
More file actions
25 lines (24 loc) · 669 Bytes
/
rc2.c
File metadata and controls
25 lines (24 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include"headers.h"
#include"request.h"
#include"declarations.h"
int main()
{
printf("rc1 begin\n",__func__);
request rq1;
result res1;
msg block;
int fd1,key;
key = msgget((key_t)222,0666|IPC_CREAT);
rq1.pid=getpid();
rq1.opr1=5;
rq1.opr2=6;
rq1.opt='-';
rq1.flag=1;
printf("rc2_pid :%d\n operation : %c\n",rq1.pid,rq1.opt);
fd1 = open("f1",O_WRONLY);
write(fd1,&rq1,sizeof(request));
printf("written into fifo 1\n");
msgrcv(key,&block,sizeof(block),rq1.pid,0);
printf("result of the 'sub' is %d\n",block.msg_rs);
printf("rc2 End\n");
}