[darwinbuild-changes] [54] trunk/darwintrace/darwintrace.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:42:30 PDT 2006


Revision: 54
          http://trac.macosforge.org/projects/darwinbuild/changeset/54
Author:   ssen
Date:     2006-10-04 01:42:30 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
Translate volfs paths ("/.vol/") to full paths in the
open() call. execve does not typically get these, but we
can refactor path canonicalization if we need to.

Modified Paths:
--------------
    trunk/darwintrace/darwintrace.c

Modified: trunk/darwintrace/darwintrace.c
===================================================================
--- trunk/darwintrace/darwintrace.c	2005-07-09 22:30:37 UTC (rev 53)
+++ trunk/darwintrace/darwintrace.c	2006-10-04 08:42:30 UTC (rev 54)
@@ -5,6 +5,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 
 int __darwintrace_fd = -2;
 #define BUFFER_SIZE	1024
@@ -36,7 +37,17 @@
 		  }
 		}
 		if (__darwintrace_fd >= 0) {
-		  int size = snprintf(__darwintrace_buf, BUFFER_SIZE, "open\t%s\n", path );
+		  int size;
+		  if(strncmp(path, "/.vol/", 6) == 0) {
+		    char realpath[MAXPATHLEN];
+		    if(0 == fcntl(result, F_GETPATH, realpath)) {
+		      size = snprintf(__darwintrace_buf, BUFFER_SIZE, "open\t%s\n", realpath );
+		      // printf("resolved %s to %s\n", path, realpath);
+		    }
+		    // if we can't resolve it, ignore the volfs path
+		  } else {
+		    size = snprintf(__darwintrace_buf, BUFFER_SIZE, "open\t%s\n", path );
+		  }
 		  write(__darwintrace_fd, __darwintrace_buf, size);
 		  fsync(__darwintrace_fd);
 		}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/8dd7e0da/attachment.html


More information about the darwinbuild-changes mailing list