mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix initialization errors
This commit is contained in:
parent
e21a08e290
commit
037bfcb81e
51 changed files with 76 additions and 238 deletions
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit fc20afe09c84a6127821d448155cfea7a59467a7
|
||||
Subproject commit fe3413e12bb9eec496283551dbfad147dc8bd8ec
|
|
@ -197,10 +197,7 @@ void csv_header(struct io *io, const struct sample *smp)
|
|||
|
||||
static struct plugin p1;
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p1.name = "tsv";
|
||||
p1.name = "tsv";
|
||||
p1.description = "Tabulator-separated values";
|
||||
p1.type = PluginType::FORMAT;
|
||||
p1.format.header = csv_header;
|
||||
|
@ -215,15 +212,11 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p1);
|
||||
vlist_remove_all(&plugins, &p1);
|
||||
}
|
||||
|
||||
static struct plugin p2;
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p2.name = "csv";
|
||||
p2.description = "Comma-separated values";
|
||||
p2.type = PluginType::FORMAT;
|
||||
|
@ -239,6 +232,5 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p2);
|
||||
vlist_remove_all(&plugins, &p2);
|
||||
}
|
||||
|
|
|
@ -60,9 +60,6 @@ int iotagent_ul_sprint(struct io *io, char *buf, size_t len, size_t *wbytes, str
|
|||
static struct plugin p;
|
||||
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "iotagent_ul";
|
||||
p.description = "FIWARE IotAgent UltraLight format";
|
||||
p.type = PluginType::FORMAT;
|
||||
|
@ -73,6 +70,5 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -362,9 +362,6 @@ skip: json = json_loadf(f, JSON_DISABLE_EOF_CHECK, &err);
|
|||
static struct plugin p;
|
||||
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "json";
|
||||
p.description = "Javascript Object Notation";
|
||||
p.type = PluginType::FORMAT;
|
||||
|
@ -380,6 +377,5 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -326,9 +326,6 @@ skip: json = json_loadf(f, JSON_DISABLE_EOF_CHECK, &err);
|
|||
static struct plugin p;
|
||||
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "json.reserve";
|
||||
p.description = "RESERVE JSON format";
|
||||
p.type = PluginType::FORMAT;
|
||||
|
@ -342,6 +339,5 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -227,9 +227,6 @@ int protobuf_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, s
|
|||
static struct plugin p;
|
||||
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "protobuf";
|
||||
p.description = "Google Protobuf";
|
||||
p.type = PluginType::FORMAT;
|
||||
|
@ -242,7 +239,6 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
||||
|
|
|
@ -414,9 +414,6 @@ int raw_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, struct
|
|||
#define REGISTER_FORMAT_RAW(i, n, d, f) \
|
||||
static struct plugin i; \
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() { \
|
||||
if (plugins.state == State::DESTROYED) \
|
||||
vlist_init(&plugins); \
|
||||
\
|
||||
i.name = n; \
|
||||
i.description = d; \
|
||||
i.type = PluginType::FORMAT; \
|
||||
|
@ -429,8 +426,7 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() { \
|
|||
} \
|
||||
\
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() { \
|
||||
if (plugins.state != State::DESTROYED) \
|
||||
vlist_remove_all(&plugins, &i); \
|
||||
vlist_remove_all(&plugins, &i); \
|
||||
}
|
||||
/* Feel free to add additional format identifiers here to suit your needs */
|
||||
REGISTER_FORMAT_RAW(p_8, "raw.8", "Raw 8 bit", RAW_BITS_8)
|
||||
|
|
|
@ -121,9 +121,6 @@ int villas_binary_sscan(struct io *io, const char *buf, size_t len, size_t *rbyt
|
|||
static struct plugin p1;
|
||||
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p1.name = "villas.binary";
|
||||
p1.description = "VILLAS binary network format";
|
||||
p1.type = PluginType::FORMAT;
|
||||
|
@ -137,17 +134,13 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p1);
|
||||
vlist_remove_all(&plugins, &p1);
|
||||
}
|
||||
/** The WebSocket node-type usually uses little endian byte order intead of network byte order */
|
||||
static struct plugin p2;
|
||||
|
||||
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p2.name = "villas.web";
|
||||
p2.description = "VILLAS binary network format for WebSockets";
|
||||
p2.type = PluginType::FORMAT;
|
||||
|
@ -161,6 +154,5 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p2);
|
||||
vlist_remove_all(&plugins, &p2);
|
||||
}
|
||||
|
|
|
@ -225,10 +225,7 @@ void villas_human_header(struct io *io, const struct sample *smp)
|
|||
|
||||
static struct plugin p;
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "villas.human";
|
||||
p.name = "villas.human";
|
||||
p.description = "VILLAS human readable format";
|
||||
p.type = PluginType::FORMAT;
|
||||
p.format.header = villas_human_header;
|
||||
|
@ -243,6 +240,5 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -50,8 +50,6 @@ Hook::Hook(struct vpath *p, struct node *n, int fl, int prio, bool en) :
|
|||
|
||||
logger = logging.get("hook");
|
||||
|
||||
signals.state = State::DESTROYED;
|
||||
|
||||
ret = signal_list_init(&signals);
|
||||
if (ret)
|
||||
throw RuntimeError("Failed to initialize signal list");
|
||||
|
|
|
@ -50,8 +50,6 @@ public:
|
|||
prefix(nullptr),
|
||||
uri(nullptr)
|
||||
{
|
||||
io.state = State::DESTROYED;
|
||||
|
||||
format = format_type_lookup("villas.human");
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,6 @@ int io_init2(struct io *io, const struct format_type *fmt, const char *dt, int f
|
|||
struct vlist *signals;
|
||||
|
||||
signals = new struct vlist;
|
||||
signals->state = State::DESTROYED;
|
||||
|
||||
ret = vlist_init(signals);
|
||||
if (ret)
|
||||
|
@ -152,15 +151,11 @@ int io_destroy(struct io *io)
|
|||
return ret;
|
||||
}
|
||||
|
||||
io->state = State::DESTROYED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int io_check(struct io *io)
|
||||
{
|
||||
assert(io->state != State::DESTROYED);
|
||||
|
||||
io->state = State::CHECKED;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -56,9 +56,6 @@ int node_direction_init(struct node_direction *nd, enum NodeDir dir, struct node
|
|||
nd->vectorize = 1;
|
||||
nd->builtin = 1;
|
||||
|
||||
nd->hooks.state = State::DESTROYED;
|
||||
nd->signals.state = State::DESTROYED;
|
||||
|
||||
#ifdef WITH_HOOKS
|
||||
ret = hook_list_init(&nd->hooks);
|
||||
if (ret)
|
||||
|
|
|
@ -33,7 +33,7 @@ int node_type_start(struct node_type *vt, villas::node::SuperNode *sn)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (vt->state != State::DESTROYED)
|
||||
if (vt->state == State::STARTED)
|
||||
return 0;
|
||||
|
||||
info("Initializing " CLR_YEL("%s") " node type which is used by %zu nodes", node_type_name(vt), vlist_length(&vt->instances));
|
||||
|
@ -56,7 +56,7 @@ int node_type_stop(struct node_type *vt)
|
|||
|
||||
ret = vt->type.stop ? vt->type.stop() : 0;
|
||||
if (ret == 0)
|
||||
vt->state = State::DESTROYED;
|
||||
vt->state = State::STOPPED;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -398,9 +398,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "amqp";
|
||||
p.description = "Advanced Message Queueing Protoocl (rabbitmq-c)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -422,8 +419,7 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -992,9 +992,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "comedi";
|
||||
p.description = "Comedi-compatible DAQ/ADC cards";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -1015,6 +1012,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -366,8 +366,6 @@ int ethercat_init(struct node *n)
|
|||
int ret;
|
||||
struct ethercat *w = (struct ethercat *) n->_vd;
|
||||
|
||||
w->pool.state = State::DESTROYED;
|
||||
|
||||
/* Default values */
|
||||
w->rate = 1000;
|
||||
|
||||
|
@ -447,9 +445,6 @@ int ethercat_poll_fds(struct node *n, int *fds)
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "ethercat";
|
||||
p.description = "Send and receive samples of an ethercat connection";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -475,7 +470,6 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
||||
|
|
|
@ -225,9 +225,6 @@ int example_netem_fds(struct node *n, int fds[])
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "example";
|
||||
p.description = "An example for staring new node-type implementations";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -258,6 +255,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -136,6 +136,19 @@ int exec_prepare(struct node *n)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int exec_init(struct node *n)
|
||||
{
|
||||
struct exec *e = (struct exec *) n->_vd;
|
||||
|
||||
new (&e->proc) std::unique_ptr<Popen>();
|
||||
new (&e->working_dir) std::string();
|
||||
new (&e->command) std::string();
|
||||
new (&e->arguments) Popen::arg_list();
|
||||
new (&e->environment) Popen::env_map();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exec_destroy(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
|
@ -147,6 +160,17 @@ int exec_destroy(struct node *n)
|
|||
return ret;
|
||||
}
|
||||
|
||||
using uptr = std::unique_ptr<Popen>;
|
||||
using str = std::string;
|
||||
using al = Popen::arg_list;
|
||||
using em = Popen::env_map;
|
||||
|
||||
e->proc.~uptr();
|
||||
e->working_dir.~str();
|
||||
e->command.~str();
|
||||
e->arguments.~al();
|
||||
e->environment.~em();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -242,9 +266,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "exec";
|
||||
p.description = "run subprocesses with stdin/stdout communication";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -254,6 +275,7 @@ static void register_plugin() {
|
|||
p.node.parse = exec_parse;
|
||||
p.node.print = exec_print;
|
||||
p.node.prepare = exec_prepare;
|
||||
p.node.init = exec_init;
|
||||
p.node.destroy = exec_destroy;
|
||||
p.node.start = exec_start;
|
||||
p.node.stop = exec_stop;
|
||||
|
@ -267,6 +289,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -494,9 +494,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "file";
|
||||
p.description = "support for file log / replay node type";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -520,6 +517,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -479,9 +479,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "iec61850-9-2";
|
||||
p.description = "IEC 61850-9-2 (Sampled Values)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -505,8 +502,7 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_IEC61850_SAMPLED_VALUES_SUPPORT */
|
||||
|
|
|
@ -1006,9 +1006,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "infiniband";
|
||||
p.description = "Infiniband interface (libibverbs, librdmacm)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -1033,6 +1030,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -216,9 +216,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "influxdb";
|
||||
p.description = "Write results to InfluxDB";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -238,6 +235,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -156,9 +156,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "loopback";
|
||||
p.description = "Loopback to connect multiple paths";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -180,6 +177,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -524,9 +524,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "mqtt";
|
||||
p.description = "Message Queuing Telemetry Transport (libmosquitto)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -552,6 +549,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -296,9 +296,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "nanomsg";
|
||||
p.description = "scalability protocols library (libnanomsg)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -322,6 +319,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -602,9 +602,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "ngsi";
|
||||
p.description = "OMA Next Generation Services Interface 10 (libcurl, libjansson)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -629,6 +626,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -307,9 +307,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "opal";
|
||||
p.description = "run as OPAL Asynchronous Process (libOpalAsyncApi)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -331,6 +328,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -609,9 +609,6 @@ int rtp_netem_fds(struct node *n, int fds[])
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "rtp";
|
||||
#ifdef WITH_NETEM
|
||||
p.description = "real-time transport protocol (libre, libnl3 netem support)";
|
||||
|
@ -642,6 +639,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -201,9 +201,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "shmem";
|
||||
p.description = "POSIX shared memory interface with external processes";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -224,6 +221,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -314,9 +314,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "signal";
|
||||
p.description = "Signal generator";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -341,6 +338,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -565,9 +565,6 @@ int socket_fds(struct node *n, int fds[])
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "socket";
|
||||
#ifdef WITH_NETEM
|
||||
p.description = "BSD network sockets for Ethernet / IP / UDP (libnl3, netem support)";
|
||||
|
@ -596,6 +593,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -247,9 +247,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "stats";
|
||||
p.description = "Send statistics to another node";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -273,6 +270,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -435,9 +435,6 @@ int test_rtt_poll_fds(struct node *n, int fds[])
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "test_rtt";
|
||||
p.description = "Test round-trip time with loopback";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -461,6 +458,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -643,9 +643,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "uldaq";
|
||||
p.description = "Measurement Computing DAQ devices like UL201 (libuldaq)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -668,6 +665,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ using namespace villas::utils;
|
|||
#define DEFAULT_WEBSOCKET_BUFFER_SIZE (1 << 12)
|
||||
|
||||
/* Private static storage */
|
||||
static struct vlist connections = { .state = State::DESTROYED }; /**< List of active libwebsocket connections which receive samples from all nodes (catch all) */
|
||||
static struct vlist connections; /**< List of active libwebsocket connections which receive samples from all nodes (catch all) */
|
||||
|
||||
static villas::node::Web *web;
|
||||
|
||||
|
@ -602,9 +602,6 @@ int websocket_poll_fds(struct node *n, int fds[])
|
|||
}
|
||||
|
||||
__attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "websocket";
|
||||
p.description = "Send and receive samples of a WebSocket connection (libwebsockets)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -626,6 +623,5 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {
|
|||
}
|
||||
|
||||
__attribute__((destructor(110))) static void UNIQUE(__dtor)() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -104,9 +104,6 @@ int zeromq_init(struct node *n)
|
|||
z->curve.enabled = false;
|
||||
z->ipv6 = 0;
|
||||
|
||||
z->in.endpoints.state = State::DESTROYED;
|
||||
z->out.endpoints.state = State::DESTROYED;
|
||||
|
||||
z->in.pending = 0;
|
||||
z->out.pending = 0;
|
||||
|
||||
|
@ -642,9 +639,6 @@ static struct plugin p;
|
|||
|
||||
__attribute__((constructor(110)))
|
||||
static void register_plugin() {
|
||||
if (plugins.state == State::DESTROYED)
|
||||
vlist_init(&plugins);
|
||||
|
||||
p.name = "zeromq";
|
||||
p.description = "ZeroMQ Distributed Messaging (libzmq)";
|
||||
p.type = PluginType::NODE;
|
||||
|
@ -672,6 +666,5 @@ static void register_plugin() {
|
|||
|
||||
__attribute__((destructor(110)))
|
||||
static void deregister_plugin() {
|
||||
if (plugins.state != State::DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
|
|
|
@ -320,8 +320,7 @@ int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes)
|
|||
|
||||
const char *mode = nullptr;
|
||||
|
||||
struct vlist destinations = { .state = State::DESTROYED };
|
||||
|
||||
struct vlist destinations;
|
||||
vlist_init(&destinations);
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s: o, s?: o, s?: o, s?: b, s?: b, s?: b, s?: i, s?: s, s?: b, s?: F, s?: o, s?: b}",
|
||||
|
@ -388,8 +387,6 @@ int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes)
|
|||
ps->node = me->node;
|
||||
ps->masked = false;
|
||||
|
||||
ps->mappings.state = State::DESTROYED;
|
||||
|
||||
vlist_init(&ps->mappings);
|
||||
|
||||
vlist_push(&p->sources, ps);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <villas/plugin.h>
|
||||
|
||||
/** Global list of all known plugins */
|
||||
struct vlist plugins = { .state = State::DESTROYED };
|
||||
struct vlist plugins;
|
||||
|
||||
LIST_INIT_STATIC(&plugins)
|
||||
|
||||
|
|
|
@ -109,14 +109,12 @@ retry: fd = shm_open(wname, O_RDWR|O_CREAT|O_EXCL, 0600);
|
|||
? QueueSignalledMode::POLLING
|
||||
: QueueSignalledMode::PTHREAD;
|
||||
|
||||
shared->queue.queue.state = State::DESTROYED;
|
||||
ret = queue_signalled_init(&shared->queue, conf->queuelen, manager, mode, flags);
|
||||
if (ret) {
|
||||
errno = ENOMEM;
|
||||
return -6;
|
||||
}
|
||||
|
||||
shared->pool.state = State::DESTROYED;
|
||||
ret = pool_init(&shared->pool, conf->queuelen, SAMPLE_LENGTH(conf->samplelen), manager);
|
||||
if (ret) {
|
||||
errno = ENOMEM;
|
||||
|
|
|
@ -64,10 +64,6 @@ SuperNode::SuperNode() :
|
|||
hugepages(DEFAULT_NR_HUGEPAGES),
|
||||
task(CLOCK_REALTIME)
|
||||
{
|
||||
nodes.state = State::DESTROYED;
|
||||
paths.state = State::DESTROYED;
|
||||
interfaces.state = State::DESTROYED;
|
||||
|
||||
vlist_init(&nodes);
|
||||
vlist_init(&paths);
|
||||
vlist_init(&interfaces);
|
||||
|
@ -161,10 +157,6 @@ void SuperNode::parse(json_t *cfg)
|
|||
if (!n)
|
||||
throw RuntimeError("Failed to allocate memory");
|
||||
|
||||
n->state = State::DESTROYED;
|
||||
n->in.state = State::DESTROYED;
|
||||
n->out.state = State::DESTROYED;
|
||||
|
||||
ret = node_init(n, nt);
|
||||
if (ret)
|
||||
throw RuntimeError("Failed to initialize node");
|
||||
|
|
|
@ -56,7 +56,6 @@ public:
|
|||
for (unsigned i = 0; i < ARRAY_LEN(dirs); i++) {
|
||||
dirs[i].name = i == 0 ? "in" : "out";
|
||||
dirs[i].format = "villas.human";
|
||||
dirs[i].io.state = State::DESTROYED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,9 +70,6 @@ public:
|
|||
if (ret)
|
||||
throw RuntimeError("Failed to initialize memory");
|
||||
|
||||
p.state = State::DESTROYED;
|
||||
io.state = State::DESTROYED;
|
||||
|
||||
cfg_cli = json_object();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,9 +74,6 @@ public:
|
|||
enabled(en),
|
||||
limit(lim)
|
||||
{
|
||||
pool.state = State::DESTROYED;
|
||||
pool.queue.state = State::DESTROYED;
|
||||
|
||||
/* Initialize memory */
|
||||
unsigned vec = LOG2_CEIL(MAX(node->out.vectorize, node->in.vectorize));
|
||||
unsigned pool_size = node_type(node)->pool_size ? node_type(node)->pool_size : vec;
|
||||
|
@ -254,8 +251,6 @@ public:
|
|||
if (ret)
|
||||
throw RuntimeError("Failed to initialize memory");
|
||||
|
||||
io.state = State::DESTROYED;
|
||||
|
||||
cfg_cli = json_object();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,13 +59,6 @@ public:
|
|||
{
|
||||
int ret;
|
||||
|
||||
n.state = State::DESTROYED;
|
||||
n.in.state = State::DESTROYED;
|
||||
n.out.state = State::DESTROYED;
|
||||
io.state = State::DESTROYED;
|
||||
q.state = State::DESTROYED;
|
||||
q.queue.state = State::DESTROYED;
|
||||
|
||||
ret = memory_init(DEFAULT_NR_HUGEPAGES);
|
||||
if (ret)
|
||||
throw RuntimeError("Failed to initialize memory");
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
{
|
||||
int ret;
|
||||
|
||||
io.state = State::DESTROYED;
|
||||
ret = io_init2(&io, format, dtypes.c_str(), 0);
|
||||
if (ret)
|
||||
throw RuntimeError("Failed to initialize IO");
|
||||
|
@ -103,8 +102,6 @@ public:
|
|||
dtypes("64f"),
|
||||
flags((int) SampleFlags::HAS_SEQUENCE | (int) SampleFlags::HAS_DATA | (int) SampleFlags::HAS_TS_ORIGIN)
|
||||
{
|
||||
pool.state = State::DESTROYED;
|
||||
|
||||
int ret;
|
||||
|
||||
ret = memory_init(DEFAULT_NR_HUGEPAGES);
|
||||
|
|
|
@ -230,9 +230,9 @@ ParameterizedTest(Param *p, io, lowlevel, .init = init_memory)
|
|||
|
||||
struct format_type *f;
|
||||
|
||||
struct pool pool = { .state = State::DESTROYED };
|
||||
struct io io = { .state = State::DESTROYED };
|
||||
struct vlist signals = { .state = State::DESTROYED };
|
||||
struct pool pool;
|
||||
struct io io;
|
||||
struct vlist signals;
|
||||
struct sample *smps[p->cnt];
|
||||
struct sample *smpt[p->cnt];
|
||||
|
||||
|
@ -318,13 +318,13 @@ ParameterizedTest(Param *p, io, highlevel, .init = init_memory)
|
|||
|
||||
struct format_type *f;
|
||||
|
||||
struct io io = { .state = State::DESTROYED };
|
||||
struct pool pool = { .state = State::DESTROYED };
|
||||
struct vlist signals = { .state = State::DESTROYED };
|
||||
|
||||
struct sample *smps[p->cnt];
|
||||
struct sample *smpt[p->cnt];
|
||||
|
||||
struct pool pool;
|
||||
struct vlist signals;
|
||||
struct io io;
|
||||
|
||||
ret = pool_init(&pool, 2 * p->cnt, SAMPLE_LENGTH(NUM_VALUES));
|
||||
cr_assert_eq(ret, 0);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ Test(mapping, parse_nodes)
|
|||
{
|
||||
int ret;
|
||||
struct mapping_entry m;
|
||||
struct vlist nodes = { .state = State::DESTROYED };
|
||||
struct vlist nodes;
|
||||
|
||||
const char *node_names[3] = { "apple", "cherry", "carrot" };
|
||||
const char *signal_names[3][4] = {
|
||||
|
@ -49,7 +49,6 @@ Test(mapping, parse_nodes)
|
|||
struct node *n = new struct node;
|
||||
|
||||
n->name = strdup(node_names[i]);
|
||||
n->in.signals.state = State::DESTROYED;
|
||||
|
||||
vlist_init(&n->in.signals);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ ParameterizedTestParameters(pool, basic)
|
|||
ParameterizedTest(struct param *p, pool, basic, .init = init_memory)
|
||||
{
|
||||
int ret;
|
||||
struct pool pool = { .state = State::DESTROYED };
|
||||
struct pool pool;
|
||||
|
||||
void *ptr, *ptrs[p->pool_size];
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ extern void init_memory();
|
|||
|
||||
#define SIZE (1 << 10)
|
||||
|
||||
static struct queue q = { .state = ATOMIC_VAR_INIT(State::DESTROYED) };
|
||||
static struct queue q;
|
||||
|
||||
#if defined(_POSIX_BARRIERS) && _POSIX_BARRIERS > 0
|
||||
static pthread_barrier_t barrier;
|
||||
|
@ -250,7 +250,6 @@ Test(queue, single_threaded, .init = init_memory)
|
|||
p.iter_count = 1 << 8;
|
||||
p.queue_size = 1 << 10;
|
||||
p.start = 1; /* we start immeadiatly */
|
||||
p.queue.state = ATOMIC_VAR_INIT(State::DESTROYED);
|
||||
|
||||
ret = queue_init(&p.queue, p.queue_size, &memory_heap);
|
||||
cr_assert_eq(ret, 0, "Failed to create queue");
|
||||
|
@ -319,7 +318,6 @@ ParameterizedTest(struct param *p, queue, multi_threaded, .timeout = 20, .init =
|
|||
pthread_t threads[p->thread_count];
|
||||
|
||||
p->start = 0;
|
||||
p->queue.state = ATOMIC_VAR_INIT(State::DESTROYED);
|
||||
|
||||
ret = queue_init(&p->queue, p->queue_size, p->mt);
|
||||
cr_assert_eq(ret, 0, "Failed to create queue");
|
||||
|
@ -366,8 +364,6 @@ Test(queue, init_destroy, .init = init_memory)
|
|||
int ret;
|
||||
struct queue q;
|
||||
|
||||
q.state = ATOMIC_VAR_INIT(State::DESTROYED);
|
||||
|
||||
ret = queue_init(&q, 1024, &memory_heap);
|
||||
cr_assert_eq(ret, 0); /* Should succeed */
|
||||
|
||||
|
|
|
@ -132,7 +132,6 @@ ParameterizedTest(struct param *param, queue_signalled, simple, .timeout = 5, .i
|
|||
int ret;
|
||||
void *r1, *r2;
|
||||
struct queue_signalled q;
|
||||
q.queue.state = State::DESTROYED;
|
||||
|
||||
pthread_t t1, t2;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue