#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
+#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
+#ifndef _IOWR
+#include "ioctl.h"
+#endif
#include <errno.h>
#include <unistd.h>
#include <time.h>
data.ioc_nid = pcfg->pcfg_nid;
rc = l_ioctl (PORTALS_DEV_ID, IOC_PORTAL_NAL_CMD, &data);
+
+ if (rc == 0 && pcfg->pcfg_version != PORTALS_CFG_VERSION)
+ return -EINVAL;
}
return (rc);
pcfg.pcfg_fd, pcfg.pcfg_count);
}
- if (index == 0)
- printf ("<no interfaces>\n");
+ if (index == 0) {
+ if (errno == ENOENT) {
+ printf ("<no interfaces>\n");
+ } else {
+ fprintf(stderr, "Error getting interfaces: %s: "
+ "check dmesg.\n",
+ strerror(errno));
+ }
+ }
+
return 0;
}
pcfg.pcfg_nid, pcfg.pcfg_wait);
}
- if (index == 0)
- printf ("<no peers>\n");
+ if (index == 0) {
+ if (errno == ENOENT) {
+ printf ("<no peers>\n");
+ } else {
+ fprintf(stderr, "Error getting peer list: %s: "
+ "check dmesg.\n",
+ strerror(errno));
+ }
+ }
return 0;
}
OPENIBNAL, IIBNAL, VIBNAL, 0))
return -1;
- for (index = 0;;index++) {
+ for (index = 0; ; index++) {
PCFG_INIT (pcfg, NAL_CMD_GET_CONN);
pcfg.pcfg_count = index;
pcfg.pcfg_nid);
}
- if (index == 0)
- printf ("<no connections>\n");
+ if (index == 0) {
+ if (errno == ENOENT) {
+ printf ("<no connections>\n");
+ } else {
+ fprintf(stderr, "Error getting connection list: %s: "
+ "check dmesg.\n",
+ strerror(errno));
+ }
+ }
return 0;
}
if (rc != 0)
break;
- printf ("%p: %5s payload %6d bytes to "LPX64" via "LPX64" by pid %6d: %s, %s, state %d\n",
- pcfg.pcfg_pbuf1,
+ printf ("%5s payload %6d bytes to "LPX64" via "LPX64" by pid %6d: %s, %s, state %d\n",
pcfg.pcfg_count == PTL_MSG_ACK ? "ACK" :
pcfg.pcfg_count == PTL_MSG_PUT ? "PUT" :
pcfg.pcfg_count == PTL_MSG_GET ? "GET" :
- pcfg.pcfg_count == PTL_MSG_REPLY ? "REPLY" : "<wierd message>",
+ pcfg.pcfg_count == PTL_MSG_REPLY ? "REPLY" : "<weird message>",
pcfg.pcfg_size,
pcfg.pcfg_nid,
pcfg.pcfg_nid2,
pcfg.pcfg_flags >> 2);
}
- if (index == 0)
- printf ("<no active descs>\n");
+ if (index == 0) {
+ if (errno == ENOENT) {
+ printf ("<no active descs>\n");
+ } else {
+ fprintf(stderr, "Error getting active transmits list: "
+ "%s: check dmesg.\n",
+ strerror(errno));
+ }
+ }
return 0;
}
jt_ptl_loopback (int argc, char **argv)
{
int rc;
- ptl_nid_t nid;
- unsigned int threshold;
int set;
int enable;
struct portal_ioctl_data data;
ptl_nid2str (buffer[2], nid2),
alive ? "up" : "down");
}
+
+ if (index == 0 && errno != ENOENT) {
+ fprintf(stderr, "Error getting routes: %s: check dmesg.\n",
+ strerror(errno));
+ }
return (0);
}