Module: xenomai-forge
Branch: next
Commit: 83cd57130a0cd941bad908afd5fda13ac41dbd81
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=83cd57130a0cd941bad908afd5fda13ac41dbd81

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Apr 14 12:35:34 2014 +0200

copperplate/init: introduce --dump-config option

The builtin --dump-config switch is introduced to dump the
configuration information from any copperplate-based application.

---

 doc/asciidoc/README.APPLICATIONS.adoc |   15 +++++++++------
 lib/copperplate/init.c                |   19 +++++++++++++++++++
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/doc/asciidoc/README.APPLICATIONS.adoc 
b/doc/asciidoc/README.APPLICATIONS.adoc
index a3a2deb..b9ebea1 100644
--- a/doc/asciidoc/README.APPLICATIONS.adoc
+++ b/doc/asciidoc/README.APPLICATIONS.adoc
@@ -151,13 +151,16 @@ switch]).
        Sets the CPU affinity of threads created by the Xenomai
        libraries within the new process.
 
-*--enable-async-cancel*::
+*--version*::
 
-       Enables asynchronous cancellation of Xenomai threads, making
-       provision to protect the Xenomai APIs accordingly. When
-       disabled, Xenomai assumes that threads may exit due to
-       cancellation only when they reach cancellation points (like
-       system calls). Defaults to enabled.
+       Writes the Xenomai version information to stdout. The program
+       immediately exits with a success code afterwards.
+
+*--dump-config*::
+
+       Dumps the configuration settings to stdout. Those settings are
+       defined as a result of running the configure script. The
+       program immediately exits with a success code afterwards.
 
 Available real-time APIs
 ------------------------
diff --git a/lib/copperplate/init.c b/lib/copperplate/init.c
index 685d018..8f9f33a 100644
--- a/lib/copperplate/init.c
+++ b/lib/copperplate/init.c
@@ -129,6 +129,13 @@ static const struct option base_options[] = {
                .val = 0
        },
        {
+#define dumpconfig_opt 10
+               .name = "dump-config",
+               .has_arg = 0,
+               .flag = NULL,
+               .val = 0
+       },
+       {
                .name = NULL,
                .has_arg = 0,
                .flag = NULL,
@@ -142,6 +149,14 @@ static inline void print_version(void)
        fprintf(stderr, "%s\n", xenomai_version_string);
 }
 
+static inline void dump_configuration(void)
+{
+       int n;
+
+       for (n = 0; config_strings[n]; n++)
+               puts(config_strings[n]);
+}
+
 static void usage(void)
 {
        struct copperskin *skin;
@@ -157,6 +172,7 @@ static void usage(void)
         fprintf(stderr, "--cpu-affinity=<cpu[,cpu]...>    set CPU affinity of 
threads\n");
         fprintf(stderr, "--silent                         tame down 
verbosity\n");
         fprintf(stderr, "--version                        get version 
information\n");
+        fprintf(stderr, "--dump-config                    dump configuration 
settings\n");
        
        pvlist_for_each_entry(skin, &skins, __reserved.next) {
                if (skin->help)
@@ -360,6 +376,9 @@ static int parse_base_options(int *argcp, char *const 
**argvp,
                case version_opt:
                        print_version();
                        exit(0);
+               case dumpconfig_opt:
+                       dump_configuration();
+                       exit(0);
                case help_opt:
                        usage();
                        exit(0);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to