浏览代码

Test that the clock is working at start and test for evloop errors.

master
Richard Nyberg 16 年前
父节点
当前提交
2947896074
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. +9
    -2
      btpd/main.c

+ 9
- 2
btpd/main.c 查看文件

@@ -3,6 +3,7 @@
#include <sys/file.h> #include <sys/file.h>
#include <err.h> #include <err.h>
#include <getopt.h> #include <getopt.h>
#include <time.h>


static void static void
writepid(int pidfd) writepid(int pidfd)
@@ -16,6 +17,11 @@ static void
setup_daemon(int daemonize, const char *dir, const char *log) setup_daemon(int daemonize, const char *dir, const char *log)
{ {
int pidfd; int pidfd;
struct timespec ts;

if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
errx(1, "clock_gettime(CLOCK_MONOTONIC, ...) error (%s).",
strerror(errno));


if (log == NULL) if (log == NULL)
log = "log"; log = "log";
@@ -221,13 +227,14 @@ args_done:


setup_daemon(daemonize, dir, log); setup_daemon(daemonize, dir, log);


evloop_init(); if (evloop_init() != 0)
btpd_err("Failed to initialize evloop (%s).\n", strerror(errno));


btpd_init(); btpd_init();


evloop(); evloop();


btpd_err("Unexpected exit from evloop.\n"); btpd_err("Exit from evloop with error (%s).\n", strerror(errno));


return 1; return 1;
} }

||||||
x
 
000:0
正在加载...
取消
保存