diff options
author | Matt Strapp <strap012@umn.edu> | 2020-11-03 08:08:19 -0600 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-11-03 08:08:19 -0600 |
commit | 9a456fdf58cda4cd2395a9c88f3bf1826f9bc30f (patch) | |
tree | 395a0295ed89ddff27f394266a9347134f4fd718 /P2/lib | |
parent | Fix some more things, maybe (diff) | |
download | csci4061-9a456fdf58cda4cd2395a9c88f3bf1826f9bc30f.tar csci4061-9a456fdf58cda4cd2395a9c88f3bf1826f9bc30f.tar.gz csci4061-9a456fdf58cda4cd2395a9c88f3bf1826f9bc30f.tar.bz2 csci4061-9a456fdf58cda4cd2395a9c88f3bf1826f9bc30f.tar.lz csci4061-9a456fdf58cda4cd2395a9c88f3bf1826f9bc30f.tar.xz csci4061-9a456fdf58cda4cd2395a9c88f3bf1826f9bc30f.tar.zst csci4061-9a456fdf58cda4cd2395a9c88f3bf1826f9bc30f.zip |
getchunkdata is hella fucked
Diffstat (limited to '')
-rw-r--r-- | P2/lib/utils.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c index 63485a7..c12b1c5 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -15,17 +15,23 @@ struct msgBuffer makeMessage() { } char *getChunkData(int mapperID) { - printf("GETTING CHUNK DATA\n"); //Message struct msgBuffer message = makeMessage(); //Queue ID int mid = openQueue("map"); + printf("%d\n", mapperID); msgrcv(mid, &message, sizeof(message.msgText), mapperID, 0); - if (strncmp("END", message.msgText, 3)) { + // printf("\n%s\n", message.msgText); + // printf("%d\n", strncmp("END", message.msgText, 3)); + if (!strncmp("END", message.msgText, 3)) + { + printf("END\n"); return NULL; } char* value = message.msgText; - return value; + printf("%s\n", message.msgText); + // return value; + return &(message.msgText); } // sends chunks of size 1024 to the mappers in RR fashion @@ -53,7 +59,7 @@ void sendChunkData(char *inputFile, int nMappers) { msgsnd(msgid, &message, map, 0); } - for (int i = 1; i < nMappers; i++) { + for (int i = 1; i <= nMappers; i++) { struct msgBuffer END = {i, "END"}; msgsnd(msgid, &END, MSGSIZE, 0); } @@ -79,6 +85,7 @@ int getInterData(char *Qkey, int reducerID) { int id = openQueue("reduce"); msgrcv(id, &message, chunkSize, reducerID, 0); *Qkey = *message.msgText; + printf("%s\n", Qkey); return abs(strncmp("END", message.msgText, 3)); // if (strncmp("END", message.msgText, 3)) // { |