aboutsummaryrefslogtreecommitdiffstats
path: root/P2
diff options
context:
space:
mode:
author--global <strap012@umn.edu>2020-10-24 14:18:54 -0500
committer--global <strap012@umn.edu>2020-10-24 14:18:54 -0500
commit62d9558a6e7dc6b98b2ef7fe83113040ffb24093 (patch)
tree9c5e724b47c657bff92911d1f9fca9201d199438 /P2
parentChange dev enivronment (diff)
downloadcsci4061-62d9558a6e7dc6b98b2ef7fe83113040ffb24093.tar
csci4061-62d9558a6e7dc6b98b2ef7fe83113040ffb24093.tar.gz
csci4061-62d9558a6e7dc6b98b2ef7fe83113040ffb24093.tar.bz2
csci4061-62d9558a6e7dc6b98b2ef7fe83113040ffb24093.tar.lz
csci4061-62d9558a6e7dc6b98b2ef7fe83113040ffb24093.tar.xz
csci4061-62d9558a6e7dc6b98b2ef7fe83113040ffb24093.tar.zst
csci4061-62d9558a6e7dc6b98b2ef7fe83113040ffb24093.zip
Work on getData
Diffstat (limited to 'P2')
-rw-r--r--P2/lib/utils.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index 2d15d0f..b4e3b84 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -1,14 +1,23 @@
#include "utils.h"
char *getChunkData(int mapperID) {
+ //Message
+ struct msgBuffer* message;
+ //Queue ID
int mid;
+ //Queue Key
key_t key = 10;
mid = msgget(key, 0666);
if (mid < 0) {
perror("Cannot open queue.\n");
- exit(0);
+ return NULL;
}
-
+ msgrcv(mid, (void *) &message, MSGSIZE, mapperID, 0);
+ if (strcmp("END", message -> msgText)) {
+ msgsnd(mid, (void *) "ACK", 3, 0);
+ }
+ char* returnValue = message -> msgText;
+ return returnValue;
}
// sends chunks of size 1024 to the mappers in RR fashion