Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <errno.h>
- #include <string.h>
- #include <signal.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <sys/wait.h>
- #define LEN 65000
- // 1 gig is 256 million ints
- int main()
- {
- char data[65000];
- int childpid = fork();
- if (childpid == 0) {
- int roura2 = open("/tmp/trubka", O_WRONLY);
- printf("Trubka otevrena PRO zapis %d\n", roura2);
- for (int i = 0; i < 1500000; i++) {
- int ret = write(roura2, data, sizeof(data));
- }
- }
- else {
- int roura = open("/tmp/trubka", O_RDONLY | O_NONBLOCK);
- printf("Trubka otevrena PRO CTENI %d\n", roura);
- for (int i = 0; i < 1500000; i++) {
- int ret2 = read(roura, data, sizeof(data));
- }
- }
- /* remove the FIFO */
- //close(roura);
- printf("end");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement