/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*
* This file is part of Portals, http://www.sf.net/projects/lustre/
*
int main(int argc, char **argv)
{
- if (dbg_initialize(argc, argv) < 0)
- exit(2);
+ int rc = 0;
+
+ rc = libcfs_arch_init();
+ if (rc < 0)
+ return rc;
+
+ rc = dbg_initialize(argc, argv);
+ if (rc < 0)
+ goto errorout;
register_ioc_dev(LNET_DEV_ID, LNET_DEV_PATH,
LNET_DEV_MAJOR, LNET_DEV_MINOR);
Parser_init("debugctl > ", list);
- if (argc > 1)
- return Parser_execarg(argc - 1, &argv[1], list);
+ if (argc > 1) {
+ rc = Parser_execarg(argc - 1, &argv[1], list);
+ unregister_ioc_dev(LNET_DEV_ID);
+ goto errorout;
+ }
Parser_commands();
unregister_ioc_dev(LNET_DEV_ID);
- return 0;
+
+errorout:
+ libcfs_arch_cleanup();
+ return rc;
}