Some fixes to help Solaris (and others, I'm sure) compile:
- the dirent.dt_type field is non-portable. Use stat() if there isn't a dt_type field in the dirent struct - Make sure -laio is added to LIBS in the romio component configure script so that static builds don't result in missing symbols - Add missing header file for the signal constants in pls_fork_module This commit was SVN r5152.
Этот коммит содержится в:
родитель
0c61e93108
Коммит
4dc864c2a4
10
configure.ac
10
configure.ac
@ -949,12 +949,6 @@ AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h dlfcn.h execinfo.h \
|
||||
syslog.h termios.h ulimit.h unistd.h sys/param.h sys/tree.h sys/queue.h \
|
||||
sys/sockio.h])
|
||||
|
||||
# snprintf declaration
|
||||
# gethostname declaration
|
||||
# headers:
|
||||
# stropts.h grh.h netinet/tcp.h sys/select.h sys/resource.h pty.h util.h
|
||||
# rpc/types.h rpc/xdr.h sched.h strings.h
|
||||
|
||||
# SA_RESTART in signal.h
|
||||
AC_MSG_CHECKING([if SA_RESTART defined in signal.h])
|
||||
AC_EGREP_CPP(yes, [
|
||||
@ -975,7 +969,9 @@ AC_DEFINE_UNQUOTED(OMPI_HAVE_SA_LEN, $VALUE,
|
||||
[Whether we have the sa_len struct in <sys/socket.h> or not])
|
||||
AC_MSG_RESULT([$MSG])
|
||||
|
||||
# union semun in sys/sem.h
|
||||
AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>])
|
||||
|
||||
# Note that sometimes we have <stdbool.h>, but it doesn't work (e.g.,
|
||||
# have both Portland and GNU installed; using pgcc will find GNU's
|
||||
|
@ -75,6 +75,8 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
|
||||
io_romio_flags="CFLAGS="'"'"$CFLAGS"'"'" CPPFLAGS="'"'"$CPPFLAGS"'"'" FFLAGS="'"'"$FFLAGS"'"'" LDFLAGS="'"'"$LSFLAGS"'"'" --$shared-shared --$static-static $io_romio_flags $prefix_arg"
|
||||
AC_MSG_RESULT([$io_romio_flags])
|
||||
|
||||
AC_CHECK_LIB(aio, main)
|
||||
|
||||
ompi_show_subtitle "Configuring ROMIO distribution"
|
||||
OMPI_CONFIG_SUBDIR([romio-dist], [$io_romio_flags],
|
||||
[HAPPY=1], [HAPPY=0])
|
||||
|
@ -21,11 +21,13 @@
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "include/orte_constants.h"
|
||||
#include "event/event.h"
|
||||
|
@ -439,28 +439,50 @@ orte_dir_empty(char *pathname)
|
||||
DIR *dp;
|
||||
struct dirent *ep;
|
||||
char *filenm;
|
||||
bool empty;
|
||||
#ifndef HAVE_STRUCT_DIRENT_D_TYPE
|
||||
int ret;
|
||||
struct stat buf;
|
||||
#endif
|
||||
|
||||
empty = true;
|
||||
|
||||
if (NULL != pathname) { /* protect against error */
|
||||
dp = opendir(pathname);
|
||||
if (NULL != dp) {
|
||||
while ((ep = readdir(dp))) {
|
||||
if ((0 != strcmp(ep->d_name, ".")) &&
|
||||
(0 != strcmp(ep->d_name, "..")) &&
|
||||
(DT_DIR != ep->d_type) &&
|
||||
(0 != strncmp(ep->d_name, "output-", strlen("output-"))) &&
|
||||
(0 != strcmp(ep->d_name, "universe-setup.txt"))) {
|
||||
filenm = orte_os_path(false, pathname, ep->d_name, NULL);
|
||||
unlink(filenm);
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
}
|
||||
if (NULL == pathname) { /* protect against error */
|
||||
return;
|
||||
}
|
||||
|
||||
dp = opendir(pathname);
|
||||
if (NULL == dp) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (NULL != (ep = readdir(dp)) ) {
|
||||
/* skip:
|
||||
* - . and ..
|
||||
* - directories
|
||||
* - files starting with "output-"
|
||||
* - universe contact (universe-setup.txt)
|
||||
*/
|
||||
if ((0 != strcmp(ep->d_name, ".")) &&
|
||||
(0 != strcmp(ep->d_name, "..")) &&
|
||||
(0 != strncmp(ep->d_name, "output-", strlen("output-"))) &&
|
||||
(0 != strcmp(ep->d_name, "universe-setup.txt"))) {
|
||||
|
||||
filenm = orte_os_path(false, pathname, ep->d_name, NULL);
|
||||
|
||||
/* make sure it's not a directory */
|
||||
#ifdef HAVE_STRUCT_DIRENT_D_TYPE
|
||||
if (DT_DIR == ep->d_type) {
|
||||
continue;
|
||||
}
|
||||
#else /* have dirent.d_type */
|
||||
ret = stat(filenm, &buf);
|
||||
if (ret < 0 || S_ISDIR(buf.st_mode)) {
|
||||
continue;
|
||||
}
|
||||
#endif /* have dirent.d_type */
|
||||
unlink(filenm);
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
#else
|
||||
bool empty = false;
|
||||
char search_path[MAX_PATH];
|
||||
HANDLE file;
|
||||
WIN32_FIND_DATA file_data;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user