Changeset 34260 for trunk/Ohana/src/opihi/dvo/dvo_host_utils.c
- Timestamp:
- Jul 31, 2012, 4:02:00 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/dvo_host_utils.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/dvo_host_utils.c
r33963 r34260 15 15 snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000); 16 16 17 // write the dvo comment (host independent) 18 char commandBase[DVO_MAX_PATH]; 19 snprintf (commandBase, DVO_MAX_PATH, "dvo.command.%s.txt", uniquer); 20 char *commandFile = abspath(commandBase, DVO_MAX_PATH); 21 22 FILE *f = fopen (commandFile, "w"); 23 fprintf (f, "%s\n", basecmd); 24 if (fflush (f)) DIE("flush", "failed to flush"); 25 26 int fd = fileno (f); 27 if (fsync (fd)) DIE("fsync", "failed to fsync"); 28 29 if (fclose (f)) DIE("close", "failed to close"); 30 31 // force NFS to write the file to disk 32 int state; 33 f = fsetlockfile (commandFile, 0.5, LCK_XCLD, &state); 34 fclearlockfile (commandFile, f, LCK_XCLD, &state); 35 17 36 int top_status = TRUE; 18 37 int i; … … 29 48 snprintf (table->hosts[i].results, DVO_MAX_PATH, "%s/dvo.results.%s.fits", table->hosts[i].pathname, uniquer); 30 49 31 char commandBase[DVO_MAX_PATH];32 snprintf (commandBase, DVO_MAX_PATH, "dvo.command.%s.txt", uniquer);33 char *commandFile = abspath(commandBase, DVO_MAX_PATH);34 35 FILE *f = fopen (commandFile, "w");36 fprintf (f, "%s\n", basecmd);37 if (fflush (f)) DIE("flush", "failed to flush");38 39 int fd = fileno (f);40 if (fsync (fd)) DIE("fsync", "failed to fsync");41 42 if (fclose (f)) DIE("close", "failed to close");43 44 // force NFS to write the file to disk45 int state;46 f = fsetlockfile (commandFile, 0.5, LCK_XCLD, &state);47 fclearlockfile (commandFile, f, LCK_XCLD, &state);48 49 50 char command[1024]; 50 51 snprintf (command, 1024, "dvo_client %s -result %s %s -hostID %d -hostdir %s", commandFile, table->hosts[i].results, options, table->hosts[i].hostID, table->hosts[i].pathname); 51 free (commandFile);52 52 53 53 if (VERBOSE) gprint (GP_ERR, "command: %s\n", command); … … 75 75 } 76 76 } 77 free (commandFile); 77 78 return top_status; 78 79 }
Note:
See TracChangeset
for help on using the changeset viewer.
