From 67ea99d7eb7adc88aed1eaa89015aef93b42683b Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Tue, 3 Nov 2020 08:31:55 -0600 Subject: Fix starting at 2 instead of 1 --- P2/lib/utils.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/P2/lib/utils.c b/P2/lib/utils.c index 297b72e..ab38470 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -40,7 +40,7 @@ void sendChunkData(char *inputFile, int nMappers) { struct msgBuffer message = makeMessage(); // open message queue int msgid = openQueue("map"); - int map = 1; + int map = 0; FILE* file = fopen(inputFile, "r"); // construct chunks of 1024 bytes while(fgets(message.msgText, chunkSize + 1, file) != NULL) { @@ -53,8 +53,6 @@ void sendChunkData(char *inputFile, int nMappers) { // DEBUG! fseek(file, (i - 1023), SEEK_CUR); - //The first mapper sent to is 2 instead of 1. - //Is this a problem? Probably not. message.msgType = (map++ % nMappers) + 1; printf("%s\n\n",message.msgText); msgsnd(msgid, &message, map, 0); -- cgit v1.2.3