#include #include #include #include #include int main(int argc, char ** argv){ if(argc < 2){ printf("Usage: %s pid\n", argv[0]); return 1; } int fd = open("/proc/process_info", O_RDONLY); if(fd < 0){ perror("open"); return 2; } unsigned long pid = atoi(argv[1]); if(!pid){ printf("Invalid pid 0\n"); return 3; } long retval = ioctl(fd, 10, pid); if(retval) { perror("ioctl"); return 4; } char report[4196]; size_t readlen = read(fd, report, 4196); report[readlen] = 0; printf(report); close(fd); return 0; }