mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 15:04:27 +08:00
a41794cdd7
Without the bloated cplus_demangle from binutils, i.e building with:
$ make NO_DEMANGLE=1 O=~acme/git/build/perf -j3 -C tools/perf/ install
Before:
text data bss dec hex filename
471851 29280 4025056 4526187
45106b /home/acme/bin/perf
After:
[acme@doppio linux-2.6-tip]$ size ~/bin/perf
text data bss dec hex filename
446886 29232 4008576 4484694 446e56 /home/acme/bin/perf
So its a 5.3% size reduction in code, but the interesting part is in the git
diff --stat output:
19 files changed, 20 insertions(+), 1909 deletions(-)
If we ever need some of the things we got from git but weren't using, we just
have to go to the git repo and get fresh, uptodate source code bits.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
53 lines
976 B
C
53 lines
976 B
C
#include "sigchain.h"
|
|
#include "cache.h"
|
|
|
|
#define SIGCHAIN_MAX_SIGNALS 32
|
|
|
|
struct sigchain_signal {
|
|
sigchain_fun *old;
|
|
int n;
|
|
int alloc;
|
|
};
|
|
static struct sigchain_signal signals[SIGCHAIN_MAX_SIGNALS];
|
|
|
|
static void check_signum(int sig)
|
|
{
|
|
if (sig < 1 || sig >= SIGCHAIN_MAX_SIGNALS)
|
|
die("BUG: signal out of range: %d", sig);
|
|
}
|
|
|
|
static int sigchain_push(int sig, sigchain_fun f)
|
|
{
|
|
struct sigchain_signal *s = signals + sig;
|
|
check_signum(sig);
|
|
|
|
ALLOC_GROW(s->old, s->n + 1, s->alloc);
|
|
s->old[s->n] = signal(sig, f);
|
|
if (s->old[s->n] == SIG_ERR)
|
|
return -1;
|
|
s->n++;
|
|
return 0;
|
|
}
|
|
|
|
int sigchain_pop(int sig)
|
|
{
|
|
struct sigchain_signal *s = signals + sig;
|
|
check_signum(sig);
|
|
if (s->n < 1)
|
|
return 0;
|
|
|
|
if (signal(sig, s->old[s->n - 1]) == SIG_ERR)
|
|
return -1;
|
|
s->n--;
|
|
return 0;
|
|
}
|
|
|
|
void sigchain_push_common(sigchain_fun f)
|
|
{
|
|
sigchain_push(SIGINT, f);
|
|
sigchain_push(SIGHUP, f);
|
|
sigchain_push(SIGTERM, f);
|
|
sigchain_push(SIGQUIT, f);
|
|
sigchain_push(SIGPIPE, f);
|
|
}
|