From 217aff99aa2483afad6869301bda70ec9517a6fb Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Tue, 3 Nov 2020 10:59:13 -0600 Subject: change queue seed --- P2/lib/utils.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'P2/lib') diff --git a/P2/lib/utils.c b/P2/lib/utils.c index d98f30d..5c2a738 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -1,7 +1,9 @@ #include "utils.h" -int openQueue(char* path) { - return msgget(ftok(path, 253), 0666 | IPC_CREAT); +int openQueue() { + char cwd [50]; + getcwd(cwd, 50); + return msgget(ftok(cwd, 4061), 0666 | IPC_CREAT); } int closeQueue(int id) { return msgctl(id, IPC_RMID, NULL); @@ -78,7 +80,7 @@ int getInterData(char *Qkey, int reducerID) { struct msgBuffer message= makeMessage(); //DEBUG! make sure it work. // How do we traverse the directory if we're not given it as an arg? - int id = openQueue("reduce"); + int id = openQueue(); msgrcv(id, &message, chunkSize, reducerID, 0); *Qkey = *message.msgText; printf("%s\n", Qkey); @@ -91,7 +93,7 @@ void shuffle(int nMappers, int nReducers) { //Once again, MAKE SURE THIS WORKS PROPERLY! char path[50]; getcwd(path, 50); - int id = openQueue("reduce"); + int id = openQueue(); for (int i = 1; i <= nMappers; i++) { char newpath[100]; sprintf(newpath, "%s/output/MapOut/Map_%d", path, i); -- cgit v1.2.3