diff --git a/lib/formats/protobuf.c b/lib/formats/protobuf.c index 5e6a11521..e61fdb398 100644 --- a/lib/formats/protobuf.c +++ b/lib/formats/protobuf.c @@ -157,7 +157,7 @@ int protobuf_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, s smp->signals = io->signals; if (pb_smp->type != VILLAS__NODE__SAMPLE__TYPE__DATA) { - warn("Parsed non supported message type. Skipping"); + warning("Parsed non supported message type. Skipping"); continue; } diff --git a/lib/formats/raw.c b/lib/formats/raw.c index 7805edcd6..5e6894a15 100644 --- a/lib/formats/raw.c +++ b/lib/formats/raw.c @@ -222,13 +222,13 @@ int raw_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, struct return -1; if (len % (bits / 8)) { - warn("Invalid RAW Payload length: %#zx", len); + warning("Invalid RAW Payload length: %#zx", len); return -1; } if (io->flags & RAW_FAKE_HEADER) { if (nlen < o + 3) { - warn("Received a packet with no fake header. Skipping..."); + warning("Received a packet with no fake header. Skipping..."); return -1; } @@ -349,7 +349,7 @@ int raw_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, struct case SIGNAL_TYPE_AUTO: case SIGNAL_TYPE_INVALID: - warn("Unsupported format in RAW payload"); + warning("Unsupported format in RAW payload"); return -1; } } @@ -357,7 +357,7 @@ int raw_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, struct smp->length = i; if (smp->length > smp->capacity) { - warn("Received more values than supported: length=%u, capacity=%u", smp->length, smp->capacity); + warning("Received more values than supported: length=%u, capacity=%u", smp->length, smp->capacity); smp->length = smp->capacity; } diff --git a/lib/formats/villas_binary.c b/lib/formats/villas_binary.c index fa28a22fe..d402f6667 100644 --- a/lib/formats/villas_binary.c +++ b/lib/formats/villas_binary.c @@ -67,7 +67,7 @@ int villas_binary_sscan(struct io *io, const char *buf, size_t len, size_t *rbyt const char *ptr = buf; if (len % 4 != 0) { - warn("Packet size is invalid: %zd Must be multiple of 4 bytes.", len); + warning("Packet size is invalid: %zd Must be multiple of 4 bytes.", len); return -1; } @@ -83,7 +83,7 @@ int villas_binary_sscan(struct io *io, const char *buf, size_t len, size_t *rbyt /* Check if header is still in buffer bounaries */ if (ptr + sizeof(struct msg) > buf + len) { - warn("Invalid msg received: reason=1"); + warning("Invalid msg received: reason=1"); break; } @@ -91,7 +91,7 @@ int villas_binary_sscan(struct io *io, const char *buf, size_t len, size_t *rbyt /* Check if remainder of message is in buffer boundaries */ if (ptr + MSG_LEN(values) > buf + len) { - warn("Invalid msg received: reason=2, msglen=%zu, len=%zu, ptr=%p, buf=%p, i=%u", MSG_LEN(values), len, ptr, buf, i); + warning("Invalid msg received: reason=2, msglen=%zu, len=%zu, ptr=%p, buf=%p, i=%u", MSG_LEN(values), len, ptr, buf, i); break; } @@ -103,7 +103,7 @@ int villas_binary_sscan(struct io *io, const char *buf, size_t len, size_t *rbyt ret = msg_to_sample(msg, smp, io->signals); if (ret) { - warn("Invalid msg received: reason=3, ret=%d", ret); + warning("Invalid msg received: reason=3, ret=%d", ret); break; } diff --git a/lib/hooks/restart.c b/lib/hooks/restart.c index 909ea8aaa..24386e530 100644 --- a/lib/hooks/restart.c +++ b/lib/hooks/restart.c @@ -68,7 +68,7 @@ static int restart_process(struct hook *h, struct sample *smps[], unsigned *cnt) if (prev) { /* A wrap around of the sequence no should not be treated as a simulation restart */ if (cur->sequence == 0 && prev->sequence != 0 && prev->sequence > UINT64_MAX - 16) { - warn("Simulation from node %s restarted (previous->sequence=%" PRIu64 ", current->sequence=%" PRIu64 ")", + warning("Simulation from node %s restarted (previous->sequence=%" PRIu64 ", current->sequence=%" PRIu64 ")", node_name(h->node), prev->sequence, cur->sequence); cur->flags |= SAMPLE_IS_FIRST; diff --git a/lib/kernel/if.c b/lib/kernel/if.c index e696ec6b4..cd5f9a433 100644 --- a/lib/kernel/if.c +++ b/lib/kernel/if.c @@ -48,7 +48,7 @@ int if_init(struct interface *i, struct rtnl_link *link) if (n > 0) debug(6, "Found %u IRQs for interface '%s'", n, rtnl_link_get_name(i->nl_link)); else - warn("Did not found any interrupts for interface '%s'", rtnl_link_get_name(i->nl_link)); + warning("Did not found any interrupts for interface '%s'", rtnl_link_get_name(i->nl_link)); list_init(&i->sockets); diff --git a/lib/mapping.c b/lib/mapping.c index 2caec07ed..8b0254cad 100644 --- a/lib/mapping.c +++ b/lib/mapping.c @@ -42,13 +42,13 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no if (nodes) { node = strtok(cpy, "."); if (!node) { - warn("Missing node name"); + warning("Missing node name"); goto invalid_format; } me->node = list_lookup(nodes, node); if (!me->node) { - warn("Unknown node %s", node); + warning("Unknown node %s", node); goto invalid_format; } @@ -70,19 +70,19 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no field = strtok(NULL, "."); if (!field) { - warn("Missing stats type"); + warning("Missing stats type"); goto invalid_format; } subfield = strtok(NULL, "."); if (!subfield) { - warn("Missing stats sub-type"); + warning("Missing stats sub-type"); goto invalid_format; } id = stats_lookup_id(field); if (id < 0) { - warn("Invalid stats type"); + warning("Invalid stats type"); goto invalid_format; } @@ -103,7 +103,7 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no else if (!strcmp(subfield, "stddev")) me->stats.type = MAPPING_STATS_TYPE_STDDEV; else { - warn("Invalid stats sub-type"); + warning("Invalid stats sub-type"); goto invalid_format; } } @@ -113,7 +113,7 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no field = strtok(NULL, "."); if (!field) { - warn("Missing header type"); + warning("Missing header type"); goto invalid_format; } @@ -122,7 +122,7 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no else if (!strcmp(field, "length")) me->header.type = MAPPING_HEADER_TYPE_LENGTH; else { - warn("Invalid header type"); + warning("Invalid header type"); goto invalid_format; } } @@ -132,7 +132,7 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no field = strtok(NULL, "."); if (!field) { - warn("Missing timestamp type"); + warning("Missing timestamp type"); goto invalid_format; } @@ -141,7 +141,7 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no else if (!strcmp(field, "received")) me->timestamp.type = MAPPING_TIMESTAMP_TYPE_RECEIVED; else { - warn("Invalid timestamp type"); + warning("Invalid timestamp type"); goto invalid_format; } } @@ -160,7 +160,7 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no char *endptr; first = strtoul(first_str, &endptr, 10); if (endptr != first_str + strlen(first_str)) { - warn("Failed to parse data range"); + warning("Failed to parse data range"); goto invalid_format; } } @@ -181,7 +181,7 @@ int mapping_parse_str(struct mapping_entry *me, const char *str, struct list *no char *endptr; last = strtoul(last_str, &endptr, 10); if (endptr != last_str + strlen(last_str)) { - warn("Failed to parse data range"); + warning("Failed to parse data range"); goto invalid_format; } } diff --git a/lib/memory.c b/lib/memory.c index c7a2b265b..88e87567b 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -71,8 +71,8 @@ int memory_init(int hugepages) debug(LOG_MEM | 2, "Increased number of reserved hugepages from %d to %d", pagecnt, hugepages); } else { - warn("Failed to reserved hugepages. Please re-run as super-user or reserve manually via:"); - warn(" $ echo %d > /proc/sys/vm/nr_hugepages", hugepages); + warning("Failed to reserved hugepages. Please re-run as super-user or reserve manually via:"); + warning(" $ echo %d > /proc/sys/vm/nr_hugepages", hugepages); return -1; } @@ -92,9 +92,9 @@ int memory_init(int hugepages) if (l.rlim_cur < lock) { if (l.rlim_max < lock) { if (getuid() != 0) { - warn("Failed to in increase ressource limit of locked memory from %lu to %zu bytes", l.rlim_cur, lock); - warn("Please re-run as super-user or raise manually via:"); - warn(" $ ulimit -Hl %zu", lock); + warning("Failed to in increase ressource limit of locked memory from %lu to %zu bytes", l.rlim_cur, lock); + warning("Please re-run as super-user or raise manually via:"); + warning(" $ ulimit -Hl %zu", lock); return -1; } @@ -125,13 +125,13 @@ void * memory_alloc_aligned(struct memory_type *m, size_t len, size_t alignment) struct memory_allocation *ma = m->alloc(m, len, alignment); if (ma == NULL) { - warn("memory_alloc_aligned: allocating memory for memory_allocation failed for memory type %s. Reason: %s", m->name, strerror(errno) ); + warning("memory_alloc_aligned: allocating memory for memory_allocation failed for memory type %s. Reason: %s", m->name, strerror(errno) ); return NULL; } ret = hash_table_insert(&allocations, ma->address, ma); if (ret) { - warn("memory_alloc_aligned: Inserting into hash table failed!"); + warning("memory_alloc_aligned: Inserting into hash table failed!"); return NULL; } diff --git a/lib/memory/hugepage.c b/lib/memory/hugepage.c index 89254c1cc..7af15e99d 100644 --- a/lib/memory/hugepage.c +++ b/lib/memory/hugepage.c @@ -102,7 +102,7 @@ retry: if (use_huge) { ma->address = mmap(NULL, ma->length, PROT_READ | PROT_WRITE, flags, fd, 0); if (ma->address == MAP_FAILED) { if (use_huge) { - warn("Failed to map hugepages, try with normal pages instead"); + warning("Failed to map hugepages, try with normal pages instead"); use_huge = false; goto retry; } diff --git a/lib/node.c b/lib/node.c index ff7dfe140..568542a3c 100644 --- a/lib/node.c +++ b/lib/node.c @@ -259,7 +259,7 @@ int node_parse(struct node *n, json_t *json, const char *name) } } else { - warn("No signal definition found for node %s. Using the default config of %d floating point signals.", node_name(n), DEFAULT_SAMPLE_LENGTH); + warning("No signal definition found for node %s. Using the default config of %d floating point signals.", node_name(n), DEFAULT_SAMPLE_LENGTH); signal_list_generate(&n->signals, DEFAULT_SAMPLE_LENGTH, SIGNAL_TYPE_FLOAT); } diff --git a/lib/nodes/comedi.c b/lib/nodes/comedi.c index 9a2ec568a..b15de33e8 100644 --- a/lib/nodes/comedi.c +++ b/lib/nodes/comedi.c @@ -550,7 +550,7 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r return 0; } else if (ret == 0) { - warn("select timeout, no samples available"); + warning("select timeout, no samples available"); return 0; } else { @@ -597,7 +597,7 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r smps[i]->data[si].f = comedi_to_phys(raw, d->chanspecs[si].range, d->chanspecs[si].maxdata); if (isnan(smps[i]->data[si].f)) - warn("Input: channel %d clipped", CR_CHAN(d->chanlist[si])); + warning("Input: channel %d clipped", CR_CHAN(d->chanlist[si])); } } @@ -675,8 +675,8 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r if ((c->bufpos + bytes_available) >= d->buffer_size) { /* Let comedi do the wraparound, only consume until end of buffer */ villas_sample_count = (d->buffer_size - c->bufpos) / villas_sample_size; - warn("Reducing consumption from %d to %ld bytes", ret, bytes_available); - warn("Only consume %ld villas samples b/c of buffer wraparound", villas_sample_count); + warning("Reducing consumption from %d to %ld bytes", ret, bytes_available); + warning("Only consume %ld villas samples b/c of buffer wraparound", villas_sample_count); } #endif @@ -685,7 +685,7 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r #if 0 if (bytes_available != 0 && bytes_available < villas_sample_size) { - warn("Cannot consume samples, only %d bytes available, throw away", ret); + warning("Cannot consume samples, only %d bytes available, throw away", ret); ret = comedi_mark_buffer_read(c->dev, d->subdevice, bytes_available); if (ret != bytes_available) @@ -700,11 +700,11 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r ret = comedi_mark_buffer_read(c->dev, d->subdevice, samples_total_bytes); if (ret == 0) { - warn("Marking read buffer (%ld bytes) not working, try again later", samples_total_bytes); + warning("Marking read buffer (%ld bytes) not working, try again later", samples_total_bytes); return 0; } else if (ret != samples_total_bytes) { - warn("Can only mark %d bytes as read, reducing samples", ret); + warning("Can only mark %d bytes as read, reducing samples", ret); return 0; } else @@ -746,7 +746,7 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r c->bufpos += d->sample_size; if (c->bufpos >= d->buffer_size) { - warn("read buffer wraparound"); + warning("read buffer wraparound"); // c->bufpos = 0; } } @@ -764,7 +764,7 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r ret = c->bufpos; } - warn("change bufpos: %ld to %d", c->bufpos, ret); + warning("change bufpos: %ld to %d", c->bufpos, ret); c->bufpos = ret; #if 0 @@ -786,13 +786,13 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r if (ret < 0) error("Failed to get read buffer offset"); - warn("change bufpos1: %ld to %d", c->bufpos, ret); + warning("change bufpos1: %ld to %d", c->bufpos, ret); c->bufpos = ret; } else { -// warn("change bufpos2: %ld to %ld", c->bufpos, c->); +// warning("change bufpos2: %ld to %ld", c->bufpos, c->); // c->bufpos += bytes_consumed; - warn("keep bufpos=%ld", c->bufpos); + warning("keep bufpos=%ld", c->bufpos); } // c->bufpos = 0; @@ -815,7 +815,7 @@ int comedi_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned * struct comedi_direction *d = &c->out; if (!d->enabled) { - warn("Attempting to write, but output is not enabled"); + warning("Attempting to write, but output is not enabled"); return 0; } @@ -849,7 +849,7 @@ int comedi_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned * const size_t villas_samples_in_buffer = raw_samples_in_buffer / d->chanlist_len; if (villas_samples_in_buffer == buffer_capacity_villas) { - warn("Comedi buffer is full"); + warning("Comedi buffer is full"); return 0; } else { @@ -923,7 +923,7 @@ int comedi_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned * } if (villas_samples_written == 0) { - warn("Nothing done"); + warning("Nothing done"); } d->counter += villas_samples_written; diff --git a/lib/nodes/file.c b/lib/nodes/file.c index ce1f83b5c..390fbf289 100644 --- a/lib/nodes/file.c +++ b/lib/nodes/file.c @@ -278,7 +278,7 @@ int file_start(struct node *n) struct sample *smps[] = { &s }; if (io_eof(&f->io)) { - warn("Empty file"); + warning("Empty file"); } else { ret = io_scan(&f->io, smps, 1); @@ -287,7 +287,7 @@ int file_start(struct node *n) f->offset = file_calc_offset(&f->first, &f->epoch, f->epoch_mode); } else - warn("Failed to read first timestamp of node %s", node_name(n)); + warning("Failed to read first timestamp of node %s", node_name(n)); } } @@ -365,7 +365,7 @@ retry: ret = io_scan(&f->io, smps, cnt); } } else - warn("Failed to read messages from node %s: reason=%d", node_name(n), ret); + warning("Failed to read messages from node %s: reason=%d", node_name(n), ret); return 0; } @@ -390,7 +390,7 @@ retry: ret = io_scan(&f->io, smps, cnt); if (steps == 0) serror("Failed to wait for timer"); else if (steps != 1) - warn("Missed steps: %" PRIu64, steps - 1); + warning("Missed steps: %" PRIu64, steps - 1); return cnt; } diff --git a/lib/nodes/iec61850_sv.c b/lib/nodes/iec61850_sv.c index 9cb3d5cfe..9d495730e 100644 --- a/lib/nodes/iec61850_sv.c +++ b/lib/nodes/iec61850_sv.c @@ -51,7 +51,7 @@ static void iec61850_sv_listener(SVSubscriber subscriber, void *ctx, SVSubscribe sz = SVSubscriber_ASDU_getDataSize(asdu); if (sz < i->in.total_size) { - warn("Received truncated ASDU: size=%d, expected=%d", SVSubscriber_ASDU_getDataSize(asdu), i->in.total_size); + warning("Received truncated ASDU: size=%d, expected=%d", SVSubscriber_ASDU_getDataSize(asdu), i->in.total_size); return; } @@ -67,7 +67,7 @@ static void iec61850_sv_listener(SVSubscriber subscriber, void *ctx, SVSubscribe smp = sample_alloc(&i->in.pool); if (!smp) { - warn("Pool underrun in subscriber of %s", node_name(n)); + warning("Pool underrun in subscriber of %s", node_name(n)); return; } diff --git a/lib/nodes/infiniband.c b/lib/nodes/infiniband.c index 4b935c4c8..6331e5266 100644 --- a/lib/nodes/infiniband.c +++ b/lib/nodes/infiniband.c @@ -359,7 +359,7 @@ int ib_check(struct node *n) int max_recv_pow = (int) pow(2, ceil(log2(ib->qp_init.cap.max_recv_wr))); if (ib->qp_init.cap.max_send_wr != max_send_pow) { - warn("Max nr. of send WRs (%i) is not a power of 2! It will be changed to a power of 2: %i", + warning("Max nr. of send WRs (%i) is not a power of 2! It will be changed to a power of 2: %i", ib->qp_init.cap.max_send_wr, max_send_pow); // Change it now, because otherwise errors are possible in ib_start(). @@ -367,7 +367,7 @@ int ib_check(struct node *n) } if (ib->qp_init.cap.max_recv_wr != max_recv_pow) { - warn("Max nr. of recv WRs (%i) is not a power of 2! It will be changed to a power of 2: %i", + warning("Max nr. of recv WRs (%i) is not a power of 2! It will be changed to a power of 2: %i", ib->qp_init.cap.max_recv_wr, max_recv_pow); // Change it now, because otherwise errors are possible in ib_start(). @@ -376,10 +376,10 @@ int ib_check(struct node *n) // Check maximum size of max_recv_wr and max_send_wr if (ib->qp_init.cap.max_send_wr > 8192) - warn("Max number of send WRs (%i) is bigger than send queue!", ib->qp_init.cap.max_send_wr); + warning("Max number of send WRs (%i) is bigger than send queue!", ib->qp_init.cap.max_send_wr); if (ib->qp_init.cap.max_recv_wr > 8192) - warn("Max number of receive WRs (%i) is bigger than send queue!", ib->qp_init.cap.max_recv_wr); + warning("Max number of receive WRs (%i) is bigger than send queue!", ib->qp_init.cap.max_recv_wr); // Set periodic signaling // This is done here, so that it uses the checked max_send_wr value @@ -388,7 +388,7 @@ int ib_check(struct node *n) // Warn user if he changed the default inline value if (ib->qp_init.cap.max_inline_data != 0) - warn("You changed the default value of max_inline_data. This might influence the maximum number " + warning("You changed the default value of max_inline_data. This might influence the maximum number " "of outstanding Work Requests in the Queue Pair and can be a reason for the Queue Pair creation to fail"); info("Finished check of node %s", node_name(n)); @@ -472,7 +472,7 @@ static void ib_continue_as_listen(struct node *n, struct rdma_cm_event *event) int ret; if (ib->conn.use_fallback) - warn("Trying to continue as listening node"); + warning("Trying to continue as listening node"); else error("Cannot establish a connection with remote host! If you want that %s tries to " "continue as listening node in such cases, set use_fallback = true in the configuration", @@ -522,7 +522,7 @@ void * ib_rdma_cm_event_thread(void *n) break; case RDMA_CM_EVENT_ADDR_ERROR: - warn("Address resolution (rdma_resolve_addr) failed!"); + warning("Address resolution (rdma_resolve_addr) failed!"); ib_continue_as_listen(n, event); @@ -533,14 +533,14 @@ void * ib_rdma_cm_event_thread(void *n) break; case RDMA_CM_EVENT_ROUTE_ERROR: - warn("Route resolution (rdma_resovle_route) failed!"); + warning("Route resolution (rdma_resovle_route) failed!"); ib_continue_as_listen(n, event); break; case RDMA_CM_EVENT_UNREACHABLE: - warn("Remote server unreachable!"); + warning("Remote server unreachable!"); ib_continue_as_listen(n, event); break; @@ -559,14 +559,14 @@ void * ib_rdma_cm_event_thread(void *n) break; case RDMA_CM_EVENT_CONNECT_ERROR: - warn("An error has occurred trying to establish a connection!"); + warning("An error has occurred trying to establish a connection!"); ib_continue_as_listen(n, event); break; case RDMA_CM_EVENT_REJECTED: - warn("Connection request or response was rejected by the remote end point!"); + warning("Connection request or response was rejected by the remote end point!"); ib_continue_as_listen(n, event); @@ -844,7 +844,7 @@ int ib_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *relea if (wc[j].status == IBV_WC_WR_FLUSH_ERR) debug(LOG_IB | 5, "Received IBV_WC_WR_FLUSH_ERR (ib_read). Ignore it."); else if (wc[j].status != IBV_WC_SUCCESS) - warn("Work Completion status was not IBV_WC_SUCCES in node %s: %i", + warning("Work Completion status was not IBV_WC_SUCCES in node %s: %i", node_name(n), wc[j].status); // 32 byte of meta data is always transferred. We should substract it. @@ -979,7 +979,7 @@ int ib_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rele for (int i = 0; i < ret; i++) { if (wc[i].status != IBV_WC_SUCCESS && wc[i].status != IBV_WC_WR_FLUSH_ERR) - warn("Work Completion status was not IBV_WC_SUCCES in node %s: %i", + warning("Work Completion status was not IBV_WC_SUCCES in node %s: %i", node_name(n), wc[i].status); smps[*release] = (struct sample *) (wc[i].wr_id); diff --git a/lib/nodes/influxdb.c b/lib/nodes/influxdb.c index 51dfb1e2c..7f80077aa 100644 --- a/lib/nodes/influxdb.c +++ b/lib/nodes/influxdb.c @@ -89,7 +89,7 @@ int influxdb_open(struct node *n) ret = connect(i->sd, p->ai_addr, p->ai_addrlen); if (ret == -1) { - warn("connect"); + warning("connect"); close(i->sd); continue; } @@ -136,7 +136,7 @@ int influxdb_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned union signal_data *data = &smp->data[k]; if (sig->type == SIGNAL_TYPE_AUTO || sig->type == SIGNAL_TYPE_COMPLEX) { - warn("Unsupported signal format for node %s. Skipping", node_name(n)); + warning("Unsupported signal format for node %s. Skipping", node_name(n)); continue; } @@ -177,7 +177,7 @@ int influxdb_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned if (sentlen < 0) return -1; else if (sentlen < buflen) - warn("Partial sent"); + warning("Partial sent"); free(buf); diff --git a/lib/nodes/loopback.c b/lib/nodes/loopback.c index 59a99ba9e..6cb01d41d 100644 --- a/lib/nodes/loopback.c +++ b/lib/nodes/loopback.c @@ -119,7 +119,7 @@ int loopback_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned copied = sample_alloc_many(&l->pool, copies, cnt); if (copied < cnt) - warn("Pool underrun for node %s", node_name(n)); + warning("Pool underrun for node %s", node_name(n)); sample_copy_many(copies, smps, copied); diff --git a/lib/nodes/mqtt.c b/lib/nodes/mqtt.c index c49a1a95d..ff0d31fd6 100644 --- a/lib/nodes/mqtt.c +++ b/lib/nodes/mqtt.c @@ -38,7 +38,7 @@ static void mqtt_log_cb(struct mosquitto *mosq, void *userdata, int level, const break; case MOSQ_LOG_WARNING: - warn("MQTT: %s", str); + warning("MQTT: %s", str); break; case MOSQ_LOG_ERR: @@ -63,10 +63,10 @@ static void mqtt_connect_cb(struct mosquitto *mosq, void *userdata, int result) if (m->subscribe) { ret = mosquitto_subscribe(m->client, NULL, m->subscribe, m->qos); if (ret) - warn("MQTT: failed to subscribe to topic '%s' for node %s", m->subscribe, node_name(n)); + warning("MQTT: failed to subscribe to topic '%s' for node %s", m->subscribe, node_name(n)); } else - warn("MQTT: no subscribe for node %s as no subscribe topic is given", node_name(n)); + warning("MQTT: no subscribe for node %s as no subscribe topic is given", node_name(n)); } static void mqtt_disconnect_cb(struct mosquitto *mosq, void *userdata, int result) @@ -88,14 +88,14 @@ static void mqtt_message_cb(struct mosquitto *mosq, void *userdata, const struct ret = sample_alloc_many(&m->pool, smps, n->in.vectorize); if (ret<0) { - warn("Pool underrun in subscriber of %s", node_name(n)); + warning("Pool underrun in subscriber of %s", node_name(n)); return; } ret = io_sscan(&m->io, msg->payload, msg->payloadlen, NULL, smps, n->in.vectorize); if (ret < 0) { - warn("MQTT: Node %s received an invalid message", node_name(n)); - warn(" Payload: %s", (char *) msg->payload); + warning("MQTT: Node %s received an invalid message", node_name(n)); + warning(" Payload: %s", (char *) msg->payload); return; } if (ret == 0) { @@ -399,12 +399,12 @@ int mqtt_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re ret = mosquitto_publish(m->client, NULL /* mid */, m->publish, wbytes, data, m->qos, m->retain); if (ret != MOSQ_ERR_SUCCESS) { - warn("MQTT: publish failed for node %s: %s", node_name(n), mosquitto_strerror(ret)); + warning("MQTT: publish failed for node %s: %s", node_name(n), mosquitto_strerror(ret)); return -abs(ret); } } else { - warn("MQTT: no publish for node %s possible because no publish topic is given", node_name(n)); + warning("MQTT: no publish for node %s possible because no publish topic is given", node_name(n)); } return cnt; diff --git a/lib/nodes/nanomsg.c b/lib/nodes/nanomsg.c index f3acb72d6..b47c07762 100644 --- a/lib/nodes/nanomsg.c +++ b/lib/nodes/nanomsg.c @@ -163,13 +163,13 @@ int nanomsg_start(struct node *n) ret = m->in.socket = nn_socket(AF_SP, NN_SUB); if (ret < 0) { - warn("Failed to create nanomsg socket: node=%s, error=%s", node_name(n), nn_strerror(errno)); + warning("Failed to create nanomsg socket: node=%s, error=%s", node_name(n), nn_strerror(errno)); return ret; } ret = m->out.socket = nn_socket(AF_SP, NN_PUB); if (ret < 0) { - warn("Failed to create nanomsg socket: node=%s, error=%s", node_name(n), nn_strerror(errno)); + warning("Failed to create nanomsg socket: node=%s, error=%s", node_name(n), nn_strerror(errno)); return ret; } @@ -184,7 +184,7 @@ int nanomsg_start(struct node *n) ret = nn_bind(m->out.socket, ep); if (ret < 0) { - warn("Failed to connect nanomsg socket: node=%s, endpoint=%s, error=%s", node_name(n), ep, nn_strerror(errno)); + warning("Failed to connect nanomsg socket: node=%s, endpoint=%s, error=%s", node_name(n), ep, nn_strerror(errno)); return ret; } } @@ -195,7 +195,7 @@ int nanomsg_start(struct node *n) ret = nn_connect(m->in.socket, ep); if (ret < 0) { - warn("Failed to connect nanomsg socket: node=%s, endpoint=%s, error=%s", node_name(n), ep, nn_strerror(errno)); + warning("Failed to connect nanomsg socket: node=%s, endpoint=%s, error=%s", node_name(n), ep, nn_strerror(errno)); return ret; } } diff --git a/lib/nodes/ngsi.c b/lib/nodes/ngsi.c index 9a1186fb7..f9ae90340 100644 --- a/lib/nodes/ngsi.c +++ b/lib/nodes/ngsi.c @@ -268,14 +268,14 @@ static int ngsi_parse_context_response(json_t *response, int *code, char **reaso "reasonPhrase", reason ); if (ret) { - warn("Failed to find NGSI response code"); + warning("Failed to find NGSI response code"); return ret; } *code = atoi(codestr); if (*code != 200) - warn("NGSI response: %s %s", codestr, *reason); + warning("NGSI response: %s %s", codestr, *reason); return ret; } @@ -321,7 +321,7 @@ static int ngsi_request(CURL *handle, const char *endpoint, const char *operatio pthread_setcancelstate(old, NULL); if (ret) { - warn("HTTP request failed: %s", curl_easy_strerror(ret)); + warning("HTTP request failed: %s", curl_easy_strerror(ret)); goto out; } @@ -332,7 +332,7 @@ static int ngsi_request(CURL *handle, const char *endpoint, const char *operatio *response = json_loads(chunk.data, 0, &err); if (!*response) - warn("Received invalid JSON: %s in %s:%u:%u\n%s", err.text, err.source, err.line, err.column, chunk.data); + warning("Received invalid JSON: %s in %s:%u:%u\n%s", err.text, err.source, err.line, err.column, chunk.data); out: free(post); free(chunk.data); @@ -489,7 +489,7 @@ int ngsi_start(struct node *n) /* Create task */ if (i->timeout > 1 / i->rate) - warn("Timeout is to large for given rate: %f", i->rate); + warning("Timeout is to large for given rate: %f", i->rate); ret = task_init(&i->task, i->rate, CLOCK_MONOTONIC); if (ret) diff --git a/lib/nodes/opal.c b/lib/nodes/opal.c index e4b49d1b7..fdf62bed9 100644 --- a/lib/nodes/opal.c +++ b/lib/nodes/opal.c @@ -237,7 +237,7 @@ int opal_read(struct node *n, struct pool *pool, unsigned cnt) /* Get the size of the data being sent by the unblocking SendID */ OpalGetAsyncSendIconDataLength(&len, o->send_id); if (len > sizeof(data)) { - warn("Ignoring the last %u of %u values for OPAL node %s (send_id=%u).", + warning("Ignoring the last %u of %u values for OPAL node %s (send_id=%u).", len / sizeof(double) - MSG_VALUES, len / sizeof(double), node_name(n), o->send_id); len = sizeof(data); @@ -293,7 +293,7 @@ int opal_write(struct node *n, struct pool *pool, unsigned cnt) /* Get the number of signals to send back to the model */ OpalGetAsyncRecvIconDataLength(&len, o->recv_id); if (len > sizeof(data)) - warn("Node %s is expecting more signals (%u) than values in message (%u)", node_name(n), len / sizeof(double), m->length); + warning("Node %s is expecting more signals (%u) than values in message (%u)", node_name(n), len / sizeof(double), m->length); for (int i = 0; i < m->length; i++) data[i] = (double) m->data[i].f; /* OPAL expects double precission */ diff --git a/lib/nodes/shmem.c b/lib/nodes/shmem.c index f4e0aaf7b..4fe762fa6 100644 --- a/lib/nodes/shmem.c +++ b/lib/nodes/shmem.c @@ -135,7 +135,7 @@ int shmem_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re /* This can only really mean that the other process has exited, so close * the interface to make sure the shared memory object is unlinked */ shmem_int_close(&shm->intf); - warn("Shared memory segment has been closed for node: %s", node_name(n)); + warning("Shared memory segment has been closed for node: %s", node_name(n)); return recv; } @@ -153,15 +153,15 @@ int shmem_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r avail = sample_alloc_many(&shm->intf.write.shared->pool, shared_smps, cnt); if (avail != cnt) - warn("Pool underrun for shmem node %s", shm->out_name); + warning("Pool underrun for shmem node %s", shm->out_name); copied = sample_copy_many(shared_smps, smps, avail); if (copied < avail) - warn("Outgoing pool underrun for node %s", node_name(n)); + warning("Outgoing pool underrun for node %s", node_name(n)); pushed = shmem_int_write(&shm->intf, shared_smps, copied); if (pushed != avail) - warn("Outgoing queue overrun for node %s", node_name(n)); + warning("Outgoing queue overrun for node %s", node_name(n)); return pushed; } diff --git a/lib/nodes/signal_generator.c b/lib/nodes/signal_generator.c index adf444e1d..28ae75438 100644 --- a/lib/nodes/signal_generator.c +++ b/lib/nodes/signal_generator.c @@ -184,7 +184,7 @@ int signal_generator_stop(struct node *n) } if (s->missed_steps > 0 && s->monitor_missed) - warn("Node %s missed a total of %d steps.", node_name(n), s->missed_steps); + warning("Node %s missed a total of %d steps.", node_name(n), s->missed_steps); free(s->last); @@ -206,7 +206,7 @@ int signal_generator_read(struct node *n, struct sample *smps[], unsigned cnt, u /* Block until 1/p->rate seconds elapsed */ steps = task_wait(&s->task); if (steps > 1 && s->monitor_missed) { - warn("Missed steps: %u", steps-1); + warning("Missed steps: %u", steps-1); s->missed_steps += steps-1; } diff --git a/lib/nodes/socket.c b/lib/nodes/socket.c index bfb87d7c0..fe9cd0587 100644 --- a/lib/nodes/socket.c +++ b/lib/nodes/socket.c @@ -447,7 +447,7 @@ int socket_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r if (s->verify_source && socket_compare_addr(&src.sa, &s->remote.sa) != 0) { char *buf = socket_print_addr((struct sockaddr *) &src); - warn("Received packet from unauthorized source: %s", buf); + warning("Received packet from unauthorized source: %s", buf); free(buf); return 0; @@ -456,7 +456,7 @@ int socket_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r ret = io_sscan(&s->io, ptr, bytes, &rbytes, smps, cnt); if (ret < 0 || bytes != rbytes) - warn("Received invalid packet from node: %s ret=%d, bytes=%zu, rbytes=%zu", node_name(n), ret, bytes, rbytes); + warning("Received invalid packet from node: %s ret=%d, bytes=%zu, rbytes=%zu", node_name(n), ret, bytes, rbytes); return ret; } @@ -514,17 +514,17 @@ retry2: bytes = sendto(s->sd, s->out.buf, wbytes, 0, (struct sockaddr *) &s->rem if (bytes < 0) { if ((errno == EPERM) || (errno == ENOENT && s->layer == SOCKET_LAYER_UNIX)) - warn("Failed send to node %s: %s", node_name(n), strerror(errno)); + warning("Failed send to node %s: %s", node_name(n), strerror(errno)); else if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { - warn("socket: send would block"); + warning("socket: send would block"); goto retry2; } else - warn("Failed sendto() to node %s", node_name(n)); + warning("Failed sendto() to node %s", node_name(n)); } if (bytes != wbytes) - warn("Partial sendto() to node %s", node_name(n)); + warning("Partial send to node %s", node_name(n)); return cnt; } diff --git a/lib/nodes/test_rtt.c b/lib/nodes/test_rtt.c index 8514766dd..dc5455591 100644 --- a/lib/nodes/test_rtt.c +++ b/lib/nodes/test_rtt.c @@ -325,7 +325,7 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned /* Wait */ steps = task_wait(&t->task); if (steps > 1) - warn("Skipped %ld steps", (long) (steps - 1)); + warning("Skipped %ld steps", (long) (steps - 1)); struct timespec now = time_now(); @@ -334,7 +334,7 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned values = c->values; if (smps[i]->capacity < values) { values = smps[i]->capacity; - warn("Sample capacity too small. Limiting to %d values.", values); + warning("Sample capacity too small. Limiting to %d values.", values); } smps[i]->length = values; @@ -370,7 +370,7 @@ int test_rtt_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned int i; for (i = 0; i < cnt; i++) { if (smps[i]->length != c->values) { - warn("Discarding invalid sample due to mismatching length: expecting=%d, has=%d", c->values, smps[i]->length); + warning("Discarding invalid sample due to mismatching length: expecting=%d, has=%d", c->values, smps[i]->length); continue; } diff --git a/lib/nodes/websocket.c b/lib/nodes/websocket.c index 218a05e48..1b6701a70 100644 --- a/lib/nodes/websocket.c +++ b/lib/nodes/websocket.c @@ -157,7 +157,7 @@ static int websocket_connection_write(struct websocket_connection *c, struct sam pushed = queue_push_many(&c->queue, (void **) smps, cnt); if (pushed < cnt) - warn("Queue overrun in WebSocket connection: %s", websocket_connection_name(c)); + warning("Queue overrun in WebSocket connection: %s", websocket_connection_name(c)); sample_incref_many(smps, pushed); @@ -209,14 +209,14 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi lws_hdr_copy(wsi, uri, sizeof(uri), WSI_TOKEN_GET_URI); /* The path component of the*/ if (strlen(uri) <= 0) { websocket_connection_close(c, wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, "Invalid URL"); - warn("Failed to get request URI"); + warning("Failed to get request URI"); return -1; } node = strtok(uri, "/."); if (!node) { websocket_connection_close(c, wsi, LWS_CLOSE_STATUS_POLICY_VIOLATION, "Unknown node"); - warn("Failed to tokenize request URI"); + warning("Failed to tokenize request URI"); return -1; } @@ -228,14 +228,14 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi c->node = list_lookup(&p.node.instances, node); if (!c->node) { websocket_connection_close(c, wsi, LWS_CLOSE_STATUS_POLICY_VIOLATION, "Unknown node"); - warn("Failed to find node: node=%s", node); + warning("Failed to find node: node=%s", node); return -1; } c->format = format_type_lookup(format); if (!c->format) { websocket_connection_close(c, wsi, LWS_CLOSE_STATUS_POLICY_VIOLATION, "Unknown format"); - warn("Failed to find format: format=%s", format); + warning("Failed to find format: format=%s", format); return -1; } } @@ -243,7 +243,7 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi ret = websocket_connection_init(c); if (ret) { websocket_connection_close(c, wsi, LWS_CLOSE_STATUS_POLICY_VIOLATION, "Internal error"); - warn("Failed to intialize websocket connection: reason=%d", ret); + warning("Failed to intialize websocket connection: reason=%d", ret); return -1; } @@ -255,7 +255,7 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi case LWS_CALLBACK_CLIENT_CONNECTION_ERROR: c->state = WEBSOCKET_CONNECTION_STATE_ERROR; - warn("Failed to establish WebSocket connection: %s, reason=%s", websocket_connection_name(c), in ? (char *) in : "unkown"); + warning("Failed to establish WebSocket connection: %s, reason=%s", websocket_connection_name(c), in ? (char *) in : "unkown"); return -1; @@ -323,17 +323,17 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi struct websocket *w = (struct websocket *) n->_vd; struct sample **smps = alloca(cnt * sizeof(struct sample *)); if (!smps) { - warn("Failed to allocate memory for connection: %s", websocket_connection_name(c)); + warning("Failed to allocate memory for connection: %s", websocket_connection_name(c)); break; } avail = sample_alloc_many(&w->pool, smps, cnt); if (avail < cnt) - warn("Pool underrun for connection: %s", websocket_connection_name(c)); + warning("Pool underrun for connection: %s", websocket_connection_name(c)); recvd = io_sscan(&c->io, c->buffers.recv.buf, c->buffers.recv.len, NULL, smps, avail); if (recvd < 0) { - warn("Failed to parse sample data received on connection: %s", websocket_connection_name(c)); + warning("Failed to parse sample data received on connection: %s", websocket_connection_name(c)); break; } @@ -347,7 +347,7 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi enqueued = queue_signalled_push_many(&w->queue, (void **) smps, recvd); if (enqueued < recvd) - warn("Queue overrun in connection: %s", websocket_connection_name(c)); + warning("Queue overrun in connection: %s", websocket_connection_name(c)); /* Release unused samples back to pool */ if (enqueued < avail) @@ -512,7 +512,7 @@ int websocket_write(struct node *n, struct sample *smps[], unsigned cnt, unsigne /* Make copies of all samples */ avail = sample_alloc_many(&w->pool, cpys, cnt); if (avail < cnt) - warn("Pool underrun for node %s: avail=%u", node_name(n), avail); + warning("Pool underrun for node %s: avail=%u", node_name(n), avail); sample_copy_many(cpys, smps, avail); diff --git a/lib/path.c b/lib/path.c index 9cd6a8193..1085954c2 100644 --- a/lib/path.c +++ b/lib/path.c @@ -87,7 +87,7 @@ static void path_source_read(struct path_source *ps, struct path *p, int i) /* Fill smps[] free sample blocks from the pool */ allocated = sample_alloc_many(&ps->pool, read_smps, cnt); if (allocated != cnt) - warn("Pool underrun for path source %s", node_name(ps->node)); + warning("Pool underrun for path source %s", node_name(ps->node)); /* Read ready samples and store them to blocks pointed by smps[] */ release = allocated; @@ -98,7 +98,7 @@ static void path_source_read(struct path_source *ps, struct path *p, int i) else if (recv < 0) error("Failed to read samples from node %s", node_name(ps->node)); else if (recv < allocated) - warn("Partial read for path %s: read=%u, expected=%u", path_name(p), recv, allocated); + warning("Partial read for path %s: read=%u, expected=%u", path_name(p), recv, allocated); bitset_set(&p->received, i); @@ -193,14 +193,14 @@ static void path_destination_enqueue(struct path *p, struct sample *smps[], unsi cloned = sample_clone_many(clones, smps, cnt); if (cloned < cnt) - warn("Pool underrun in path %s", path_name(p)); + warning("Pool underrun in path %s", path_name(p)); for (size_t i = 0; i < list_length(&p->destinations); i++) { struct path_destination *pd = (struct path_destination *) list_at(&p->destinations, i); enqueued = queue_push_many(&pd->queue, (void **) clones, cloned); if (enqueued != cnt) - warn("Queue overrun for path %s", path_name(p)); + warning("Queue overrun for path %s", path_name(p)); /* Increase reference counter of these samples as they are now also owned by the queue. */ sample_incref_many(clones, cloned); @@ -237,7 +237,7 @@ static void path_destination_write(struct path_destination *pd, struct path *p) if (sent < 0) error("Failed to sent %u samples to node %s", cnt, node_name(pd->node)); else if (sent < allocated) - warn("Partial write to node %s: written=%d, expected=%d", node_name(pd->node), sent, allocated); + warning("Partial write to node %s: written=%d, expected=%d", node_name(pd->node), sent, allocated); released = sample_decref_many(smps, release); @@ -450,7 +450,7 @@ int path_init2(struct path *p) if (me->type == MAPPING_TYPE_DATA) { sig = (struct signal *) list_at_safe(&me->node->signals, me->data.offset + j); if (!sig) { - warn("Failed to create signal description for path %s", path_name(p)); + warning("Failed to create signal description for path %s", path_name(p)); continue; } @@ -685,7 +685,7 @@ int path_check(struct path *p) if (!IS_POW2(p->queuelen)) { p->queuelen = LOG2_CEIL(p->queuelen); - warn("Queue length should always be a power of 2. Adjusting to %d", p->queuelen); + warning("Queue length should always be a power of 2. Adjusting to %d", p->queuelen); } p->state = STATE_CHECKED; diff --git a/lib/queue.c b/lib/queue.c index 3f69079c9..37a5eb2ab 100644 --- a/lib/queue.c +++ b/lib/queue.c @@ -44,7 +44,7 @@ int queue_init(struct queue *q, size_t size, struct memory_type *m) if (!IS_POW2(size)) { size_t old_size = size; size = LOG2_CEIL(size); - warn("A queue size was changed from %zu to %zu", old_size, size); + warning("A queue size was changed from %zu to %zu", old_size, size); } q->buffer_mask = size - 1; diff --git a/lib/web.cpp b/lib/web.cpp index 78e68522f..1344e5fd8 100644 --- a/lib/web.cpp +++ b/lib/web.cpp @@ -253,7 +253,7 @@ void Web::start() break; ctx_info.port++; - warn("WebSocket: failed to setup vhost. Trying another port: %d", ctx_info.port); + logger->warn("WebSocket: failed to setup vhost. Trying another port: {}", ctx_info.port); } if (vhost == NULL)