File: util.c

package info (click to toggle)
pcaputils 0.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: ansic: 2,945; sh: 44; makefile: 38
file content (22 lines) | stat: -rw-r--r-- 452 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <execinfo.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include <util/util.h>

bool util_flag_daemonized;
bool util_flag_verbose;

void util_print_backtrace(int x __unused){
#define NFRAMES 32
	int nptrs;
	void *buf[NFRAMES];

	fprintf(stderr, "what? alarms?! good lord, we're under electronic attack!\n");

	nptrs = backtrace(buf, NFRAMES);
	backtrace_symbols_fd(buf, nptrs, STDERR_FILENO);
	abort();
}