aboutsummaryrefslogtreecommitdiffstats
path: root/P2
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-11-03 09:17:48 -0600
committerMatt Strapp <strap012@umn.edu>2020-11-03 09:17:48 -0600
commitb9d8c289ffedf0118ea9ad2b7955722f11c27fc5 (patch)
treef9317452d1267508b0448359c0cd34a1fe89bcfd /P2
parentFix it? (diff)
downloadcsci4061-b9d8c289ffedf0118ea9ad2b7955722f11c27fc5.tar
csci4061-b9d8c289ffedf0118ea9ad2b7955722f11c27fc5.tar.gz
csci4061-b9d8c289ffedf0118ea9ad2b7955722f11c27fc5.tar.bz2
csci4061-b9d8c289ffedf0118ea9ad2b7955722f11c27fc5.tar.lz
csci4061-b9d8c289ffedf0118ea9ad2b7955722f11c27fc5.tar.xz
csci4061-b9d8c289ffedf0118ea9ad2b7955722f11c27fc5.tar.zst
csci4061-b9d8c289ffedf0118ea9ad2b7955722f11c27fc5.zip
write more
Diffstat (limited to 'P2')
-rw-r--r--P2/lib/utils.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index 06ab215..4b2e35f 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -91,18 +91,20 @@ int getInterData(char *Qkey, int reducerID) {
void shuffle(int nMappers, int nReducers) {
struct msgBuffer message = makeMessage();
//Once again, MAKE SURE THIS WORKS PROPERLY!
- char path[100];
- getcwd(path, 100);
+ char path[50];
+ getcwd(path, 50);
int id = openQueue("reduce");
for (int i = 1; i <= nMappers; i++) {
- char newpath[200];
+ char newpath[100];
sprintf(newpath, "%s/output/MapOut/Map_%d", path, i);
printf("%s\n", newpath);
DIR *dir = opendir(newpath);
struct dirent* entry;
while ((entry = readdir(dir)) != NULL) {
+ char newmsg[200];
if (!strcmp(".", entry->d_name) || !strcmp("..", entry->d_name))
continue;
+
message.msgType = hashFunction(entry -> d_name, nReducers);
printf("%ld\n", message.msgType);
msgsnd(id, &message, chunkSize, 0);