Committer: Mircea Gherzan <mircea.gherzan@xxxxxxxxxxxxxx> Date: 20/04/2010 at 23:56:22 Revision: 4370 Revision-id: mircea.gherzan@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: trunk Log: Remove the sysinfo function. The data printed by it (lsmod, cpuinfo) should normally be included in a bug report in a separate manner. Modified: M hipd/init.c === modified file 'hipd/init.c' --- hipd/init.c 2010-04-20 12:15:57 +0000 +++ hipd/init.c 2010-04-20 20:48:20 +0000 @@ -103,115 +103,6 @@ return fcntl(desc, F_SETFD, oldflags); } -#ifdef CONFIG_HIP_DEBUG -/** - * print information about underlying the system for bug reports - */ -static void hip_print_sysinfo(void) -{ - FILE *fp = NULL; - char str[256]; - int current = 0; - int pipefd[2]; - int stdout_fd; - int ch; - - fp = fopen("/etc/debian_version", "r"); - if (!fp) { - fp = fopen("/etc/redhat-release", "r"); - } - - if (fp) { - while (fgets(str, sizeof(str), fp)) { - HIP_DEBUG("version=%s", str); - } - if (fclose(fp)) { - HIP_ERROR("Error closing version file\n"); - } - fp = NULL; - } - - fp = fopen("/proc/cpuinfo", "r"); - if (fp) { - HIP_DEBUG("Printing /proc/cpuinfo\n"); - - /* jk: char != int !!! */ - while ((ch = fgetc(fp)) != EOF) { - str[current] = ch; - /* Tabs end up broken in syslog: remove */ - if (str[current] == '\t') { - continue; - } - if (str[current++] == '\n' || current == sizeof(str) - 1) { - str[current] = '\0'; - HIP_DEBUG(str); - current = 0; - } - } - - if (fclose(fp)) { - HIP_ERROR("Error closing /proc/cpuinfo\n"); - } - fp = NULL; - } else { - HIP_ERROR("Failed to open file /proc/cpuinfo\n"); - } - - /* Route stdout into a pipe to capture lsmod output */ - - stdout_fd = dup(1); - if (stdout_fd < 0) { - HIP_ERROR("Stdout backup failed\n"); - return; - } - if (pipe(pipefd)) { - HIP_ERROR("Pipe creation failed\n"); - return; - } - if (dup2(pipefd[1], 1) < 0) { - HIP_ERROR("Stdout capture failed\n"); - if (close(pipefd[1])) { - HIP_ERROR("Error closing write end of pipe\n"); - } - if (close(pipefd[0])) { - HIP_ERROR("Error closing read end of pipe\n"); - } - return; - } - - if (system("lsmod") == -1) { - HIP_ERROR("lsmod failed"); - } - - if (dup2(stdout_fd, 1) < 0) { - HIP_ERROR("Stdout restore failed\n"); - } - if (close(stdout_fd)) { - HIP_ERROR("Error closing stdout backup\n"); - } - if (close(pipefd[1])) { - HIP_ERROR("Error closing write end of pipe\n"); - } - - fp = fdopen(pipefd[0], "r"); - if (fp) { - HIP_DEBUG("Printing lsmod output\n"); - while (fgets(str, sizeof(str), fp)) { - HIP_DEBUG(str); - } - if (fclose(fp)) { - HIP_ERROR("Error closing read end of pipe\n"); - } - } else { - HIP_ERROR("Error opening pipe for reading\n"); - if (close(pipefd[0])) { - HIP_ERROR("Error closing read end of pipe\n"); - } - } -} -#endif /* CONFIG_HIP_DEBUG */ - - /** * Create a file with the given contents unless it already exists * @@ -1034,9 +925,6 @@ hip_set_os_dep_variables(); -#ifdef CONFIG_HIP_DEBUG - hip_print_sysinfo(); -#endif hip_probe_kernel_modules(); /* Register signal handlers */