*** main.c.ORIG Thu Apr 24 17:54:13 2008 --- main.c Thu Apr 24 17:56:06 2008 *************** *** 111,116 **** --- 111,136 ---- 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. + * This is pretty specific to the AIX Toolbox build. + */ + #if defined(CHECK_KERN64) + 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); + } + #endif + /* * Close all file descriptors above 2. *