common: move some files out of lightningd/

Basically all files shared by different daemons.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-08-29 01:35:01 +09:30
committed by Christian Decker
parent 8375857116
commit a37c165cb9
97 changed files with 302 additions and 246 deletions

30
common/debug.c Normal file
View File

@@ -0,0 +1,30 @@
#include <ccan/str/str.h>
#include <common/debug.h>
#include <common/dev_disconnect.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
void subdaemon_debug(int argc, char *argv[])
{
int i;
bool printed = false;
for (i = 1; i < argc; i++) {
if (strstarts(argv[i], "--dev-disconnect=")) {
dev_disconnect_init(atoi(argv[i]
+ strlen("--dev-disconnect=")));
}
}
/* From debugger, tell gdb "return". */
for (i = 1; i < argc; i++) {
while (streq(argv[i], "--debugger")) {
if (!printed)
fprintf(stderr, "gdb -ex 'attach %u' %s\n",
getpid(), argv[0]);
printed = true;
}
}
}