X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Funixctl.c;h=104a2d9a3a3bcdb82486d43e879c14d254953134;hb=7fa0f73fb284b4406bcd085ee62552891b3fa6cd;hp=d8974c9e44503ac0d93d779b50853b019a75fec7;hpb=324f0c59d2bf3a0ad74c93b683b6ceeb1d732304;p=sliver-openvswitch.git diff --git a/lib/unixctl.c b/lib/unixctl.c index d8974c9e4..104a2d9a3 100644 --- a/lib/unixctl.c +++ b/lib/unixctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ #include #include "unixctl.h" -#include #include #include #include "coverage.h" @@ -95,13 +94,13 @@ unixctl_version(struct unixctl_conn *conn, int argc OVS_UNUSED, * arguments to the command; it is used only for presentation to the user in * "help" output. * - * 'cb' is called when the command is received. It is passed the actual set of - * arguments, as a text string, plus a copy of 'aux'. Normally 'cb' should - * reply by calling unixctl_command_reply() or unixctl_command_reply_error() - * before it returns, but if the command cannot be handled immediately then it - * can defer the reply until later. A given connection can only process a - * single request at a time, so a reply must be made eventually to avoid - * blocking that connection. */ + * 'cb' is called when the command is received. It is passed an array + * containing the command name and arguments, plus a copy of 'aux'. Normally + * 'cb' should reply by calling unixctl_command_reply() or + * unixctl_command_reply_error() before it returns, but if the command cannot + * be handled immediately then it can defer the reply until later. A given + * connection can only process a single request at a time, so a reply must be + * made eventually to avoid blocking that connection. */ void unixctl_command_register(const char *name, const char *usage, int min_args, int max_args, @@ -110,7 +109,7 @@ unixctl_command_register(const char *name, const char *usage, struct unixctl_command *command; struct unixctl_command *lookup = shash_find_data(&commands, name); - assert(!lookup || lookup->cb == cb); + ovs_assert(!lookup || lookup->cb == cb); if (lookup) { return; @@ -133,7 +132,7 @@ unixctl_command_reply__(struct unixctl_conn *conn, struct jsonrpc_msg *reply; COVERAGE_INC(unixctl_replied); - assert(conn->request_id); + ovs_assert(conn->request_id); if (!body) { body = ""; @@ -221,7 +220,7 @@ unixctl_server_create(const char *path, struct unixctl_server **serverp) program_name, (long int) getpid()); } - error = pstream_open(punix_path, &listener); + error = pstream_open(punix_path, &listener, 0); if (error) { ovs_error(error, "could not initialize control socket %s", punix_path); goto exit; @@ -422,7 +421,8 @@ unixctl_client_create(const char *path, struct jsonrpc **client) abs_path = abs_file_name(ovs_rundir(), path); unix_path = xasprintf("unix:%s", abs_path); - error = stream_open_block(stream_open(unix_path, &stream), &stream); + error = stream_open_block(stream_open(unix_path, &stream, DSCP_DEFAULT), + &stream); free(unix_path); free(abs_path); @@ -462,7 +462,7 @@ unixctl_client_transact(struct jsonrpc *client, const char *command, int argc, error = jsonrpc_transact_block(client, request, &reply); if (error) { VLOG_WARN("error communicating with %s: %s", jsonrpc_get_name(client), - strerror(error)); + ovs_retval_to_string(error)); return error; }