Whamcloud - gitweb
LU-2989 build: some make targets are broken
[fs/lustre-release.git] / lnet / utils / ptlctl.c
index c3ab2b7..81e5548 100644 (file)
@@ -1,7 +1,5 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  *
  *   This file is part of Portals, http://www.sf.net/projects/lustre/
  *
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <lnet/api-support.h>
 #include <lnet/lnetctl.h>
-
-#include "parser.h"
+#include <libcfs/libcfsutil.h>
 
 
 command_t list[] = {
@@ -43,7 +39,6 @@ command_t list[] = {
         {"disconnect", jt_ptl_disconnect, 0, "disconnect from a remote nid (args: [nid] [host]"},
         {"push", jt_ptl_push_connection, 0, "flush connection to a remote nid (args: [nid]"},
         {"active_tx", jt_ptl_print_active_txs, 0, "print active transmits (no args)"},
-        {"testping", jt_ptl_ping_test, 0, "do a ping test (args: nid [count] [size] [timeout])"},
         {"ping", jt_ptl_ping, 0, "ping (args: nid [timeout] [pid])"},
         {"mynid", jt_ptl_mynid, 0, "inform the socknal of the local NID (args: [hostname])"},
         {"add_route", jt_ptl_add_route, 0, 
@@ -64,14 +59,25 @@ command_t list[] = {
 
 int main(int argc, char **argv)
 {
-        if (ptl_initialize(argc, argv) < 0)
-                exit(1);
+        int rc = 0;
+
+        rc = libcfs_arch_init();
+        if (rc < 0)
+                return rc;
+
+        rc = ptl_initialize(argc, argv);
+        if (rc < 0)
+                goto errorout;
 
         Parser_init("ptlctl > ", list);
-        if (argc > 1)
-                return Parser_execarg(argc - 1, &argv[1], list);
+        if (argc > 1) {
+                rc = Parser_execarg(argc - 1, &argv[1], list);
+                goto errorout;
+        }
 
         Parser_commands();
 
-        return 0;
+errorout:
+        libcfs_arch_cleanup();
+        return rc;
 }