xref: /openbmc/linux/tools/perf/util/usage.c (revision 0adea51a)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
286470930SIngo Molnar /*
35f9273d6SNamhyung Kim  * usage.c
45f9273d6SNamhyung Kim  *
55f9273d6SNamhyung Kim  * Various reporting routines.
65f9273d6SNamhyung Kim  * Originally copied from GIT source.
786470930SIngo Molnar  *
886470930SIngo Molnar  * Copyright (C) Linus Torvalds, 2005
986470930SIngo Molnar  */
1086470930SIngo Molnar #include "util.h"
11215a0d30SArnaldo Carvalho de Melo #include <stdio.h>
12215a0d30SArnaldo Carvalho de Melo #include <stdlib.h>
13215a0d30SArnaldo Carvalho de Melo #include <linux/compiler.h>
1486470930SIngo Molnar 
15*0adea51aSIan Rogers const char perf_usage_string[] =
16*0adea51aSIan Rogers 	"perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
17*0adea51aSIan Rogers 
18*0adea51aSIan Rogers const char perf_more_info_string[] =
19*0adea51aSIan Rogers 	"See 'perf help COMMAND' for more information on a specific command.";
20*0adea51aSIan Rogers 
usage_builtin(const char * err)216c346643SArnaldo Carvalho de Melo static __noreturn void usage_builtin(const char *err)
2286470930SIngo Molnar {
23716c69feSIngo Molnar 	fprintf(stderr, "\n Usage: %s\n", err);
2486470930SIngo Molnar 	exit(129);
2586470930SIngo Molnar }
2686470930SIngo Molnar 
2786470930SIngo Molnar /* If we are in a dlopen()ed .so write to a global variable would segfault
2886470930SIngo Molnar  * (ugh), so keep things static. */
296c346643SArnaldo Carvalho de Melo static void (*usage_routine)(const char *err) __noreturn = usage_builtin;
302690c730SNamhyung Kim 
usage(const char * err)3186470930SIngo Molnar void usage(const char *err)
3286470930SIngo Molnar {
3386470930SIngo Molnar 	usage_routine(err);
3486470930SIngo Molnar }
35