X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Futils%2Fportals.c;h=10b2014f957609326b22b3c4527f9ba78f98841a;hb=9eb17a83e9b0b1c8a79530d0a876537a9f804151;hp=671e78ca055b4fcd94f1054e09678a3527d7460c;hpb=b3a57a47786859cbaa45a637f7f3cb1940fcaf05;p=fs%2Flustre-release.git diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index 671e78c..10b2014 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -1011,17 +1011,38 @@ int jt_ptl_ping(int argc, char **argv) lnet_process_id_t ids[16]; int maxids = sizeof(ids)/sizeof(ids[0]); struct libcfs_ioctl_data data; + char *sep; int i; if (argc < 2) { - fprintf(stderr, "usage: %s nid [timeout (secs)] [pid]\n", argv[0]); + fprintf(stderr, "usage: %s id [timeout (secs)]\n", argv[0]); return 0; } - id.nid = libcfs_str2nid(argv[1]); - if (id.nid == LNET_NID_ANY) { - fprintf (stderr, "Can't parse nid \"%s\"\n", argv[1]); - return -1; + sep = strchr(argv[1], '-'); + if (sep == NULL) { + id.pid = LNET_PID_ANY; + id.nid = libcfs_str2nid(argv[1]); + if (id.nid == LNET_NID_ANY) { + fprintf (stderr, "Can't parse nid \"%s\"\n", argv[1]); + return -1; + } + } else { + char *end; + + if (argv[1][0] == 'u' || + argv[1][0] == 'U') + id.pid = strtoul(&argv[1][1], &end, 0) | LNET_PID_USERFLAG; + else + id.pid = strtoul(argv[1], &end, 0); + + id.nid = libcfs_str2nid(sep + 1); + + if (end != sep || + id.nid == LNET_NID_ANY) { + fprintf(stderr, "Can't parse process id \"%s\"\n", argv[1]); + return -1; + } } if (argc > 2) @@ -1029,11 +1050,6 @@ int jt_ptl_ping(int argc, char **argv) else timeout = 1000; /* default 1 second timeout */ - if (argc > 3) - id.pid = atol(argv[3]); - else - id.pid = LNET_PID_ANY; - LIBCFS_IOC_INIT (data); data.ioc_nid = id.nid; data.ioc_u32[0] = id.pid;