# HG changeset patch # User Edouard Tisserant # Date 1631530972 -7200 # Node ID 51b9b49a56baa8a39a500ee7ed900c297d2ab6f2 # Parent 21d37b199ede03637d0f9b00aa058668031a9d19# Parent 5f9db9c6c69c2a494f18a05b59f964cef0920c21 Merged default diff -r 21d37b199ede -r 51b9b49a56ba setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup.py Mon Sep 13 13:02:52 2021 +0200 @@ -0,0 +1,15 @@ +""" +Install Beremiz +""" +from setuptools import setup + +setup( + name='beremiz', + version='0.1', + install_requires=["Twisted == 20.3.0", "attrs == 19.2.0", "Automat == 0.3.0", + "zope.interface == 4.4.2", "Nevow == 0.14.5", "PyHamcrest == 2.0.2", + "Pygments == 2.9.0", "Pyro == 3.16", "constantly == 15.1.0", + "future == 0.18.2", "hyperlink == 21.0.0", "incremental == 21.3.0", + "pathlib == 1.0.1", "prompt-toolkit == 3.0.19", "zeroconf-py2compat == 0.19.10", + "idna == 2.10"] +) diff -r 21d37b199ede -r 51b9b49a56ba targets/Xenomai/plc_Xenomai_main.c --- a/targets/Xenomai/plc_Xenomai_main.c Fri Sep 10 14:48:07 2021 +0200 +++ b/targets/Xenomai/plc_Xenomai_main.c Mon Sep 13 13:02:52 2021 +0200 @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -117,16 +118,16 @@ static unsigned long __debug_tick; -#define _LogAndReturnNull(text) \ +#define _Log(text, err) \ {\ - char mstr[256] = text " for ";\ - strncat(mstr, name, 255);\ + char mstr[256];\ + snprintf(mstr, 255, text " for %s (%d)", name, err);\ LogMessage(LOG_CRITICAL, mstr, strlen(mstr));\ - return NULL;\ } void *create_RT_to_nRT_signal(char* name){ int new_index = -1; + int ret; RT_to_nRT_signal_t *sig; char pipe_dev[64]; @@ -141,19 +142,22 @@ /* fail if none found */ if(new_index == -1) { - _LogAndReturnNull("Maximum count of RT-PIPE reached while creating pipe"); + _Log("Maximum count of RT-PIPE reached while creating pipe", max_RT_to_nRT_signals); + return NULL; } /* create rt pipe */ - if(rt_pipe_create(&sig->pipe, name, new_index, PIPE_SIZE) < 0){ - _LogAndReturnNull("Failed opening real-time end of RT-PIPE"); + if(ret = rt_pipe_create(&sig->pipe, name, new_index, PIPE_SIZE) < 0){ + _Log("Failed opening real-time end of RT-PIPE", ret); + return NULL; } /* open pipe's userland */ - snprintf(pipe_dev, 64, "/dev/rtp%d", new_index); + snprintf(pipe_dev, 63, "/dev/rtp%d", new_index); if((sig->pipe_fd = open(pipe_dev, O_RDWR)) == -1){ rt_pipe_delete(&sig->pipe); - _LogAndReturnNull("Failed opening non-real-time end of RT-PIPE"); + _Log("Failed opening non-real-time end of RT-PIPE", errno); + return NULL; } sig->used = 1; @@ -163,13 +167,19 @@ } void delete_RT_to_nRT_signal(void* handle){ + int ret; RT_to_nRT_signal_t *sig = (RT_to_nRT_signal_t*)handle; + char *name = sig->name; if(!sig->used) return; - rt_pipe_delete(&sig->pipe); - - close(sig->pipe_fd); + if(ret = rt_pipe_delete(&sig->pipe) != 0){ + _Log("Failed closing real-time end of RT-PIPE", ret); + } + + if(close(sig->pipe_fd) != 0){ + _Log("Failed closing non-real-time end of RT-PIPE", errno); + } sig->used = 0; }