aboutsummaryrefslogtreecommitdiffstats
path: root/P2/lib
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-11-03 11:36:57 -0600
committerMatt Strapp <strap012@umn.edu>2020-11-03 11:36:57 -0600
commit6fe729ad0ce7d88f51e666bbf46aabd8bd5a2453 (patch)
treee73d6c8e32544acb07bb36a30648398ba53bfd88 /P2/lib
parentget rid of extra () (diff)
downloadcsci4061-6fe729ad0ce7d88f51e666bbf46aabd8bd5a2453.tar
csci4061-6fe729ad0ce7d88f51e666bbf46aabd8bd5a2453.tar.gz
csci4061-6fe729ad0ce7d88f51e666bbf46aabd8bd5a2453.tar.bz2
csci4061-6fe729ad0ce7d88f51e666bbf46aabd8bd5a2453.tar.lz
csci4061-6fe729ad0ce7d88f51e666bbf46aabd8bd5a2453.tar.xz
csci4061-6fe729ad0ce7d88f51e666bbf46aabd8bd5a2453.tar.zst
csci4061-6fe729ad0ce7d88f51e666bbf46aabd8bd5a2453.zip
help
Diffstat (limited to 'P2/lib')
-rw-r--r--P2/lib/utils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index af92853..0ff8b24 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -21,15 +21,15 @@ char *getChunkData(int mapperID) {
struct msgBuffer message = makeMessage();
//Queue ID
int mid = openQueue("map");
- // printf("%d\n", mapperID);
+ printf("MAPPER ID:%d\n", mapperID);
msgrcv(mid, &message, MSGSIZE, mapperID, 0);
// printf("\n%s\n", message.msgText);
// printf("%d\n", strncmp("END", message.msgText, 3));
- if (strncmp("END", message.msgText, 3) == 0)
+ if (strncmp("END", message.msgText, 4) == 0)
return NULL;
char* value = message.msgText;
// printf("%s\n", message.msgText);
- printf("RECEIVED CHUNK:%s\n", value);
+ printf("RECEIVED CHUNK:%s\nRECEIVED VALUE:%ld\n", value, message.msgType);
return value;
//return &(message.msgText);
}
@@ -38,7 +38,7 @@ char *getChunkData(int mapperID) {
void sendChunkData(char *inputFile, int nMappers) {
struct msgBuffer message = makeMessage();
// open message queue
- int msgid = openQueue("map");
+ int msgid = openQueue();
int map = 0;
FILE* file = fopen(inputFile, "r");
// construct chunks of 1024 bytes
@@ -53,7 +53,7 @@ void sendChunkData(char *inputFile, int nMappers) {
fseek(file, (i - 1023), SEEK_CUR);
message.msgType = (map++ % nMappers) + 1;
- printf("SENT CHUNK: %s\n",message.msgText);
+ printf("SENT CHUNK: %s\nSENT CHUNK MAPPER: %ld\n",message.msgText, message.msgType);
msgsnd(msgid, &message, MSGSIZE, 0);
}