*** ./lsof_4.86_src/main.c.ORIG Thu Oct 20 00:22:50 2011 --- ./lsof_4.86_src/main.c Thu Oct 20 00:31:48 2011 *************** *** 111,116 **** --- 111,133 ---- Pn++; else Pn = argv[0]; + + /* + * Only use this if we know this has been built for 32bit kernel, + * and we are potentially executing this with a 64bit kernel. + * Assumes a 64-bit version is available as "lsof64" to execute in + * place of this 32-bit default. + */ + if ( (strcmp(Pn, "lsof64")) && (__KERNEL_64()) ) { + /* This is a not lsof64, but it is a 64-bit kernel. The current + * lsof will not work. Attempt to exec "lsof64" instead. + */ + execvp ("/opt/freeware/sbin/lsof64", argv); + perror(Pn); + (void) fprintf(stderr, "Could not exec /opt/freeware/sbin/lsof64\n"); + Exit(1); + } + /* * Close all file descriptors above 2. *