aboutsummaryrefslogtreecommitdiffstats
path: root/P2/lib
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-11-03 10:59:13 -0600
committerMatt Strapp <strap012@umn.edu>2020-11-03 10:59:13 -0600
commit217aff99aa2483afad6869301bda70ec9517a6fb (patch)
tree2466256dead93bd3adcffe6eecaf45461505e2c3 /P2/lib
parenth (diff)
downloadcsci4061-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 '')
-rw-r--r--P2/lib/utils.c10
1 files changed, 6 insertions, 4 deletions
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);