Skip to content

Commit

Permalink
Merge branch 'temp_debug' into razvancrainea-feature/norecord
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Mar 1, 2020
2 parents 5e2e36d + b60268a commit 078f6a2
Show file tree
Hide file tree
Showing 28 changed files with 422 additions and 263 deletions.
24 changes: 12 additions & 12 deletions autosrc/rtpp_log_obj_fin.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "rtpp_log_obj.h"
#include "rtpp_log_obj_fin.h"
static void rtpp_log_ewrite_fin(void *pub) {
fprintf(stderr, "Method rtpp_log@%p::ewrite (rtpp_log_ewrite) is invoked after destruction\x0a", pub);
fprintf(stderr, "Method rtpp_log@%p::errwrite (rtpp_log_ewrite) is invoked after destruction\x0a", pub);
RTPP_AUTOTRAP();
}
static void rtpp_log_setlevel_fin(void *pub) {
Expand All @@ -20,22 +20,22 @@ static void rtpp_log_start_fin(void *pub) {
RTPP_AUTOTRAP();
}
static void rtpp_log_write_fin(void *pub) {
fprintf(stderr, "Method rtpp_log@%p::write (rtpp_log_write) is invoked after destruction\x0a", pub);
fprintf(stderr, "Method rtpp_log@%p::genwrite (rtpp_log_write) is invoked after destruction\x0a", pub);
RTPP_AUTOTRAP();
}
void rtpp_log_fin(struct rtpp_log *pub) {
RTPP_DBG_ASSERT(pub->ewrite != (rtpp_log_ewrite_t)NULL);
RTPP_DBG_ASSERT(pub->ewrite != (rtpp_log_ewrite_t)&rtpp_log_ewrite_fin);
pub->ewrite = (rtpp_log_ewrite_t)&rtpp_log_ewrite_fin;
RTPP_DBG_ASSERT(pub->errwrite != (rtpp_log_ewrite_t)NULL);
RTPP_DBG_ASSERT(pub->errwrite != (rtpp_log_ewrite_t)&rtpp_log_ewrite_fin);
pub->errwrite = (rtpp_log_ewrite_t)&rtpp_log_ewrite_fin;
RTPP_DBG_ASSERT(pub->setlevel != (rtpp_log_setlevel_t)NULL);
RTPP_DBG_ASSERT(pub->setlevel != (rtpp_log_setlevel_t)&rtpp_log_setlevel_fin);
pub->setlevel = (rtpp_log_setlevel_t)&rtpp_log_setlevel_fin;
RTPP_DBG_ASSERT(pub->start != (rtpp_log_start_t)NULL);
RTPP_DBG_ASSERT(pub->start != (rtpp_log_start_t)&rtpp_log_start_fin);
pub->start = (rtpp_log_start_t)&rtpp_log_start_fin;
RTPP_DBG_ASSERT(pub->write != (rtpp_log_write_t)NULL);
RTPP_DBG_ASSERT(pub->write != (rtpp_log_write_t)&rtpp_log_write_fin);
pub->write = (rtpp_log_write_t)&rtpp_log_write_fin;
RTPP_DBG_ASSERT(pub->genwrite != (rtpp_log_write_t)NULL);
RTPP_DBG_ASSERT(pub->genwrite != (rtpp_log_write_t)&rtpp_log_write_fin);
pub->genwrite = (rtpp_log_write_t)&rtpp_log_write_fin;
}
#if defined(RTPP_FINTEST)
#include <assert.h>
Expand All @@ -58,17 +58,17 @@ rtpp_log_fintest()
tp = rtpp_rzmalloc(sizeof(*tp), offsetof(typeof(*tp), pub.rcnt));
assert(tp != NULL);
assert(tp->pub.rcnt != NULL);
tp->pub.ewrite = (rtpp_log_ewrite_t)((void *)0x1);
tp->pub.errwrite = (rtpp_log_ewrite_t)((void *)0x1);
tp->pub.setlevel = (rtpp_log_setlevel_t)((void *)0x1);
tp->pub.start = (rtpp_log_start_t)((void *)0x1);
tp->pub.write = (rtpp_log_write_t)((void *)0x1);
tp->pub.genwrite = (rtpp_log_write_t)((void *)0x1);
CALL_SMETHOD(tp->pub.rcnt, attach, (rtpp_refcnt_dtor_t)&rtpp_log_fin,
&tp->pub);
RTPP_OBJ_DECREF(&(tp->pub));
CALL_TFIN(&tp->pub, ewrite);
CALL_TFIN(&tp->pub, errwrite);
CALL_TFIN(&tp->pub, setlevel);
CALL_TFIN(&tp->pub, start);
CALL_TFIN(&tp->pub, write);
CALL_TFIN(&tp->pub, genwrite);
assert((_naborts - naborts_s) == 4);
}
const static void *_rtpp_log_ftp = (void *)&rtpp_log_fintest;
Expand Down
12 changes: 6 additions & 6 deletions autosrc/rtpp_record_fin.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
#include "rtpp_record.h"
#include "rtpp_record_fin.h"
static void rtpp_record_write_fin(void *pub) {
fprintf(stderr, "Method rtpp_record@%p::write (rtpp_record_write) is invoked after destruction\x0a", pub);
fprintf(stderr, "Method rtpp_record@%p::pktwrite (rtpp_record_write) is invoked after destruction\x0a", pub);
RTPP_AUTOTRAP();
}
void rtpp_record_fin(struct rtpp_record *pub) {
RTPP_DBG_ASSERT(pub->write != (rtpp_record_write_t)NULL);
RTPP_DBG_ASSERT(pub->write != (rtpp_record_write_t)&rtpp_record_write_fin);
pub->write = (rtpp_record_write_t)&rtpp_record_write_fin;
RTPP_DBG_ASSERT(pub->pktwrite != (rtpp_record_write_t)NULL);
RTPP_DBG_ASSERT(pub->pktwrite != (rtpp_record_write_t)&rtpp_record_write_fin);
pub->pktwrite = (rtpp_record_write_t)&rtpp_record_write_fin;
}
#if defined(RTPP_FINTEST)
#include <assert.h>
Expand All @@ -37,11 +37,11 @@ rtpp_record_fintest()
tp = rtpp_rzmalloc(sizeof(*tp), offsetof(typeof(*tp), pub.rcnt));
assert(tp != NULL);
assert(tp->pub.rcnt != NULL);
tp->pub.write = (rtpp_record_write_t)((void *)0x1);
tp->pub.pktwrite = (rtpp_record_write_t)((void *)0x1);
CALL_SMETHOD(tp->pub.rcnt, attach, (rtpp_refcnt_dtor_t)&rtpp_record_fin,
&tp->pub);
RTPP_OBJ_DECREF(&(tp->pub));
CALL_TFIN(&tp->pub, write);
CALL_TFIN(&tp->pub, pktwrite);
assert((_naborts - naborts_s) == 1);
}
const static void *_rtpp_record_ftp = (void *)&rtpp_record_fintest;
Expand Down
3 changes: 2 additions & 1 deletion libucl/libucl_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ conf_helper_mapper(const ucl_object_t *obj, conf_helper_map *map,
const char *key = NULL;
int i;
bool ret = true, found = false;
static struct rtpp_log log = {.write = rtpp_log_obj_write_early, .ewrite = rtpp_log_obj_ewrite_early};
static struct rtpp_log log = {.genwrite = rtpp_log_obj_write_early,
.errwrite = rtpp_log_obj_ewrite_early};

it = ucl_object_iterate_new(obj);
if (it == NULL)
Expand Down
5 changes: 4 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,10 @@ main(int argc, char **argv)
i = open(cfs.pid_file, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
if (i >= 0) {
len = sprintf(buf, "%u\n", (unsigned int)getpid());
write(i, buf, len);
if (write(i, buf, len) != len) {
RTPP_ELOG(cfs.glog, RTPP_LOG_ERR, "can't write pidfile");
exit(1);
}
close(i);
} else {
RTPP_ELOG(cfs.glog, RTPP_LOG_ERR, "can't open pidfile for writing");
Expand Down
Loading

0 comments on commit 078f6a2

Please sign in to comment.