diff options
author | Matt Strapp <strap012@umn.edu> | 2020-11-03 10:59:13 -0600 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-11-03 10:59:13 -0600 |
commit | 217aff99aa2483afad6869301bda70ec9517a6fb (patch) | |
tree | 2466256dead93bd3adcffe6eecaf45461505e2c3 /P2 | |
parent | h (diff) | |
download | csci4061-217aff99aa2483afad6869301bda70ec9517a6fb.tar csci4061-217aff99aa2483afad6869301bda70ec9517a6fb.tar.gz csci4061-217aff99aa2483afad6869301bda70ec9517a6fb.tar.bz2 csci4061-217aff99aa2483afad6869301bda70ec9517a6fb.tar.lz csci4061-217aff99aa2483afad6869301bda70ec9517a6fb.tar.xz csci4061-217aff99aa2483afad6869301bda70ec9517a6fb.tar.zst csci4061-217aff99aa2483afad6869301bda70ec9517a6fb.zip |
change queue seed
Diffstat (limited to 'P2')
-rw-r--r-- | P2/include/utils.h | 2 | ||||
-rw-r--r-- | P2/lib/utils.c | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/P2/include/utils.h b/P2/include/utils.h index d92e7a3..f0febed 100644 --- a/P2/include/utils.h +++ b/P2/include/utils.h @@ -23,7 +23,7 @@ struct msgBuffer { }; //Open Queue as a function because writing this once is probably better than four times. //Hopefully it works properly. -int openQueue(char* path); +int openQueue(); int closeQueue(int id); struct msgBuffer makeMessage(); // mapper side 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); |