On 07/05/18 09:54, Sebastian Huber wrote:
On 07/05/18 09:31, Chris Johns wrote:
On 07/05/2018 17:04, Sebastian Huber wrote:
On 04/05/18 02:42, Chris Johns wrote:
On 03/05/2018 16:49, Sebastian Huber wrote:
+#endif /* __rtems__ */
diff --git a/dhcpcd/namespace.h b/dhcpcd/namespace.h
index efff909ad..c9f5fb1fa 100644
--- a/dhcpcd/namespace.h
+++ b/dhcpcd/namespace.h
@@ -156,6 +156,7 @@ extern rtems_recursive_mutex dhcpcd_mutex;
#define print_string dhcpcd_print_string
#define read_config dhcpcd_read_config
#define read_lease dhcpcd_read_lease
+#define script_runreason dhcpcd_script_runreason
#define select_profile dhcpcd_select_profile
#define set_cloexec dhcpcd_set_cloexec
#define set_nonblock dhcpcd_set_nonblock
diff --git a/dhcpcd/script.c b/dhcpcd/script.c
index 2de1e6347..2c184c248 100644
--- a/dhcpcd/script.c
+++ b/dhcpcd/script.c
@@ -51,7 +51,30 @@
#include "ipv6nd.h"
#include "net.h"
#include "script.h"
+#ifdef __rtems__
+#include <rtems/dhcpcd.h>
+static SLIST_HEAD(, rtems_dhcpcd_hook) dhcpcd_hooks =
+ SLIST_HEAD_INITIALIZER(dhcpcd_hooks);
+
+void
+rtems_dhcpcd_add_hook(rtems_dhcpcd_hook *hook)
+{
+ rtems_recursive_mutex_lock(&dhcpcd_mutex);
+ SLIST_INSERT_HEAD(&dhcpcd_hooks, hook, node);
+ rtems_recursive_mutex_unlock(&dhcpcd_mutex);
+}
+
+void
+rtems_dhcpcd_remove_hook(rtems_dhcpcd_hook *hook)
+{
+ rtems_recursive_mutex_lock(&dhcpcd_mutex);
+ SLIST_REMOVE(&dhcpcd_hooks, hook, rtems_dhcpcd_hook, node);
+ rtems_recursive_mutex_unlock(&dhcpcd_mutex);
+}
+#endif /* __rtems__ */
This seems like a common issue we will face with FreeBSD, I am sure
callouts
which normally exec's something would be needed else where. I am
thinking of
wifi?
Could this be made a common base type struct and used here?
I am not sure if the handler signature will be the same.
There is some historical logic behind scripts with argc/argv and that
is it's
common interface of a command line. The rc.conf code provides a way
to manage
argc/argv which can be reused.
Given this interface is to replace exec'ing a script why not call with
argc/argv? There must be exiting support to do this?
The dhcpcd doesn't use argc and argv to pass information to the
scripts. It uses the environment. I have to check how this could be
mapped.
The dhcpcd function to execute the scripts is
static int exec_script(char *const *argv, char *const *env)
which uses posix_spawn(). The argv is just
char *const argv[2] = { UNCONST(ifp->options->script), NULL };
Information is passed to the scripts via the environment.
This doesn't map well to the argc/argv style used elsewhere. What would
you do here?
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel