tools/perf/ui/setup.c
Source file repositories/reference/linux-study-clean/tools/perf/ui/setup.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/ui/setup.c- Extension
.c- Size
- 2610 bytes
- Lines
- 142
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dlfcn.hsignal.hunistd.hsubcmd/pager.h../util/debug.h../util/hist.hui.h
Detected Declarations
function setup_gtk_browserfunction exit_gtk_browserfunction setup_gtk_browserfunction exit_gtk_browserfunction setup_browserfunction exit_browserfunction pthread__block_sigwinchfunction pthread__unblock_sigwinch
Annotated Snippet
static inline int setup_gtk_browser(void) { return -1; }
static inline void exit_gtk_browser(bool wait_for_ok __maybe_unused) {}
#endif
int stdio__config_color(const struct option *opt __maybe_unused,
const char *mode, int unset __maybe_unused)
{
perf_use_color_default = perf_config_colorbool("color.ui", mode, -1);
return 0;
}
void setup_browser(bool fallback_to_pager)
{
mutex_init(&ui__lock);
if (use_browser < 2 && (!isatty(1) || dump_trace))
use_browser = 0;
/* default to TUI */
if (use_browser < 0)
use_browser = 1;
switch (use_browser) {
case 2:
if (setup_gtk_browser() == 0)
break;
printf("GTK browser requested but could not find %s\n",
PERF_GTK_DSO);
sleep(1);
use_browser = 1;
/* fall through */
case 1:
if (ui__init() == 0)
break;
/* fall through */
default:
use_browser = 0;
if (fallback_to_pager)
setup_pager();
break;
}
}
void exit_browser(bool wait_for_ok)
{
switch (use_browser) {
case 2:
exit_gtk_browser(wait_for_ok);
break;
case 1:
ui__exit(wait_for_ok);
break;
default:
break;
}
mutex_destroy(&ui__lock);
}
void pthread__block_sigwinch(void)
{
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGWINCH);
pthread_sigmask(SIG_BLOCK, &set, NULL);
}
void pthread__unblock_sigwinch(void)
{
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGWINCH);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
}
Annotation
- Immediate include surface: `dlfcn.h`, `signal.h`, `unistd.h`, `subcmd/pager.h`, `../util/debug.h`, `../util/hist.h`, `ui.h`.
- Detected declarations: `function setup_gtk_browser`, `function exit_gtk_browser`, `function setup_gtk_browser`, `function exit_gtk_browser`, `function setup_browser`, `function exit_browser`, `function pthread__block_sigwinch`, `function pthread__unblock_sigwinch`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.