]> git.saurik.com Git - apple/xnu.git/blobdiff - tests/kqueue_file_tests.c
xnu-4903.270.47.tar.gz
[apple/xnu.git] / tests / kqueue_file_tests.c
index dcd2c4793593b3cce435095e3d5f6a73816f4a0d..6293e16c82556cc56bc837cd14f3c07fb46f83a5 100644 (file)
@@ -22,8 +22,8 @@
 #include <darwintest.h>
 
 T_GLOBAL_META(
-               T_META_NAMESPACE("xnu.kevent")
-               );
+       T_META_NAMESPACE("xnu.kevent")
+       );
 
 #define PDIR   "/tmp"
 #define DIR1   PDIR "/dir1"
@@ -32,24 +32,24 @@ T_GLOBAL_META(
 #define FILE1  PDIR "/file1"
 #define FILE2  PDIR "/file2"
 
-#define KEY    "somekey"
-#define VAL    "someval"
+#define KEY     "somekey"
+#define VAL     "someval"
 
-#define NOSLEEP                0
-#define SLEEP          1
-#define NO_EVENT       0
-#define YES_EVENT      1
+#define NOSLEEP         0
+#define SLEEP           1
+#define NO_EVENT        0
+#define YES_EVENT       1
 
 
-#define OUTPUT_LEVEL   0
-#define RESULT_LEVEL   3
+#define OUTPUT_LEVEL    0
+#define RESULT_LEVEL    3
 
-#define TEST_STRING    "Some text!!! Yes indeed, some of that very structure which has passed on man's knowledge for generations."
-#define HELLO_WORLD    "Hello, World!"
-#define USLEEP_TIME    5000
-#define WAIT_TIME      (4l)
-#define LENGTHEN_SIZE  500
-#define FIFO_SPACE     8192    /* FIFOS have 8K of buffer space */
+#define TEST_STRING     "Some text!!! Yes indeed, some of that very structure which has passed on man's knowledge for generations."
+#define HELLO_WORLD     "Hello, World!"
+#define USLEEP_TIME     5000
+#define WAIT_TIME       (4l)
+#define LENGTHEN_SIZE   500
+#define FIFO_SPACE      8192    /* FIFOS have 8K of buffer space */
 
 /*
  * These two variables are the non local memory for holding the return
@@ -62,17 +62,17 @@ int fifo_read_fd;
  * Types of actions for setup, cleanup, and execution of tests
  */
 typedef enum {CREAT, MKDIR, READ, WRITE, WRITEFD, FILLFD, UNLINK, LSKEE, RMDIR, MKFIFO, LENGTHEN, TRUNC,
-       SYMLINK, CHMOD, CHOWN, EXCHANGEDATA, RENAME, LSEEK, OPEN, MMAP, NOTHING,
-       SETXATTR, UTIMES, STAT, HARDLINK, REVOKE, FUNLOCK} action_id_t;
+             SYMLINK, CHMOD, CHOWN, EXCHANGEDATA, RENAME, LSEEK, OPEN, MMAP, NOTHING,
+             SETXATTR, UTIMES, STAT, HARDLINK, REVOKE, FUNLOCK} action_id_t;
 
-/* 
+/*
  * Directs an action as mentioned above
  */
 typedef struct _action {
-       int             act_dosleep;
-       action_id_t     act_id;
-       void            *act_args[5];
-       int             act_fd;
+       int             act_dosleep;
+       action_id_t     act_id;
+       void            *act_args[5];
+       int             act_fd;
 } action_t;
 
 /*
@@ -81,7 +81,7 @@ typedef struct _action {
  */
 typedef struct _test {
        char *t_testname;
-       
+
        /* Is this test an expected failure? */
        int t_known_failure;
 
@@ -89,39 +89,39 @@ typedef struct _test {
        int t_nondeterministic;
 
        /* Test kevent() or poll() */
-       int     t_is_poll_test; 
-       
+       int     t_is_poll_test;
+
        /* Actions for setting up test */
-       int      t_n_prep_actions;
+       int      t_n_prep_actions;
        action_t t_prep_actions[5];
-       
+
        /* Actions for cleaning up test */
-       int      t_n_cleanup_actions;
+       int      t_n_cleanup_actions;
        action_t t_cleanup_actions[5];
-       
+
        /* Action for thred to take while we wait */
        action_t t_helpthreadact;
-       
+
        /* File to look for event on */
-       char     *t_watchfile;  /* set event ident IN TEST (can't know fd beforehand)*/
-       int      t_file_is_fifo;/* FIFOs are handled in a special manner */
-       
+       char     *t_watchfile;  /* set event ident IN TEST (can't know fd beforehand)*/
+       int      t_file_is_fifo;/* FIFOs are handled in a special manner */
+
        /* Different parameters for poll() vs kevent() */
-       union { 
-               struct kevent   tu_kev;
-               short           tu_pollevents;
+       union {
+               struct kevent   tu_kev;
+               short           tu_pollevents;
        } t_union;
-       
+
        /* Do we expect results? */
-       int      t_want_event;
-       
+       int      t_want_event;
+
        /* Not always used--how much data should we find (EVFILT_{READ,WRITE}) */
-       int      t_nbytes;
-       
+       int      t_nbytes;
+
        /* Hacks for FILT_READ and pipes */
-       int      t_read_to_end_first;   /* Consume all data in file before waiting for event */
-       int      t_write_some_data;     /* Write some data to file before waiting for event (FIFO hack) */
-       int      t_extra_sleep_hack;    /* Sleep before waiting, to let a fifo fill up with data */
+       int      t_read_to_end_first;   /* Consume all data in file before waiting for event */
+       int      t_write_some_data;     /* Write some data to file before waiting for event (FIFO hack) */
+       int      t_extra_sleep_hack;    /* Sleep before waiting, to let a fifo fill up with data */
 } test_t;
 
 char *
@@ -189,75 +189,73 @@ get_action_name(action_id_t a)
  * Initialize an action struct.  Whether to sleep, what action to take,
  * and arguments for that action.
  */
-void 
-init_action(action_t *act, int sleep, action_id_t call, int nargs, ...) 
+void
+init_action(action_t *act, int sleep, action_id_t call, int nargs, ...)
 {
        int i;
        va_list ap;
        va_start(ap, nargs);
        act->act_dosleep = sleep;
        act->act_id = call;
-       
-       for (i = 0; i < nargs; i++)
-       {
+
+       for (i = 0; i < nargs; i++) {
                act->act_args[i] = va_arg(ap, void*);
        }
-       
+
        va_end(ap);
-       
 }
 
 /*
- * Opening a fifo is complicated: need to open both sides at once 
+ * Opening a fifo is complicated: need to open both sides at once
  */
 void *
-open_fifo_readside(void *arg) 
+open_fifo_readside(void *arg)
 {
        if ((fifo_read_fd = open((char*)arg, O_RDONLY)) == -1) {
                T_LOG("open(%s, O_RDONLY) failed: %d (%s)\n", arg, errno, strerror(errno));
        }
-       return (&fifo_read_fd);
+       return &fifo_read_fd;
 }
 
 /*
  * Open a fifo, setting read and write descriptors.  Return 0 for success, -1 for failure.
  * Only set FD args upon success; they will be unmodified on failure.
  */
-int 
-open_fifo(const char *path, int *readfd, int *writefd) 
+int
+open_fifo(const char *path, int *readfd, int *writefd)
 {
        pthread_t thread;
        int waitres;
        int res;
        int *tmpreadfd, tmpwritefd;
-       
+
        fifo_read_fd = -1;
        res = pthread_create(&thread, 0, open_fifo_readside, (void*)path);
        if (res == 0) {
                if ((tmpwritefd = open(path, O_WRONLY)) == -1) {
                        T_LOG("open(%s, O_WRONLY) failed: %d (%s)\n", path, errno, strerror(errno));
-                       return (-1);
+                       return -1;
                }
                waitres = pthread_join(thread, (void**) &tmpreadfd);
-               
+
                fcntl(tmpwritefd, F_SETFL, O_WRONLY | O_NONBLOCK);
-               
+
                if ((waitres == 0) && (tmpwritefd >= 0) && (*tmpreadfd >= 0)) {
                        *readfd = *tmpreadfd;
                        *writefd = tmpwritefd;
                } else {
-                       res = -1;       
+                       res = -1;
                }
        }
-       
+
        return res;
 }
 
 /*
  * Just concatenate a directory and a filename, sticking a "/" betwixt them
  */
-void 
-makepath(char *buf, const char *dir, const char *file) 
+void
+makepath(char *buf, const char *dir, const char *file)
 {
        strcpy(buf, dir);
        strcat(buf, "/");
@@ -267,8 +265,8 @@ makepath(char *buf, const char *dir, const char *file)
 
 /* Execute a prep, cleanup, or test action; specific tricky notes below.
  *
- * CREAT:      comes to life and given length 1
- * READ:       try to read one char
+ * CREAT:       comes to life and given length 1
+ * READ:        try to read one char
  * WRITE:      try to write TEST_STRING to file
  * LENGTHEN:   make longer by LENGTHEN_SIZE
  * MMAP:       mmap first 20 bytes of file, write HELLO_WORLD in
@@ -278,8 +276,8 @@ makepath(char *buf, const char *dir, const char *file)
  *
  * * Several of these have hard-coded sizes.
  */
-void* 
-execute_action(void *actionptr) 
+void*
+execute_action(void *actionptr)
 {
        action_t *act = (action_t*)actionptr;
        void **args = act->act_args;
@@ -289,186 +287,190 @@ execute_action(void *actionptr)
        void *addr;
        struct timeval tv;
        struct stat sstat;
-       
+
        T_LOG("Beginning action of type %d: %s\n", act->act_id, get_action_name(act->act_id));
-       
+
        /* Let other thread get into kevent() sleep */
-       if(SLEEP == act->act_dosleep) {
+       if (SLEEP == act->act_dosleep) {
                usleep(USLEEP_TIME);
        }
-       switch(act->act_id) {
-               case NOTHING:
-                       res = 0;
-                       break;
-               case CREAT:
-                       if ((tmpfd = creat((char*)args[0], 0755)) == -1) {
-                               T_LOG("creat() failed on \"%s\": %d (%s)\n", args[0], errno, strerror(errno));
-                               res = -1;
-                               break;
-                       }
-                       ftruncate(tmpfd, 1); /* So that mmap() doesn't fool us */
-                       close(tmpfd);
-                       res = 0;
-                       break;
-               case MKDIR:
-                       res = mkdir((char*)args[0], 0755);
-                       break;
-               case READ:
-                       if ((tmpfd = open((char*)args[0], O_RDONLY)) == -1) {
-                               T_LOG("open(%s, O_RDONLY) failed: %d (%s)\n", args[0], errno, strerror(errno));
-                               res = -1;
-                               break;
-                       }
-                       res = read(tmpfd, &c, 1);
-                       res = (res == 1 ? 0 : -1);
-                       close(tmpfd);
+       switch (act->act_id) {
+       case NOTHING:
+               res = 0;
+               break;
+       case CREAT:
+               if ((tmpfd = creat((char*)args[0], 0755)) == -1) {
+                       T_LOG("creat() failed on \"%s\": %d (%s)\n", args[0], errno, strerror(errno));
+                       res = -1;
                        break;
-               case WRITE:
-                       if ((tmpfd = open((char*)args[0], O_RDWR)) == -1) {
-                               T_LOG("open(%s, O_RDWR) failed: %d (%s)\n", args[0], errno, strerror(errno));
-                               res = -1;
-                               break;
-                       }
-                       res = write(tmpfd, TEST_STRING, strlen(TEST_STRING));
-                       if (res == strlen(TEST_STRING)) {
-                               res = 0;
-                       } else {
-                               res = -1;
-                       }
-                       close(tmpfd);
+               }
+               ftruncate(tmpfd, 1);         /* So that mmap() doesn't fool us */
+               close(tmpfd);
+               res = 0;
+               break;
+       case MKDIR:
+               res = mkdir((char*)args[0], 0755);
+               break;
+       case READ:
+               if ((tmpfd = open((char*)args[0], O_RDONLY)) == -1) {
+                       T_LOG("open(%s, O_RDONLY) failed: %d (%s)\n", args[0], errno, strerror(errno));
+                       res = -1;
                        break;
-               case WRITEFD:
-                       res = write((int)act->act_fd, TEST_STRING, strlen(TEST_STRING));
-                       if (res == strlen(TEST_STRING)) {
-                               res = 0;
-                       } else {
-                               res = -1;
-                       }
+               }
+               res = read(tmpfd, &c, 1);
+               res = (res == 1 ? 0 : -1);
+               close(tmpfd);
+               break;
+       case WRITE:
+               if ((tmpfd = open((char*)args[0], O_RDWR)) == -1) {
+                       T_LOG("open(%s, O_RDWR) failed: %d (%s)\n", args[0], errno, strerror(errno));
+                       res = -1;
                        break;
-               case FILLFD:
-                       while (write((int)act->act_fd, "a", 1) > 0);
+               }
+               res = write(tmpfd, TEST_STRING, strlen(TEST_STRING));
+               if (res == strlen(TEST_STRING)) {
                        res = 0;
+               } else {
+                       res = -1;
+               }
+               close(tmpfd);
+               break;
+       case WRITEFD:
+               res = write((int)act->act_fd, TEST_STRING, strlen(TEST_STRING));
+               if (res == strlen(TEST_STRING)) {
+                       res = 0;
+               } else {
+                       res = -1;
+               }
+               break;
+       case FILLFD:
+               while (write((int)act->act_fd, "a", 1) > 0) {
+                       ;
+               }
+               res = 0;
+               break;
+       case UNLINK:
+               res = unlink((char*)args[0]);
+               break;
+       case LSEEK:
+               res = lseek((int)act->act_fd, (int)args[0], SEEK_SET);
+               res = (res == (int)args[0] ? 0 : -1);
+               break;
+       case RMDIR:
+               res = rmdir((char*)args[0]);
+               break;
+       case MKFIFO:
+               res = mkfifo((char*)args[0], 0755);
+               break;
+       case LENGTHEN:
+               res = truncate((char*)args[0], LENGTHEN_SIZE);
+               break;
+       case TRUNC:
+               res = truncate((char*)args[0], 0);
+               break;
+       case SYMLINK:
+               res = symlink((char*)args[0], (char*)args[1]);
+               break;
+       case CHMOD:
+               res = chmod((char*)args[0], (int)args[1]);
+               break;
+       case CHOWN:
+               /* path, uid, gid */
+               res = chown((char*)args[0], (int) args[1], (int) args[2]);
+               break;
+       case EXCHANGEDATA:
+               res = exchangedata((char*)args[0], (char*)args[1], 0);
+               break;
+       case RENAME:
+               res = rename((char*)args[0], (char*)args[1]);
+               break;
+       case OPEN:
+               if ((tmpfd = open((char*)args[0], O_RDONLY | O_CREAT)) == -1) {
+                       T_LOG("open(%s, O_RDONLY | O_CREAT) failed: %d (%s)\n", args[0], errno, strerror(errno));
+                       res = -1;
                        break;
-               case UNLINK:
-                       res = unlink((char*)args[0]);
-                       break;
-               case LSEEK:
-                       res = lseek((int)act->act_fd, (int)args[0], SEEK_SET);
-                       res = (res == (int)args[0] ? 0 : -1);
-                       break;
-               case RMDIR:
-                       res = rmdir((char*)args[0]);
-                       break;
-               case MKFIFO:
-                       res = mkfifo((char*)args[0], 0755);
-                       break;
-               case LENGTHEN:
-                       res = truncate((char*)args[0], LENGTHEN_SIZE);
-                       break;
-               case TRUNC:
-                       res = truncate((char*)args[0], 0);
-                       break;
-               case SYMLINK:
-                       res = symlink((char*)args[0], (char*)args[1]);
-                       break;
-               case CHMOD:
-                       res = chmod((char*)args[0], (int)args[1]);
-                       break;
-               case CHOWN:
-                       /* path, uid, gid */
-                       res = chown((char*)args[0], (int) args[1], (int) args[2]);
-                       break;
-               case EXCHANGEDATA:
-                       res = exchangedata((char*)args[0], (char*)args[1], 0);
-                       break;
-               case RENAME:
-                       res = rename((char*)args[0], (char*)args[1]);
-                       break;
-               case OPEN:
-                       if ((tmpfd = open((char*)args[0], O_RDONLY | O_CREAT)) == -1) {
-                               T_LOG("open(%s, O_RDONLY | O_CREAT) failed: %d (%s)\n", args[0], errno, strerror(errno));
-                               res = -1;
-                               break;
-                       }
-                       res = close(tmpfd);
+               }
+               res = close(tmpfd);
+               break;
+       case MMAP:
+               /* It had best already exist with nonzero size */
+               if ((tmpfd = open((char*)args[0], O_RDWR)) == -1) {
+                       T_LOG("open(%s, O_RDWR) failed: %d (%s)\n", args[0], errno, strerror(errno));
+                       res = -1;
                        break;
-               case MMAP:
-                       /* It had best already exist with nonzero size */
-                       if ((tmpfd = open((char*)args[0], O_RDWR)) == -1) {
-                               T_LOG("open(%s, O_RDWR) failed: %d (%s)\n", args[0], errno, strerror(errno));
-                               res = -1;
-                               break;
-                       }
-                       addr = mmap(0, 20, PROT_WRITE | PROT_READ, MAP_FILE | MAP_SHARED, tmpfd, 0);
-                       if (addr != ((void*)-1)) {
-                               res = 0;
-                               if ((int)args[1]) {
-                                       strcpy((char*)addr, HELLO_WORLD);
-                                       msync(addr, 20, MS_SYNC);
-                               }
+               }
+               addr = mmap(0, 20, PROT_WRITE | PROT_READ, MAP_FILE | MAP_SHARED, tmpfd, 0);
+               if (addr != ((void*)-1)) {
+                       res = 0;
+                       if ((int)args[1]) {
+                               strcpy((char*)addr, HELLO_WORLD);
+                               msync(addr, 20, MS_SYNC);
                        }
-                       close(tmpfd);
-                       munmap(addr, 20);
-                       break;
-               case SETXATTR:
-                       res = setxattr((char*)args[0], KEY, (void*)VAL, strlen(VAL),
-                                                  0, 0);
-                       break;
-               case UTIMES:
-                       tv.tv_sec = time(NULL);
-                       tv.tv_usec = 0;
-                       res = utimes((char*)args[0], &tv); 
-                       break;
-               case STAT:
-                       res = lstat((char*)args[0], &sstat);
+               }
+               close(tmpfd);
+               munmap(addr, 20);
+               break;
+       case SETXATTR:
+               res = setxattr((char*)args[0], KEY, (void*)VAL, strlen(VAL),
+                   0, 0);
+               break;
+       case UTIMES:
+               tv.tv_sec = time(NULL);
+               tv.tv_usec = 0;
+               res = utimes((char*)args[0], &tv);
+               break;
+       case STAT:
+               res = lstat((char*)args[0], &sstat);
+               break;
+       case HARDLINK:
+               res = link((char*)args[0], (char*)args[1]);
+               break;
+       case REVOKE:
+               if ((tmpfd = open((char*)args[0], O_RDONLY)) == -1) {
+                       T_LOG("open(%s, O_RDONLY) failed: %d (%s)\n", args[0], errno, strerror(errno));
+                       res = -1;
                        break;
-               case HARDLINK:
-                       res = link((char*)args[0], (char*)args[1]);
+               }
+               res = revoke((char*)args[0]);
+               close(tmpfd);
+               break;
+       case FUNLOCK:
+               if ((tmpfd = open((char*)args[0], O_RDONLY)) == -1) {
+                       T_LOG("open(%s, O_RDONLY) failed: %d (%s)\n", args[0], errno, strerror(errno));
+                       res = -1;
                        break;
-               case REVOKE:
-                       if ((tmpfd = open((char*)args[0], O_RDONLY)) == -1) {
-                               T_LOG("open(%s, O_RDONLY) failed: %d (%s)\n", args[0], errno, strerror(errno));
-                               res = -1;
-                               break;
-                       }
-                       res = revoke((char*)args[0]);
+               }
+               if ((res = flock(tmpfd, LOCK_EX)) == -1) {
+                       T_LOG("flock() LOCK_EX failed: %d (%s)\n", errno, strerror(errno));
                        close(tmpfd);
                        break;
-               case FUNLOCK:
-                       if ((tmpfd = open((char*)args[0], O_RDONLY)) == -1) {
-                               T_LOG("open(%s, O_RDONLY) failed: %d (%s)\n", args[0], errno, strerror(errno));
-                               res = -1;
-                               break;
-                       }                               
-                       if ((res = flock(tmpfd, LOCK_EX)) == -1) {
-                               T_LOG("flock() LOCK_EX failed: %d (%s)\n", errno, strerror(errno));
-                               close(tmpfd);
-                               break;
-                       }
-                       if ((res = flock(tmpfd, LOCK_UN)) == -1) {
-                               T_LOG("flock() LOCK_UN failed: %d (%s)\n", errno, strerror(errno));
-                               close(tmpfd);
-                               break;
-                       }
+               }
+               if ((res = flock(tmpfd, LOCK_UN)) == -1) {
+                       T_LOG("flock() LOCK_UN failed: %d (%s)\n", errno, strerror(errno));
                        close(tmpfd);
                        break;
-               default:
-                       res = -1;
-                       break;
+               }
+               close(tmpfd);
+               break;
+       default:
+               res = -1;
+               break;
        }
 
        thread_status = res;
-       return (&thread_status);
+       return &thread_status;
 }
 
 /*
  * Read until the end of a file, for EVFILT_READ purposes (considers file position)
  */
-void 
-read_to_end(int fd) 
+void
+read_to_end(int fd)
 {
        char buf[50];
-       while (read(fd, buf, sizeof(buf)) > 0);
+       while (read(fd, buf, sizeof(buf)) > 0) {
+               ;
+       }
 }
 
 /*
@@ -476,15 +478,15 @@ read_to_end(int fd)
  * of actions.  "failout" parameter indicates whether to stop if one fails.
  */
 int
-execute_action_list(action_t *actions, int nactions, int failout) 
+execute_action_list(action_t *actions, int nactions, int failout)
 {
        int i, res;
        for (i = 0, res = 0; (0 == res || (!failout)) && (i < nactions); i++) {
                T_LOG("Starting prep action %d\n", i);
                res = *((int *) execute_action(&(actions[i])));
-               if(res != 0) {
+               if (res != 0) {
                        T_LOG("Action list failed on step %d. res = %d errno = %d (%s)\n", i, res,
-                               errno, strerror(errno));
+                           errno, strerror(errno));
                } else {
                        T_LOG("Action list work succeeded on step %d.\n", i);
                }
@@ -507,13 +509,13 @@ execute_test(test_t *test)
        int *status;
 
        memset(&evlist, 0, sizeof(evlist));
-       
+
        T_LOG("[BEGIN] %s\n", test->t_testname);
 
        T_LOG(test->t_want_event ? "Expecting an event.\n" : "Not expecting events.\n");
-       
+
        res = execute_action_list(test->t_prep_actions, test->t_n_prep_actions, 1);
-       
+
        /* If prep succeeded */
        if (0 == res) {
                /* Create kqueue for kqueue tests*/
@@ -522,9 +524,8 @@ execute_test(test_t *test)
                                T_LOG("kqueue() failed: %d (%s)\n", errno, strerror(errno));
                        }
                }
-               
+
                if ((test->t_is_poll_test) || kqfd >= 0) {
-                       
                        /* Open the file we're to monitor.  Fifos get special handling */
                        if (test->t_file_is_fifo) {
                                filefd = -1;
@@ -532,19 +533,19 @@ execute_test(test_t *test)
                        } else {
                                if ((filefd = open(test->t_watchfile, O_RDONLY | O_SYMLINK)) == -1) {
                                        T_LOG("open() of watchfile %s failed: %d (%s)\n", test->t_watchfile,
-                                             errno, strerror(errno));
+                                           errno, strerror(errno));
                                }
                        }
-                       
+
                        if (filefd >= 0) {
                                T_LOG("Opened file to monitor.\n");
-                               
-                               /* 
-                                * Fill in the fd to monitor once you know it 
+
+                               /*
+                                * Fill in the fd to monitor once you know it
                                 * If it's a fifo test, then the helper is definitely going to want the write end.
                                 */
                                test->t_helpthreadact.act_fd = (writefd >= 0 ? writefd : filefd);
-                               
+
                                if (test->t_read_to_end_first) {
                                        read_to_end(filefd);
                                } else if (test->t_write_some_data) {
@@ -553,18 +554,18 @@ execute_test(test_t *test)
                                        dowr.act_fd = writefd;
                                        (void)execute_action(&dowr);
                                }
-                               
+
                                /* Helper modifies the file that we're listening on (sleeps first, in general) */
                                thread_status = 0;
                                res = pthread_create(&thr, NULL, execute_action, (void*) &test->t_helpthreadact);
                                if (0 == res) {
                                        T_LOG("Created helper thread.\n");
-                                       
+
                                        /* This is ugly business to hack on filling up a FIFO */
                                        if (test->t_extra_sleep_hack) {
                                                usleep(USLEEP_TIME);
                                        }
-                                       
+
                                        if (test->t_is_poll_test) {
                                                struct pollfd pl;
                                                pl.fd = filefd;
@@ -576,11 +577,11 @@ execute_test(test_t *test)
                                                        res = cnt;
                                                }
                                        } else {
-                                               test->t_union.tu_kev.ident = filefd; 
-                                               cnt = kevent(kqfd, &test->t_union.tu_kev, 1, &evlist, 1,  &ts);
+                                               test->t_union.tu_kev.ident = filefd;
+                                               cnt = kevent(kqfd, &test->t_union.tu_kev, 1, &evlist, 1, &ts);
                                                T_LOG("Finished kevent() call.\n");
-                                               
-                                               if ((cnt < 0) || (evlist.flags & EV_ERROR))  {
+
+                                               if ((cnt < 0) || (evlist.flags & EV_ERROR)) {
                                                        T_LOG("kevent() call failed.\n");
                                                        if (cnt < 0) {
                                                                T_LOG("error is in errno, %s\n", strerror(errno));
@@ -590,13 +591,13 @@ execute_test(test_t *test)
                                                        res = cnt;
                                                }
                                        }
-                                       
+
                                        /* Success only if you've succeeded to this point AND joined AND other thread is happy*/
                                        status = NULL;
                                        res2 = pthread_join(thr, (void **)&status);
                                        if (res2 != 0) {
                                                T_LOG("Couldn't join helper thread: %d (%s).\n", res2,
-                                                       strerror(res2));
+                                                   strerror(res2));
                                        } else if (*status) {
                                                T_LOG("Helper action had result %d\n", *status);
                                        }
@@ -604,7 +605,7 @@ execute_test(test_t *test)
                                } else {
                                        T_LOG("Couldn't start thread: %d (%s).\n", res, strerror(res));
                                }
-                               
+
                                close(filefd);
                                if (test->t_file_is_fifo) {
                                        close(writefd);
@@ -621,24 +622,23 @@ execute_test(test_t *test)
                        res = -1;
                }
        }
-       
+
        /* Cleanup work */
        execute_action_list(test->t_cleanup_actions, test->t_n_cleanup_actions, 0);
-       
+
        /* Success if nothing failed and we either received or did not receive event,
-        * as expected 
+        * as expected
         */
        if (0 == res) {
                T_LOG(cnt > 0 ? "Got an event.\n" : "Did not get an event.\n");
                if (((cnt > 0) && (test->t_want_event)) || ((cnt == 0) && (!test->t_want_event))) {
                        if ((!test->t_is_poll_test) && (test->t_union.tu_kev.filter == EVFILT_READ || test->t_union.tu_kev.filter == EVFILT_WRITE)
-                               && (test->t_nbytes) && (test->t_nbytes != evlist.data)) {
+                           && (test->t_nbytes) && (test->t_nbytes != evlist.data)) {
                                T_LOG("Read wrong number of bytes available.  Wanted %d, got %d\n", test->t_nbytes, evlist.data);
                                retval = -1;
                        } else {
                                retval = 0;
                        }
-                       
                } else {
                        T_LOG("Got unexpected event or lack thereof.\n");
                        retval = -1;
@@ -650,7 +650,7 @@ execute_test(test_t *test)
 
        if (test->t_nondeterministic) {
                T_LOG("XXX non-deterministic test result = %d (%s)\n", retval,
-                       (retval == 0) ? "pass" : "fail");
+                   (retval == 0) ? "pass" : "fail");
                T_MAYFAIL;
        } else {
                if (test->t_known_failure) {
@@ -666,7 +666,7 @@ execute_test(test_t *test)
        }
 
        T_LOG("Test %s done with result %d.\n", test->t_testname, retval);
-       return (retval);
+       return retval;
 }
 
 
@@ -682,7 +682,7 @@ init_test_common(test_t *tst, char *testname, char *watchfile, int nprep, int nc
        tst->t_n_prep_actions = nprep;
        tst->t_n_cleanup_actions = nclean;
        tst->t_want_event = (want > 0);
-       
+
        if (ispoll) {
                tst->t_is_poll_test = 1;
                tst->t_union.tu_pollevents = (short)event;
@@ -703,9 +703,9 @@ init_test_common(test_t *tst, char *testname, char *watchfile, int nprep, int nc
  *
  * "want" does double duty as whether you want an event and how many bytes you might want to read
  * "event" is either an event flag (e.g. NOTE_WRITE) or EVFILT_READ
- */    
-void 
-init_test(test_t *tst, char *testname, char *watchfile, int nprep, int nclean, int event, int want) 
+ */
+void
+init_test(test_t *tst, char *testname, char *watchfile, int nprep, int nclean, int event, int want)
 {
        init_test_common(tst, testname, watchfile, nprep, nclean, event, want, 0);
 }
@@ -714,28 +714,28 @@ init_test(test_t *tst, char *testname, char *watchfile, int nprep, int nclean, i
  * Same as above, but for a poll() test
  */
 void
-init_poll_test(test_t *tst, char *testname, char *watchfile, int nprep, int nclean, int event, int want) 
+init_poll_test(test_t *tst, char *testname, char *watchfile, int nprep, int nclean, int event, int want)
 {
        init_test_common(tst, testname, watchfile, nprep, nclean, event, want, 1);
 }
 
-void 
-run_note_delete_tests() 
+void
+run_note_delete_tests()
 {
        test_t test;
-       
+
        init_test(&test, "1.1.2: unlink a file", FILE1, 1, 0, NOTE_DELETE, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "1.1.3: rmdir a dir", DIR1, 1, 0, NOTE_DELETE, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "1.1.4: rename one file over another", FILE2, 2, 1, NOTE_DELETE, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
@@ -743,7 +743,7 @@ run_note_delete_tests()
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "1.1.5: rename one dir over another", DIR2, 2, 1, NOTE_DELETE, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
@@ -751,14 +751,14 @@ run_note_delete_tests()
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)DIR1, (void*)DIR2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR2, NULL);
        execute_test(&test);
-       
+
        /* Do FIFO stuff here */
        init_test(&test, "1.1.6: make a fifo, unlink it", FILE1, 1, 0, NOTE_DELETE, YES_EVENT);
        test.t_file_is_fifo = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 1, (void*)FILE1);
        execute_test(&test);
-       
+
        init_test(&test, "1.1.7: rename a file over a fifo", FILE1, 2, 1, NOTE_DELETE, YES_EVENT);
        test.t_nondeterministic = 1;
        test.t_file_is_fifo = 1;
@@ -767,7 +767,7 @@ run_note_delete_tests()
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE2, (void*)FILE1);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "1.1.8: unlink a symlink to a file", FILE2, 2, 1, NOTE_DELETE, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
@@ -775,34 +775,34 @@ run_note_delete_tests()
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)FILE2, NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        /* ================= */
-       
+
        init_test(&test, "1.2.1: Straight-up rename file", FILE1, 1, 1, NOTE_DELETE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2); 
+       init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "1.2.2: Straight-up rename dir", DIR1, 1, 1, NOTE_DELETE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)DIR1, (void*)DIR2); 
+       init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)DIR1, (void*)DIR2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR2, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "1.2.3: Null action on file", FILE1, 1, 1, NOTE_DELETE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 2, NULL, NULL); /* The null action */
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "1.2.4: Rename one file over another: watch the file that lives", FILE1, 2, 1, NOTE_DELETE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, CREAT, 2, (void*)FILE2, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "1.2.5: Rename one dir over another, watch the dir that lives", DIR1, 2, 1, NOTE_DELETE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, MKDIR, 2, (void*)DIR2, (void*)NULL);
@@ -815,24 +815,24 @@ path_on_apfs(const char *path)
 {
        struct statfs sfs = {};
        T_QUIET; T_ASSERT_POSIX_SUCCESS(statfs(path, &sfs), NULL);
-       return (memcmp(&sfs.f_fstypename[0], "apfs", strlen("apfs")) == 0);
+       return memcmp(&sfs.f_fstypename[0], "apfs", strlen("apfs")) == 0;
 }
 
-void 
+void
 run_note_write_tests()
 {
        char pathbuf[50];
        char otherpathbuf[50];
-       
+
        test_t test;
-       
+
        init_test(&test, "2.1.1: Straight-up write to a file", FILE1, 1, 1, NOTE_WRITE, YES_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, WRITE, 2, (void*)FILE1, NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
-       
+
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "2.1.2: creat() file inside a dir", DIR1, 1, 2, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
@@ -841,7 +841,7 @@ run_note_write_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "2.1.3: open() file inside a dir", DIR1, 1, 2, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
@@ -850,7 +850,7 @@ run_note_write_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "2.1.4: unlink a file from a dir", DIR1, 2, 1, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
@@ -859,7 +859,7 @@ run_note_write_tests()
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)pathbuf, NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        makepath(otherpathbuf, DIR1, FILE2);
        init_test(&test, "2.1.5: rename a file in a dir", DIR1, 2, 2, NOTE_WRITE, YES_EVENT);
@@ -870,7 +870,7 @@ run_note_write_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)otherpathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "2.1.6: rename a file to outside of a dir", DIR1, 2, 2, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
@@ -880,7 +880,7 @@ run_note_write_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "2.1.7: rename a file into a dir", DIR1, 2, 2, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
@@ -890,7 +890,7 @@ run_note_write_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "2.1.9: unlink a fifo from a dir", DIR1, 2, 1, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
@@ -899,7 +899,7 @@ run_note_write_tests()
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)pathbuf, NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "2.1.10: make symlink in a dir", DIR1, 1, 2, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
@@ -908,7 +908,7 @@ run_note_write_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "2.1.12: write to a FIFO", FILE1, 1, 1, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 2, (void*)FILE1, (void*)NULL);
@@ -916,8 +916,8 @@ run_note_write_tests()
        init_action(&test.t_helpthreadact, SLEEP, WRITEFD, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
-       
+
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "2.1.13: delete a symlink in a dir", DIR1, 2, 1, NOTE_WRITE, YES_EVENT);
        test.t_known_failure = 1;
@@ -949,59 +949,59 @@ run_note_write_tests()
        init_action(&test.t_helpthreadact, SLEEP, MMAP, 2, (void*)FILE1, (void*)1); /* 1 -> "modify it"*/
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        /*================= no-event tests ==================*/
        init_test(&test, "2.2.1: just open and close existing file", FILE1, 1, 1, NOTE_WRITE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, OPEN, 2, (void*)FILE1, NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "2.2.2: read from existing file", FILE1, 1, 1, NOTE_WRITE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, READ, 2, (void*)FILE1, NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "2.2.3: rename existing file", FILE1, 1, 1, NOTE_WRITE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "2.2.4: just open and close dir", DIR1, 1, 1, NOTE_WRITE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, OPEN, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        /* There are no tests 2.2.5 or 2.2.6 */
-       
+
        init_test(&test, "2.2.7: rename a dir", DIR1, 1, 1, NOTE_WRITE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)DIR1, (void*)DIR2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR2, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "2.2.8: rename a fifo", FILE1, 1, 1, NOTE_WRITE, NO_EVENT);
        test.t_file_is_fifo = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "2.2.9: unlink a fifo", FILE1, 1, 0, NOTE_WRITE, NO_EVENT);
        test.t_file_is_fifo = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, UNLINK,1, (void*)FILE1);
+       init_action(&test.t_helpthreadact, SLEEP, UNLINK, 1, (void*)FILE1);
        execute_test(&test);
-       
+
        init_test(&test, "2.2.10: chmod a file", FILE1, 1, 1, NOTE_WRITE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, CHMOD, 2, (void*)FILE1, (void*)0700);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        struct passwd *pwd = getpwnam("local");
 
        if (pwd != NULL) {
@@ -1012,13 +1012,13 @@ run_note_write_tests()
                init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
                execute_test(&test);
        }
-       
+
        init_test(&test, "2.2.12: chmod a dir", DIR1, 1, 1, NOTE_WRITE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, CHMOD, 2, (void*)DIR1, (void*)0700);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        if (pwd != NULL) {
                init_test(&test, "2.2.13: chown a dir", DIR1, 2, 1, NOTE_WRITE, NO_EVENT);
                init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
@@ -1027,11 +1027,11 @@ run_note_write_tests()
                init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
                execute_test(&test);
        }
-       
+
        T_LOG("MMAP will never give a notification on HFS.\n");
        init_test(&test, "2.1.14: mmap() a file but do not change it", FILE1, 1, 1, NOTE_WRITE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, MMAP, 2, (void*)FILE1, (void*)0); 
+       init_action(&test.t_helpthreadact, SLEEP, MMAP, 2, (void*)FILE1, (void*)0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
 }
@@ -1041,77 +1041,77 @@ run_note_extend_tests()
 {
        test_t test;
        char pathbuf[50];
-       
+
        T_LOG("THESE TESTS MAY FAIL ON HFS\n");
-       
+
        init_test(&test, "3.1.1: write beyond the end of a file", FILE1, 1, 1, NOTE_EXTEND, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, WRITE, 2, (void*)FILE1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, WRITE, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        /*
-        * We won't concern ourselves with lengthening directories: commenting these out  
+        * We won't concern ourselves with lengthening directories: commenting these out
+        *
         *
-        
-        makepath(pathbuf, DIR1, FILE1);
-        init_test(&test, "3.1.2: add a file to a directory with creat()", DIR1, 1, 2, NOTE_EXTEND, YES_EVENT);
-        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-        init_action(&test.t_helpthreadact, SLEEP, CREAT, 2, (void*)pathbuf, (void*)NULL); 
-        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
-        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
-        execute_test(&test);
-        
-        makepath(pathbuf, DIR1, FILE1);
-        init_test(&test, "3.1.3: add a file to a directory with open()", DIR1, 1, 2, NOTE_EXTEND, YES_EVENT);
-        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-        init_action(&test.t_helpthreadact, SLEEP, CREAT, 2, (void*)pathbuf, (void*)NULL); 
-        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
-        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
-        execute_test(&test);
-        
-        makepath(pathbuf, DIR1, FILE1);
-        init_test(&test, "3.1.4: add a file to a directory with rename()", DIR1, 2, 2, NOTE_EXTEND, YES_EVENT);
-        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-        init_action(&(test.t_prep_actions[1]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)pathbuf); 
-        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
-        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
-        execute_test(&test);
+        *  makepath(pathbuf, DIR1, FILE1);
+        *  init_test(&test, "3.1.2: add a file to a directory with creat()", DIR1, 1, 2, NOTE_EXTEND, YES_EVENT);
+        *  init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
+        *  init_action(&test.t_helpthreadact, SLEEP, CREAT, 2, (void*)pathbuf, (void*)NULL);
+        *  init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
+        *  init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
+        *  execute_test(&test);
+        *
+        *  makepath(pathbuf, DIR1, FILE1);
+        *  init_test(&test, "3.1.3: add a file to a directory with open()", DIR1, 1, 2, NOTE_EXTEND, YES_EVENT);
+        *  init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
+        *  init_action(&test.t_helpthreadact, SLEEP, CREAT, 2, (void*)pathbuf, (void*)NULL);
+        *  init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
+        *  init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
+        *  execute_test(&test);
+        *
+        *  makepath(pathbuf, DIR1, FILE1);
+        *  init_test(&test, "3.1.4: add a file to a directory with rename()", DIR1, 2, 2, NOTE_EXTEND, YES_EVENT);
+        *  init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
+        *  init_action(&(test.t_prep_actions[1]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
+        *  init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)pathbuf);
+        *  init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
+        *  init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
+        *  execute_test(&test);
         */
-       
+
        /* 3.1.5: a placeholder for a potential kernel test */
        /*
-        makepath(pathbuf, DIR1, DIR2);
-        init_test(&test, "3.1.6: add a file to a directory with mkdir()", DIR1, 1, 2, NOTE_EXTEND, YES_EVENT);
-        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-        init_action(&test.t_helpthreadact, SLEEP, MKDIR, 2, (void*)pathbuf, (void*)NULL); 
-        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)pathbuf, (void*)NULL);
-        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
-        execute_test(&test);
+        *  makepath(pathbuf, DIR1, DIR2);
+        *  init_test(&test, "3.1.6: add a file to a directory with mkdir()", DIR1, 1, 2, NOTE_EXTEND, YES_EVENT);
+        *  init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
+        *  init_action(&test.t_helpthreadact, SLEEP, MKDIR, 2, (void*)pathbuf, (void*)NULL);
+        *  init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)pathbuf, (void*)NULL);
+        *  init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
+        *  execute_test(&test);
         */
        init_test(&test, "3.1.7: lengthen a file with truncate()", FILE1, 1, 1, NOTE_EXTEND, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, LENGTHEN, 2, FILE1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, LENGTHEN, 2, FILE1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
-       
+
+
        /** ========== NO EVENT SECTION ============== **/
        init_test(&test, "3.2.1: setxattr() a file", FILE1, 1, 1, NOTE_EXTEND, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, SETXATTR, 2, FILE1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, SETXATTR, 2, FILE1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "3.2.2: chmod a file", FILE1, 1, 1, NOTE_EXTEND, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, CHMOD, 2, (void*)FILE1, (void*)0700);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        struct passwd *pwd = getpwnam("local");
        if (pwd != NULL) {
                init_test(&test, "3.2.3: chown a file", FILE1, 2, 1, NOTE_EXTEND, NO_EVENT);
@@ -1123,13 +1123,13 @@ run_note_extend_tests()
        } else {
                T_LOG("Couldn't getpwnam for user \"local\"\n");
        }
-       
+
        init_test(&test, "3.2.4: chmod a dir", DIR1, 1, 1, NOTE_EXTEND, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, CHMOD, 2, (void*)DIR1, (void*)0700);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        if (pwd != NULL) {
                init_test(&test, "3.2.5: chown a dir", DIR1, 2, 1, NOTE_EXTEND, NO_EVENT);
                init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
@@ -1138,10 +1138,10 @@ run_note_extend_tests()
                init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
                execute_test(&test);
        }
-       
+
        init_test(&test, "3.2.6: TRUNC a file with truncate()", FILE1, 1, 1, NOTE_EXTEND, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, TRUNC, 2, FILE1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, TRUNC, 2, FILE1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
 }
@@ -1151,14 +1151,14 @@ run_note_attrib_tests()
 {
        test_t test;
        char pathbuf[50];
-       
+
        init_test(&test, "4.1.1: chmod a file", FILE1, 1, 1, NOTE_ATTRIB, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, CHMOD, 2, FILE1, (void*)0700); 
+       init_action(&test.t_helpthreadact, SLEEP, CHMOD, 2, FILE1, (void*)0700);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        struct passwd *pwd = getpwnam("local");
        if (pwd != NULL) {
                init_test(&test, "4.1.2: chown a file", FILE1, 2, 1, NOTE_ATTRIB, YES_EVENT);
@@ -1174,7 +1174,7 @@ run_note_attrib_tests()
        init_action(&(test.t_helpthreadact), SLEEP, CHMOD, 2, (void*)DIR1, (void*)0700);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        if (pwd != NULL) {
                init_test(&test, "4.1.4: chown a dir", DIR1, 2, 1, NOTE_ATTRIB, YES_EVENT);
                init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
@@ -1183,18 +1183,18 @@ run_note_attrib_tests()
                init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
                execute_test(&test);
        }
-       
+
        init_test(&test, "4.1.5: setxattr on a file", FILE1, 1, 1, NOTE_ATTRIB, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, SETXATTR, 2, (void*)FILE1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, SETXATTR, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.1.6: setxattr on a dir", DIR1, 1, 1, NOTE_ATTRIB, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, SETXATTR, 2, (void*)DIR1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, SETXATTR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
 
@@ -1203,7 +1203,7 @@ run_note_attrib_tests()
                init_test(&test, "4.1.7: exchangedata", FILE1, 2, 2, NOTE_ATTRIB, YES_EVENT);
                init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
                init_action(&(test.t_prep_actions[1]), NOSLEEP, CREAT, 2, (void*)FILE2, (void*)NULL);
-               init_action(&test.t_helpthreadact, SLEEP, EXCHANGEDATA, 2, (void*)FILE1, (void*)FILE2); 
+               init_action(&test.t_helpthreadact, SLEEP, EXCHANGEDATA, 2, (void*)FILE1, (void*)FILE2);
                init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
                init_action(&test.t_cleanup_actions[1], NOSLEEP, UNLINK, 2, (void*)FILE2, (void*)NULL);
                execute_test(&test);
@@ -1212,130 +1212,128 @@ run_note_attrib_tests()
        init_test(&test, "4.1.8: utimes on a file", FILE1, 1, 1, NOTE_ATTRIB, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, UTIMES, 2, (void*)FILE1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, UTIMES, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.1.9: utimes on a dir", DIR1, 1, 1, NOTE_ATTRIB, YES_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, UTIMES, 2, (void*)DIR1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, UTIMES, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
-       
+
+
        /* ====== NO EVENT TESTS ========== */
-       
+
        init_test(&test, "4.2.1: rename a file", FILE1, 1, 1, NOTE_ATTRIB, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.2: open (do not change) a file", FILE1, 1, 1, NOTE_ATTRIB, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, OPEN, 2, (void*)FILE1, NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.3: stat a file", FILE1, 1, 1, NOTE_ATTRIB, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, STAT, 2, (void*)FILE1, NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.4: unlink a file", FILE1, 1, 0, NOTE_ATTRIB, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.5: write to a file", FILE1, 1, 1, NOTE_ATTRIB, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, WRITE, 2, (void*)FILE1, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, WRITE, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
+
        T_LOG("EXPECT SPURIOUS NOTE_ATTRIB EVENTS FROM DIRECTORY OPERATIONS on HFS.\n");
        init_test(&test, "4.2.6: add a file to a directory with creat()", DIR1, 1, 2, NOTE_ATTRIB, NO_EVENT);
        test.t_known_failure = 1;
        makepath(pathbuf, DIR1, FILE1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, CREAT, 2, (void*)pathbuf, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, CREAT, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.7: mkdir in a dir", DIR1, 1, 2, NOTE_ATTRIB, NO_EVENT);
        test.t_known_failure = 1;
        makepath(pathbuf, DIR1, DIR2);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, MKDIR, 2, (void*)pathbuf, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, MKDIR, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.8: add a symlink to a directory", DIR1, 1, 2, NOTE_ATTRIB, NO_EVENT);
        test.t_known_failure = 1;
        makepath(pathbuf, DIR1, FILE1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, SYMLINK, 2, (void*)DOTDOT, (void*)pathbuf); 
+       init_action(&test.t_helpthreadact, SLEEP, SYMLINK, 2, (void*)DOTDOT, (void*)pathbuf);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.9: rename into a dir()", DIR1, 2, 2, NOTE_ATTRIB, NO_EVENT);
        test.t_known_failure = 1;
        makepath(pathbuf, DIR1, FILE1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)pathbuf); 
+       init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)pathbuf);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.10: unlink() file from dir", DIR1, 2, 1, NOTE_ATTRIB, NO_EVENT);
        test.t_known_failure = 1;
        makepath(pathbuf, DIR1, FILE1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, CREAT, 2, (void*)pathbuf, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL); 
+       init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        init_test(&test, "4.2.11: mkfifo in a directory", DIR1, 1, 2, NOTE_ATTRIB, NO_EVENT);
        test.t_known_failure = 1;
        makepath(pathbuf, DIR1, FILE1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
-       init_action(&test.t_helpthreadact, SLEEP, MKFIFO, 1, (void*)pathbuf); 
+       init_action(&test.t_helpthreadact, SLEEP, MKFIFO, 1, (void*)pathbuf);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
-       
 }
 
 
-void 
+void
 run_note_link_tests()
 {
        test_t test;
        char pathbuf[50];
        char otherpathbuf[50];
-       
+
        T_LOG("HFS DOES NOT HANDLE UNLINK CORRECTLY...\n");
        init_test(&test, "5.1.1: unlink() a file", FILE1, 1, 0, NOTE_LINK, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)FILE1, (void*)NULL);
        execute_test(&test);
-       
-       
+
+
        init_test(&test, "5.1.1.5: link A to B, watch A, remove B", FILE1, 2, 1, NOTE_LINK, YES_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, HARDLINK, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)FILE2, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "5.1.2: link() to a file", FILE1, 1, 2, NOTE_LINK, YES_EVENT);
 #if TARGET_OS_WATCH
        test.t_nondeterministic = 1;
@@ -1345,7 +1343,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, DIR2);
        init_test(&test, "5.1.3: make one dir in another", DIR1, 1, 2, NOTE_LINK, YES_EVENT);
        test.t_known_failure = 1;
@@ -1354,7 +1352,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)pathbuf, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, DIR2);
        init_test(&test, "5.1.4: rmdir a dir from within another", DIR1, 2, 1, NOTE_LINK, YES_EVENT);
        test.t_known_failure = 1;
@@ -1363,7 +1361,7 @@ run_note_link_tests()
        init_action(&test.t_helpthreadact, SLEEP, RMDIR, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, DIR2);
        makepath(otherpathbuf, DIR1, DIR1);
        init_test(&test, "5.1.5: rename dir A over dir B inside dir C", DIR1, 3, 2, NOTE_LINK, YES_EVENT);
@@ -1375,7 +1373,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)otherpathbuf, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        T_LOG("HFS bypasses hfs_makenode to create in target, so misses knote.\n");
        makepath(pathbuf, DIR1, DIR2);
        init_test(&test, "5.1.6: rename one dir into another", DIR1, 2, 2, NOTE_LINK, YES_EVENT);
@@ -1386,7 +1384,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)pathbuf, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        T_LOG("HFS bypasses hfs_removedir to remove from source, so misses knote.\n");
        makepath(pathbuf, DIR1, DIR2);
        init_test(&test, "5.1.7: rename one dir out of another", DIR1, 2, 2, NOTE_LINK, YES_EVENT);
@@ -1397,13 +1395,13 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR2, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "5.1.8: rmdir a dir", DIR1, 1, 0, NOTE_LINK, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RMDIR, 2, (void*)DIR1, (void*)NULL);
        execute_test(&test);
-       
+
        /* ============= NO EVENT SECTION ============== */
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "5.2.1: make a file in a dir", DIR1, 1, 2, NOTE_LINK, NO_EVENT);
@@ -1413,7 +1411,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "5.2.2: unlink a file in a dir", DIR1, 2, 1, NOTE_LINK, NO_EVENT);
        test.t_known_failure = 1;
@@ -1422,7 +1420,7 @@ run_note_link_tests()
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)pathbuf, (void*)NULL);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        makepath(otherpathbuf, DIR1, FILE2);
        init_test(&test, "5.2.3: rename a file within a dir", DIR1, 2, 2, NOTE_LINK, NO_EVENT);
@@ -1433,7 +1431,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)otherpathbuf, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "5.2.4: rename a file into a dir", DIR1, 2, 2, NOTE_LINK, NO_EVENT);
        test.t_known_failure = 1;
@@ -1443,7 +1441,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        makepath(pathbuf, DIR1, FILE1);
        init_test(&test, "5.2.5: make a symlink in a dir", DIR1, 1, 2, NOTE_LINK, NO_EVENT);
        test.t_known_failure = 1;
@@ -1452,7 +1450,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)pathbuf, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "5.2.6: make a symlink to a dir", DIR1, 1, 2, NOTE_LINK, NO_EVENT);
        test.t_known_failure = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
@@ -1460,7 +1458,7 @@ run_note_link_tests()
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "5.2.7: make a symlink to a file", FILE1, 1, 2, NOTE_LINK, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, SYMLINK, 2, (void*)FILE1, (void*)FILE2);
@@ -1470,31 +1468,31 @@ run_note_link_tests()
 }
 
 void
-run_note_rename_tests() 
+run_note_rename_tests()
 {
        test_t test;
-       
+
        init_test(&test, "6.1.1: rename a file", FILE1, 1, 1, NOTE_RENAME, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "6.1.2: rename a dir", DIR1, 1, 1, NOTE_RENAME, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)DIR1, (void*)DIR2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR2, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "6.1.3: rename one file over another", FILE1, 2, 1, NOTE_RENAME, YES_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, CREAT, 2, (void*)FILE2, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "6.1.4: rename one dir over another", DIR1, 2, 1, NOTE_RENAME, YES_EVENT);
        test.t_nondeterministic = 1;
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
@@ -1502,48 +1500,48 @@ run_note_rename_tests()
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)DIR1, (void*)DIR2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR2, NULL);
        execute_test(&test);
-       
+
        /* ========= NO EVENT SECTION =========== */
-       
+
        init_test(&test, "6.2.1: unlink a file", FILE1, 1, 0, NOTE_RENAME, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "6.2.2: rmdir a dir", DIR1, 1, 0, NOTE_RENAME, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RMDIR, 2, (void*)DIR1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "6.2.3: link() to a file", FILE1, 1, 2, NOTE_RENAME, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, HARDLINK, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        init_action(&test.t_cleanup_actions[1], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
-       init_test(&test, "6.2.4: rename one file over another: watch deceased", 
-                         FILE2, 2, 1, NOTE_RENAME, NO_EVENT);
+
+       init_test(&test, "6.2.4: rename one file over another: watch deceased",
+           FILE2, 2, 1, NOTE_RENAME, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, CREAT, 2, (void*)FILE2, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
-       init_test(&test, "6.2.5: rename one dir over another: watch deceased", 
-                         DIR2, 2, 1, NOTE_RENAME, NO_EVENT);
+
+       init_test(&test, "6.2.5: rename one dir over another: watch deceased",
+           DIR2, 2, 1, NOTE_RENAME, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, MKDIR, 2, (void*)DIR2, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)DIR1, (void*)DIR2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, RMDIR, 2, (void*)DIR2, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "6.2.6: rename a file to itself", FILE1, 1, 1, NOTE_RENAME, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 2, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE1);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "6.2.7: rename a dir to itself", DIR1, 1, 1, NOTE_RENAME, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKDIR, 2, (void*)DIR1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)DIR1, (void*)DIR1);
@@ -1551,8 +1549,8 @@ run_note_rename_tests()
        execute_test(&test);
 }
 
-void 
-run_note_revoke_tests() 
+void
+run_note_revoke_tests()
 {
        test_t test;
        init_test(&test, "7.1.1: revoke file", FILE1, 1, 1, NOTE_REVOKE, YES_EVENT);
@@ -1560,7 +1558,7 @@ run_note_revoke_tests()
        init_action(&test.t_helpthreadact, SLEEP, REVOKE, 1, (void*)FILE1);
        init_action(&(test.t_cleanup_actions[0]), NOSLEEP, UNLINK, 1, (void*)FILE1);
        execute_test(&test);
-       
+
        init_test(&test, "7.2.1: delete file", FILE1, 1, 0, NOTE_REVOKE, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1);
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 1, (void*)FILE1);
@@ -1569,7 +1567,7 @@ run_note_revoke_tests()
 
 
 void
-run_evfilt_read_tests() 
+run_evfilt_read_tests()
 {
        test_t test;
        init_test(&test, "8.1.1: how much data in file of length LENGTHEN_SIZE?", FILE1, 2, 1, EVFILT_READ, LENGTHEN_SIZE);
@@ -1578,21 +1576,21 @@ run_evfilt_read_tests()
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "8.1.2: block, then write to file", FILE1, 2, 1, EVFILT_READ, strlen(TEST_STRING));
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, TRUNC, 1, (void*)FILE1);
        init_action(&test.t_helpthreadact, SLEEP, WRITE, 1, (void*)FILE1);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "8.1.3: block, then extend", FILE1, 2, 1, EVFILT_READ, LENGTHEN_SIZE);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, TRUNC, 1, (void*)FILE1);
        init_action(&test.t_helpthreadact, SLEEP, LENGTHEN, 1, (void*)FILE1);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "8.1.4: block, then seek to beginning", FILE1, 2, 1, EVFILT_READ, strlen(TEST_STRING));
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, WRITE, 1, (void*)FILE1);
@@ -1600,15 +1598,15 @@ run_evfilt_read_tests()
        init_action(&test.t_helpthreadact, SLEEP, LSEEK, 1, (void*)0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
-       
+
+
        init_test(&test, "8.1.5: block, then write to fifo", FILE1, 1, 1, EVFILT_READ, strlen(TEST_STRING));
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1);
        test.t_file_is_fifo = 1;
        init_action(&test.t_helpthreadact, SLEEP, WRITE, 1, (void*)FILE1);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        /* No result section... */
        init_test(&test, "8.2.1: just rename", FILE1, 2, 1, EVFILT_READ, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1);
@@ -1616,13 +1614,13 @@ run_evfilt_read_tests()
        init_action(&test.t_helpthreadact, SLEEP, RENAME, 2, (void*)FILE1, (void*)FILE2);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE2, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "8.2.2: delete file", FILE1, 2, 0, EVFILT_READ, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, TRUNC, 1, (void*)FILE1);
        init_action(&test.t_helpthreadact, SLEEP, UNLINK, 1, (void*)FILE1);
        execute_test(&test);
-       
+
        init_test(&test, "8.2.3: write to beginning", FILE1, 2, 1, EVFILT_READ, NO_EVENT);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, WRITE, 1, (void*)FILE1);
@@ -1630,7 +1628,7 @@ run_evfilt_read_tests()
        init_action(&test.t_helpthreadact, SLEEP, WRITE, 1, (void*)FILE1);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 1, (void*)FILE1);
        execute_test(&test);
-       
+
        init_test(&test, "8.1.4: block, then seek to current location", FILE1, 2, 1, EVFILT_READ, 0);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, WRITE, 1, (void*)FILE1);
@@ -1638,14 +1636,13 @@ run_evfilt_read_tests()
        init_action(&test.t_helpthreadact, SLEEP, LSEEK, 1, (void*)strlen(TEST_STRING));
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "8.2.5: trying to read from empty fifo", FILE1, 1, 1, EVFILT_READ, 0);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1);
        test.t_file_is_fifo = 1;
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 1, (void*)0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
 }
 
 
@@ -1671,10 +1668,9 @@ write_to_fd(void *arg)
 /*
  * We don't (in principle) support EVFILT_WRITE for vnodes; thusly, no tests here
  */
-void 
+void
 run_evfilt_write_tests()
 {
-       
        test_t test;
        init_test(&test, "9.1.1: how much space in empty fifo?", FILE1, 1, 1, EVFILT_WRITE, FIFO_SPACE);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1, (void*)NULL);
@@ -1682,7 +1678,7 @@ run_evfilt_write_tests()
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "9.1.2: how much space in slightly written fifo?", FILE1, 1, 1, EVFILT_WRITE, FIFO_SPACE - strlen(TEST_STRING));
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1, (void*)NULL);
        test.t_file_is_fifo = 1;
@@ -1690,7 +1686,7 @@ run_evfilt_write_tests()
        init_action(&(test.t_helpthreadact), NOSLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_test(&test, "9.2.1: how much space in a full fifo?", FILE1, 1, 1, EVFILT_WRITE, 0);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1, (void*)NULL);
        test.t_nondeterministic = 1;
@@ -1710,14 +1706,14 @@ run_poll_tests()
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_poll_test(&test, "10.1.2: does poll say I can write an empty FIFO?", FILE1, 1, 1, POLLWRNORM, 1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1, (void*)NULL);
        test.t_file_is_fifo = 1;
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_poll_test(&test, "10.1.3: does poll say I can read a nonempty FIFO?", FILE1, 1, 1, POLLRDNORM, 1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1, (void*)NULL);
        test.t_file_is_fifo = 1;
@@ -1725,30 +1721,30 @@ run_poll_tests()
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_poll_test(&test, "10.1.4: does poll say I can read a nonempty regular file?", FILE1, 2, 1, POLLRDNORM, 1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1, (void*)NULL);
        init_action(&(test.t_prep_actions[1]), NOSLEEP, LENGTHEN, 1, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_poll_test(&test, "10.1.5: does poll say I can read an empty file?", FILE1, 1, 1, POLLRDNORM, 1);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, CREAT, 1, (void*)FILE1, (void*)NULL);
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
-       
-       
-       
+
+
+
+
        init_poll_test(&test, "10.2.2: does poll say I can read an empty FIFO?", FILE1, 1, 1, POLLRDNORM, 0);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1, (void*)NULL);
        test.t_file_is_fifo = 1;
        init_action(&test.t_helpthreadact, SLEEP, NOTHING, 0);
        init_action(&test.t_cleanup_actions[0], NOSLEEP, UNLINK, 2, (void*)FILE1, NULL);
        execute_test(&test);
-       
+
        init_poll_test(&test, "10.2.3: does poll say I can write a full FIFO?", FILE1, 1, 1, POLLWRNORM, 0);
        init_action(&(test.t_prep_actions[0]), NOSLEEP, MKFIFO, 1, (void*)FILE1, (void*)NULL);
        test.t_nondeterministic = 1;
@@ -1773,7 +1769,7 @@ run_note_funlock_tests()
 }
 
 void
-run_all_tests() 
+run_all_tests()
 {
        run_note_delete_tests();
        run_note_write_tests();
@@ -1790,48 +1786,47 @@ run_all_tests()
        run_note_funlock_tests();
 }
 
-       T_DECL(kqueue_file_tests,
-               "Tests assorted kqueue operations for file-related events")
+T_DECL(kqueue_file_tests,
+    "Tests assorted kqueue operations for file-related events")
 {
        char *which = NULL;
        if (argc > 1) {
                which = argv[1];
        }
-       
+
        T_SETUPBEGIN;
        rmdir(DIR1);
        rmdir(DIR2);
        T_SETUPEND;
 
-       if ((!which) || (strcmp(which, "all") == 0))
+       if ((!which) || (strcmp(which, "all") == 0)) {
                run_all_tests();
-       else if (strcmp(which, "delete") == 0) 
+       } else if (strcmp(which, "delete") == 0) {
                run_note_delete_tests();
-       else if (strcmp(which, "write") == 0)
+       } else if (strcmp(which, "write") == 0) {
                run_note_write_tests();
-       else if (strcmp(which, "extend") == 0)
+       } else if (strcmp(which, "extend") == 0) {
                run_note_extend_tests();
-       else if (strcmp(which, "attrib") == 0)
+       } else if (strcmp(which, "attrib") == 0) {
                run_note_attrib_tests();
-       else if (strcmp(which, "link") == 0)
+       } else if (strcmp(which, "link") == 0) {
                run_note_link_tests();
-       else if (strcmp(which, "rename") == 0)
+       } else if (strcmp(which, "rename") == 0) {
                run_note_rename_tests();
-       else if (strcmp(which, "revoke") == 0)
+       } else if (strcmp(which, "revoke") == 0) {
                run_note_revoke_tests();
-       else if (strcmp(which, "evfiltread") == 0)
+       } else if (strcmp(which, "evfiltread") == 0) {
                run_evfilt_read_tests();
-       else if (strcmp(which, "evfiltwrite") == 0)
+       } else if (strcmp(which, "evfiltwrite") == 0) {
                run_evfilt_write_tests();
-       else if (strcmp(which, "poll") == 0)
+       } else if (strcmp(which, "poll") == 0) {
                run_poll_tests();
-       else if (strcmp(which, "funlock") == 0)
+       } else if (strcmp(which, "funlock") == 0) {
                run_note_funlock_tests();
-       else {
+       else {
                fprintf(stderr, "Valid options are:\n\tdelete, write, extend, "
-                               "attrib, link, rename, revoke, evfiltread, "
-                               "fifo, all, evfiltwrite, funlock<none>\n");
+                   "attrib, link, rename, revoke, evfiltread, "
+                   "fifo, all, evfiltwrite, funlock<none>\n");
                exit(1);
        }
 }
-