From a1d8d856935ed54dcc478d16017c9b43b97d1dec Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Sat, 24 Oct 2020 12:16:37 -0500 Subject: Get rid of stuff from other branch --- P2/lib/utils.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'P2/lib') diff --git a/P2/lib/utils.c b/P2/lib/utils.c index dffade8..79b309e 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -5,19 +5,6 @@ char *getChunkData(int mapperID) { // sends chunks of size 1024 to the mappers in RR fashion void sendChunkData(char *inputFile, int nMappers) { - msgBuffer message; - key_t key; - int msgid; - - // open message queue - msgid = msgget(key, 0666 | IPC_CREAT); - message -> msgText = 1; - FILE *fptr = fopen(inputFile, "r"); - - // construct chunks of 1024 bytes - while(fgets(message, chunkSize, fptr) != EOF) { - - } } // hash function to divide the list of word.txt files across reducers -- cgit v1.2.3 From 48853f86663bef3a85a0696be7275e775976d7f7 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Sat, 24 Oct 2020 12:26:14 -0500 Subject: Start new branch --- P2/lib/utils.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'P2/lib') diff --git a/P2/lib/utils.c b/P2/lib/utils.c index 79b309e..f164ee4 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -1,6 +1,10 @@ #include "utils.h" char *getChunkData(int mapperID) { + int mid; + key_t key = 10; + mid = msgget(); + } // sends chunks of size 1024 to the mappers in RR fashion -- cgit v1.2.3 From 2ab75f2342d4bdc0828aacb31679dc7810c69153 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Sat, 24 Oct 2020 12:36:50 -0500 Subject: Change dev enivronment --- P2/lib/utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'P2/lib') diff --git a/P2/lib/utils.c b/P2/lib/utils.c index f164ee4..2d15d0f 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -3,7 +3,11 @@ char *getChunkData(int mapperID) { int mid; key_t key = 10; - mid = msgget(); + mid = msgget(key, 0666); + if (mid < 0) { + perror("Cannot open queue.\n"); + exit(0); + } } -- cgit v1.2.3 From 62d9558a6e7dc6b98b2ef7fe83113040ffb24093 Mon Sep 17 00:00:00 2001 From: --global Date: Sat, 24 Oct 2020 14:18:54 -0500 Subject: Work on getData --- P2/lib/utils.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'P2/lib') 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 -- cgit v1.2.3 From fdb5b100ced8e7d6e09ac2db03ef6c7749ae5ad3 Mon Sep 17 00:00:00 2001 From: --global Date: Sat, 24 Oct 2020 14:39:56 -0500 Subject: Add C O M M E N T A R Y --- P2/lib/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'P2/lib') diff --git a/P2/lib/utils.c b/P2/lib/utils.c index b4e3b84..98239d5 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -3,7 +3,7 @@ char *getChunkData(int mapperID) { //Message struct msgBuffer* message; - //Queue ID + //Queue ID, not sure what it actually does int mid; //Queue Key key_t key = 10; -- cgit v1.2.3 From e6d0a88d284bcc89709bd9fea9469e11067b26fa Mon Sep 17 00:00:00 2001 From: --global Date: Sat, 24 Oct 2020 15:04:56 -0500 Subject: Lord please help --- P2/lib/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'P2/lib') diff --git a/P2/lib/utils.c b/P2/lib/utils.c index 98239d5..7d85c84 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -14,7 +14,8 @@ char *getChunkData(int mapperID) { } msgrcv(mid, (void *) &message, MSGSIZE, mapperID, 0); if (strcmp("END", message -> msgText)) { - msgsnd(mid, (void *) "ACK", 3, 0); + struct msgBuffer ACK = {mapperID, "ACK"}; + msgsnd(mid, (void *) &ACK, MSGSIZE, 0); } char* returnValue = message -> msgText; return returnValue; -- cgit v1.2.3 From 65b0073a95ddb0da9bddd67d5646f29eab6df1d4 Mon Sep 17 00:00:00 2001 From: --global Date: Sat, 24 Oct 2020 15:09:35 -0500 Subject: Comments --- P2/lib/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'P2/lib') diff --git a/P2/lib/utils.c b/P2/lib/utils.c index 7d85c84..a0f53bf 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -1,5 +1,6 @@ #include "utils.h" +//Receive from send and return the chonk char *getChunkData(int mapperID) { //Message struct msgBuffer* message; @@ -17,7 +18,7 @@ char *getChunkData(int mapperID) { struct msgBuffer ACK = {mapperID, "ACK"}; msgsnd(mid, (void *) &ACK, MSGSIZE, 0); } - char* returnValue = message -> msgText; + char *returnValue = message -> msgText; return returnValue; } -- cgit v1.2.3 From 2aca5ec021e0e8bc39da1dddb0b117726d867a39 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Sat, 24 Oct 2020 16:35:07 -0500 Subject: Get rid of variable --- P2/lib/utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'P2/lib') diff --git a/P2/lib/utils.c b/P2/lib/utils.c index a0f53bf..dba63b5 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -18,8 +18,7 @@ char *getChunkData(int mapperID) { struct msgBuffer ACK = {mapperID, "ACK"}; msgsnd(mid, (void *) &ACK, MSGSIZE, 0); } - char *returnValue = message -> msgText; - return returnValue; + return message -> msgText; } // sends chunks of size 1024 to the mappers in RR fashion -- cgit v1.2.3