diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2017-11-24 18:31:06 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2017-11-24 18:31:06 -0500 |
commit | 257b96f8012a82e0fa2fb998e965e0a1712213c9 (patch) | |
tree | 83b0ca98e78a1bfa6afd7f71aead9333eef6ea25 | |
parent | 2177f0712fb47a95b2970c6838a4a4d978174b3b (diff) |
CS3871/assignments/sync: Fixed compiler errors
-rw-r--r-- | sync/reader.c | 6 | ||||
-rw-r--r-- | sync/writer.c | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/sync/reader.c b/sync/reader.c index edecf56..2870d15 100644 --- a/sync/reader.c +++ b/sync/reader.c @@ -4,6 +4,8 @@ #include <stdlib.h> #include <unistd.h> #include <stdio.h> +#include <time.h> +#include <sys/select.h> int main(argc, argv) @@ -12,8 +14,8 @@ char **argv; { int shmid, i, pid, id; char *mem, filename[50]; - FILE fd; - timeval *s; + FILE *fd; + struct timeval *s; if (argc != 1) { printf("usage: reader [id]\n"); diff --git a/sync/writer.c b/sync/writer.c index 0a7a1fe..deaa8d0 100644 --- a/sync/writer.c +++ b/sync/writer.c @@ -1,11 +1,12 @@ - #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> -#include <types.h> +#include <sys/types.h> +#include <sys/select.h> +#include <time.h> int main(argc, argv) @@ -14,7 +15,7 @@ char **argv; { int shmid, i, pid, id; char *mem; - timeval *s; + struct timeval *s; if (argc != 1) { printf("usage: reader [id]\n"); @@ -42,7 +43,7 @@ char **argv; while (1) { - s->tv_sec = rand() % (id * 2; + s->tv_sec = rand() % (id * 2); for (i = 0; i < 1<<14; i++) { mem[i]= 0x30 + id; select(0, NULL, NULL, NULL, s); |