summaryrefslogtreecommitdiff
path: root/sanity.c
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2008-02-13 10:20:37 -0800
committerAaron Plattner <aplattner@nvidia.com>2008-02-13 10:20:37 -0800
commita99e5e558fc9e279eeee2b76187766ac1dde19cf (patch)
tree2b51e4e723ea77efb29c50a65af708c64fe77381 /sanity.c
parent919fc87075a0b604d316b7d91fca592eba64829e (diff)
1.0-81741.0-8174
Diffstat (limited to 'sanity.c')
-rw-r--r--sanity.c184
1 files changed, 0 insertions, 184 deletions
diff --git a/sanity.c b/sanity.c
index abd1025..3af6796 100644
--- a/sanity.c
+++ b/sanity.c
@@ -135,187 +135,3 @@ int check_sysvipc(Options *op)
return ret;
} /* check_sysvipc() */
-
-
-#if 0
-
-
-/*
- * XXX don't have time to finish implementing and testing this right
- * now...
- */
-
-
-
-
-/*
- * find_conflicting_libraries() -
- */
-
-static int find_conflicting_libraries(Options *op)
-{
- FileList *l;
- struct stat stat_buf;
- int i;
-
- l = (FileList *) nvalloc(sizeof(FileList));
-
- /* search for possibly conflicting libraries */
-
- find_conflicting_xfree86_libraries(op, DEFAULT_XFREE86_INSTALLATION_PREFIX, l);
-
- if (strcmp(DEFAULT_XFREE86_INSTALLATION_PREFIX, op->xfree86_prefix) != 0)
- find_conflicting_xfree86_libraries(op, op->xfree86_prefix, l);
-
- find_conflicting_opengl_libraries(op, DEFAULT_OPENGL_INSTALLATION_PREFIX, l);
-
- if (strcmp(DEFAULT_OPENGL_INSTALLATION_PREFIX, op->opengl_prefix) != 0)
- find_conflicting_opengl_libraries(op, op->opengl_prefix, l);
-
-#if defined(NV_X86_64)
- if (op->compat32_prefix != NULL) {
- char *prefix = nvstrcat(op->compat32_prefix,
- DEFAULT_OPENGL_INSTALLATION_PREFIX, NULL);
- find_conflicting_opengl_libraries(op, prefix, l);
- nvfree(prefix);
-
- if (strcmp(DEFAULT_OPENGL_INSTALLATION_PREFIX,
- op->opengl_prefix) != 0) {
- prefix = nvstrcat(op->compat32_prefix, op->opengl_prefix, NULL);
- find_conflicting_opengl_libraries(op, prefix, l);
- nvfree(prefix);
- }
- }
-#endif /* NV_X86_64 */
-
- /* condense the file list */
-
- condense_file_list(l);
-
- /* for each file in the list, check if it's an NVIDIA file */
-
- for (i = 0; i < l->num; i++) {
- if (lstat(l->filename[i], &stat_buf) == -1) {
- ui_error(op, "Unable to determine properties for file '%s' (%s).",
- l->filename[i], strerror(errno));
- continue;
- }
-
- if (S_ISREG(stat_buf.st_mode)) {
- ret = is_nvidia_library(op, l->filename[i]);
- } else if (S_ISLNK(stat_buf.st_mode)) {
- ret = is_nvidia_symlink(op, l->filename[i]);
- }
- }
-
-
-
-
- /* free the FileList */
-
- for (i = 0; i < l->num; i++) free(l->filename[i]);
- free(l->filename);
- free(l);
-
-} /* find_conflicting_libraries() */
-
-
-
-/*
- * is_nvidia_library() - mmap the file and scan through it for the
- * nvidia string.
- */
-
-static int is_nvidia_library(Options *op, const char *filename)
-{
- int fd = -1, ret = FALSE;
- struct stat stat_buf;
- char *buf = (void *) -1, char *found;
-
- if ((fd = open(filename, O_RDONLY)) == -1) {
- ui_error(op, "Unable to open '%s' for reading (%s)",
- filename, strerror(errno));
- goto done:
- }
-
- if (fstat(fd, &stat_buf) == -1) {
- ui_error(op, "Unable to determine size of '%s' (%s)",
- filename, strerror(errno));
- goto done;
- }
-
- if ((buf = mmap(0, stat_buf.st_size, PROT_READ,
- MAP_FILE | MAP_SHARED, fd, 0)) == (void *) -1) {
- ui_error(op, "Unable to map file '%s' for reading (%s)",
- filename, strerror(errno));
- goto done;
- }
-
- found = strstr(buf, "nvidia id: ");
-
- if (found) ret = TRUE;
-
- done:
-
- if (buf != (void *) -1) munmap(buf, stat_buf.st_size);
- if (fd != -1) close(fd);
-
- return ret;
-
-} /* is_nvidia_library() */
-
-
-/*
- * is_nvidia_symlink() - returns TRUE if this symlink should be moved
- * out of the way. Find the target of the symlink, and recursively
- * call is_nvidia_symlink() if the target is a symlink, or call
- * is_nvidia_library() if the target is a regular file.
- *
- * XXX do we need to do anything about cyclic links?
- */
-
-static int is_nvidia_symlink(Options *op, const char *filename)
-{
- char *tmp, *tmp2, *dir, *target;
- int ret = TRUE;
- struct stat stat_buf;
-
- tmp = get_symlink_target(op, filename);
- if (!tmp) return FALSE;
-
- /*
- * prepend the basename of the file, unless the target is an
- * abosolute path
- */
-
- if (tmp[0] != '/') {
- tmp2 = nvstrdup(tmp);
- dir = dirname(tmp2);
- target = nvstrcat(dir, "/", tmp, NULL);
- nvfree(tmp);
- nvfree(tmp2);
- } else {
- target = tmp;
- }
-
-
- if (lstat(target, &stat_buf) == -1) {
- ui_error(op, "Unable to determine properties for file '%s' (%s).",
- target, strerror(errno));
- return TRUE; /* return TRUE so that we don't try to back it up */
- }
-
- if (S_ISREG(stat_buf.st_mode)) {
- ret = is_nvidia_library(op, target);
- } else if (S_ISLNK(stat_buf.st_mode)) {
- ret = is_nvidia_symlink(op, target);
- }
-
- nvfree(target);
-
- return ret;
-
-} /* is_nvidia_symlink() */
-
-
-#endif