|
|
@ -837,6 +837,17 @@ static void check_createdate_ccl(char *cmd, tv_t *cd) |
|
|
|
STRNCPY(last_cmd, cmd); |
|
|
|
STRNCPY(last_cmd, cmd); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _ckdb_unix_msg(int sockd, const char *msg, WHERE_FFL_ARGS) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
bool ok; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ok = _send_unix_msg(sockd, msg, UNIX_WRITE_TIMEOUT, WHERE_FFL_PASS); |
|
|
|
|
|
|
|
if (!ok) { |
|
|
|
|
|
|
|
LOGWARNING(" msg was %.42s%s", msg ? : nullstr, |
|
|
|
|
|
|
|
msg ? "..." : EMPTY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static uint64_t ticks; |
|
|
|
static uint64_t ticks; |
|
|
|
static time_t last_tick; |
|
|
|
static time_t last_tick; |
|
|
|
|
|
|
|
|
|
|
@ -4334,7 +4345,7 @@ static void process_sockd(PGconn *conn, K_ITEM *wq_item) |
|
|
|
snprintf(rep, siz, "%s.%ld.%s", |
|
|
|
snprintf(rep, siz, "%s.%ld.%s", |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
msgline->now.tv_sec, ans); |
|
|
|
msgline->now.tv_sec, ans); |
|
|
|
send_unix_msg(msgline->sockd, rep); |
|
|
|
ckdb_unix_msg(msgline->sockd, rep); |
|
|
|
close(msgline->sockd); |
|
|
|
close(msgline->sockd); |
|
|
|
K_WLOCK(breakqueue_free); |
|
|
|
K_WLOCK(breakqueue_free); |
|
|
|
sockd_count--; |
|
|
|
sockd_count--; |
|
|
@ -4478,7 +4489,7 @@ static void *process_socket(void *arg) |
|
|
|
"%s.%ld.?.", |
|
|
|
"%s.%ld.?.", |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
bq->now.tv_sec); |
|
|
|
bq->now.tv_sec); |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CMD_ALERTEVENT: |
|
|
|
case CMD_ALERTEVENT: |
|
|
|
case CMD_ALERTOVENT: |
|
|
|
case CMD_ALERTOVENT: |
|
|
@ -4490,7 +4501,7 @@ static void *process_socket(void *arg) |
|
|
|
tmp = reply_event(EVENTID_NONE, reply); |
|
|
|
tmp = reply_event(EVENTID_NONE, reply); |
|
|
|
else |
|
|
|
else |
|
|
|
tmp = reply_ovent(OVENTID_NONE, reply); |
|
|
|
tmp = reply_ovent(OVENTID_NONE, reply); |
|
|
|
send_unix_msg(bq->sockd, tmp); |
|
|
|
ckdb_unix_msg(bq->sockd, tmp); |
|
|
|
FREENULL(tmp); |
|
|
|
FREENULL(tmp); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CMD_TERMINATE: |
|
|
|
case CMD_TERMINATE: |
|
|
@ -4501,7 +4512,7 @@ static void *process_socket(void *arg) |
|
|
|
"%s.%ld.ok.exiting", |
|
|
|
"%s.%ld.ok.exiting", |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
bq->now.tv_sec); |
|
|
|
bq->now.tv_sec); |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
everyone_die = true; |
|
|
|
everyone_die = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CMD_PING: |
|
|
|
case CMD_PING: |
|
|
@ -4511,7 +4522,7 @@ static void *process_socket(void *arg) |
|
|
|
"%s.%ld.ok.pong", |
|
|
|
"%s.%ld.ok.pong", |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
bq->now.tv_sec); |
|
|
|
bq->now.tv_sec); |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CMD_VERSION: |
|
|
|
case CMD_VERSION: |
|
|
|
LOGDEBUG("Listener received" |
|
|
|
LOGDEBUG("Listener received" |
|
|
@ -4521,7 +4532,7 @@ static void *process_socket(void *arg) |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
bq->now.tv_sec, |
|
|
|
bq->now.tv_sec, |
|
|
|
CKDB_VERSION); |
|
|
|
CKDB_VERSION); |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CMD_LOGLEVEL: |
|
|
|
case CMD_LOGLEVEL: |
|
|
|
if (!*(msgline->id)) { |
|
|
|
if (!*(msgline->id)) { |
|
|
@ -4565,7 +4576,7 @@ static void *process_socket(void *arg) |
|
|
|
" %d currently %d B", |
|
|
|
" %d currently %d B", |
|
|
|
loglevel, oldloglevel); |
|
|
|
loglevel, oldloglevel); |
|
|
|
} |
|
|
|
} |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CMD_FLUSH: |
|
|
|
case CMD_FLUSH: |
|
|
|
LOGDEBUG("Listener received" |
|
|
|
LOGDEBUG("Listener received" |
|
|
@ -4573,7 +4584,7 @@ static void *process_socket(void *arg) |
|
|
|
snprintf(reply, sizeof(reply), |
|
|
|
snprintf(reply, sizeof(reply), |
|
|
|
"%s.%ld.ok.splash", |
|
|
|
"%s.%ld.ok.splash", |
|
|
|
msgline->id, bq->now.tv_sec); |
|
|
|
msgline->id, bq->now.tv_sec); |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
fflush(stdout); |
|
|
|
fflush(stdout); |
|
|
|
fflush(stderr); |
|
|
|
fflush(stderr); |
|
|
|
if (global_ckp && global_ckp->logfd) |
|
|
|
if (global_ckp && global_ckp->logfd) |
|
|
@ -4638,7 +4649,7 @@ static void *process_socket(void *arg) |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
bq->now.tv_sec, |
|
|
|
bq->now.tv_sec, |
|
|
|
msgline->cmd); |
|
|
|
msgline->cmd); |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
msgline->sockd = bq->sockd; |
|
|
|
msgline->sockd = bq->sockd; |
|
|
|
bq->sockd = -1; |
|
|
|
bq->sockd = -1; |
|
|
@ -4683,7 +4694,7 @@ static void *process_socket(void *arg) |
|
|
|
snprintf(rep, siz, "%s.%ld.%s", |
|
|
|
snprintf(rep, siz, "%s.%ld.%s", |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
bq->now.tv_sec, ans); |
|
|
|
bq->now.tv_sec, ans); |
|
|
|
send_unix_msg(bq->sockd, rep); |
|
|
|
ckdb_unix_msg(bq->sockd, rep); |
|
|
|
FREENULL(ans); |
|
|
|
FREENULL(ans); |
|
|
|
FREENULL(rep); |
|
|
|
FREENULL(rep); |
|
|
|
replied = true; |
|
|
|
replied = true; |
|
|
@ -4705,7 +4716,7 @@ static void *process_socket(void *arg) |
|
|
|
"%s.%ld.ok.queued", |
|
|
|
"%s.%ld.ok.queued", |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
bq->now.tv_sec); |
|
|
|
bq->now.tv_sec); |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
K_WLOCK(workqueue_free); |
|
|
|
K_WLOCK(workqueue_free); |
|
|
@ -4746,7 +4757,7 @@ static void *process_socket(void *arg) |
|
|
|
"%s.%ld.failed.code", |
|
|
|
"%s.%ld.failed.code", |
|
|
|
msgline->id, |
|
|
|
msgline->id, |
|
|
|
bq->now.tv_sec); |
|
|
|
bq->now.tv_sec); |
|
|
|
send_unix_msg(bq->sockd, reply); |
|
|
|
ckdb_unix_msg(bq->sockd, reply); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (bq->sockd >= 0) { |
|
|
|
if (bq->sockd >= 0) { |
|
|
|