haproxy/include/haproxy/cli.h
Tim Duesterhus 992007ec78 CLEANUP: tree-wide: fix prototypes for functions taking no arguments.
"f(void)" is the correct and preferred form for a function taking no
argument, while some places use the older "f()". These were reported
by clang's -Wmissing-prototypes, for example:

  src/cpuset.c:111:5: warning: no previous prototype for function 'ha_cpuset_size' [-Wmissing-prototypes]
  int ha_cpuset_size()
  include/haproxy/cpuset.h:42:5: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
  int ha_cpuset_size();
      ^
                     void

This aggregate patch fixes this for the following functions:

   ha_backtrace_to_stderr(), ha_cpuset_size(), ha_panic(), ha_random64(),
   ha_thread_dump_all_to_trash(), get_exec_path(), check_config_validity(),
   mworker_child_nb(), mworker_cli_proxy_(create|stop)(),
   mworker_cleantasks(), mworker_cleanlisteners(), mworker_ext_launch_all(),
   mworker_reload(), mworker_(env|proc_list)_to_(proc_list|env)(),
   mworker_(un|)block_signals(), proxy_adjust_all_maxconn(),
   proxy_destroy_all_defaults(), get_tainted(),
   pool_total_(allocated|used)(), thread_isolate(_full|)(),
   thread(_sync|)_release(), thread_harmless_till_end(),
   thread_cpu_mask_forced(), dequeue_all_listeners(), next_timer_expiry(),
   wake_expired_tasks(), process_runnable_tasks(), init_acl(),
   init_buffer(), (de|)init_log_buffers(), (de|)init_pollers(),
   fork_poller(), pool_destroy_all(), pool_evict_from_local_caches(),
   pool_total_failures(), dump_pools_to_trash(), cfg_run_diagnostics(),
   tv_init_(process|thread)_date(), __signal_process_queue(),
   deinit_signals(), haproxy_unblock_signals()
2021-09-15 11:07:18 +02:00

103 lines
3.2 KiB
C

/*
* include/haproxy/cli.h
* This file contains definitions of some primitives to dedicated to
* statistics output.
*
* Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
* exclusively.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _HAPROXY_CLI_H
#define _HAPROXY_CLI_H
#include <haproxy/applet-t.h>
#include <haproxy/channel-t.h>
#include <haproxy/cli-t.h>
#include <haproxy/global.h>
#include <haproxy/mworker-t.h>
#include <haproxy/stream-t.h>
void cli_register_kw(struct cli_kw_list *kw_list);
struct cli_kw* cli_find_kw_exact(char **args);
int cli_has_level(struct appctx *appctx, int level);
int cli_parse_default(char **args, char *payload, struct appctx *appctx, void *private);
/* mworker proxy functions */
int mworker_cli_proxy_create(void);
int mworker_cli_proxy_new_listener(char *line);
int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc);
void mworker_cli_proxy_stop(void);
/* proxy mode cli functions */
/* analyzers */
int pcli_wait_for_request(struct stream *s, struct channel *req, int an_bit);
int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit);
/* updates the CLI's context to log <msg> at <severity> and returns 1. This is
* for use in CLI parsers to deal with quick response messages.
*/
static inline int cli_msg(struct appctx *appctx, int severity, const char *msg)
{
appctx->ctx.cli.severity = severity;
appctx->ctx.cli.msg = msg;
appctx->st0 = CLI_ST_PRINT;
return 1;
}
/* updates the CLI's context to log error message <err> and returns 1. The
* message will be logged at level LOG_ERR. This is for use in CLI parsers to
* deal with quick response messages.
*/
static inline int cli_err(struct appctx *appctx, const char *err)
{
appctx->ctx.cli.msg = err;
appctx->st0 = CLI_ST_PRINT_ERR;
return 1;
}
/* updates the CLI's context to log <msg> at <severity> and returns 1. The
* message must have been dynamically allocated and will be freed. This is
* for use in CLI parsers to deal with quick response messages.
*/
static inline int cli_dynmsg(struct appctx *appctx, int severity, char *msg)
{
appctx->ctx.cli.severity = severity;
appctx->ctx.cli.err = msg;
appctx->st0 = CLI_ST_PRINT_DYN;
return 1;
}
/* updates the CLI's context to log error message <err> and returns 1. The
* message must have been dynamically allocated and will be freed. The message
* will be logged at level LOG_ERR. This is for use in CLI parsers to deal with
* quick response messages.
*/
static inline int cli_dynerr(struct appctx *appctx, char *err)
{
appctx->ctx.cli.err = err;
appctx->st0 = CLI_ST_PRINT_FREE;
return 1;
}
#endif /* _HAPROXY_CLI_H */