[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/HELLOWORLD PATCH] Add option to stay alive


  • To: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
  • From: "Jung, Alexander" <a.jung@xxxxxxxxxxxxxxx>
  • Date: Thu, 19 Mar 2020 15:40:40 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=lancaster.ac.uk; dmarc=pass action=none header.from=lancaster.ac.uk; dkim=pass header.d=lancaster.ac.uk; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lW33Z1QJDkKJTizA8C2NVF7tAhX1vkswbL9Cij0OMvs=; b=CDtgV5bGzib4ScHbElmJbXGQw3niaXtFW+VttKPyvOPE7nfUpI0u4GwNI7/USR/qW1F2IIXbMF4MZz2eIhzVhBLVk/5cp3+Tfuv80dZvpcteAWsjjlsnzj04ib98RxliWBQ4ZsUmTm/IjTd6dcgzUT/VHcfFVK0DQEmYIN1wMgbkthLDvIRdPf+HSDpMEoyACwONX0gcl6O5h/sbzOuwZaMoyQ+q9o3J2KiOizjuQ8XnLYhFlYvopGX84YX6KA6R960EU/sSSA/3fwmF74khQ388Z7yLlaFGx+yb216bEWpmc+EW669xj6A/6Utg8PRIautV5uCLZyBaEbpJVd8gMg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MKGA18AgpXZvJMrV7/aWBLDITTyNo+OXBSTOt72U5Fr863Qo0JlfL1pMKe7T7jGaObtgpYjxA02qeWGPUZV5Ra/PIJcwC1j5+3Tw0WJIlQwyaDrxpRkFWf0a2heL6KVMHqxfqMnEUR94wTFiynj62WtqV2Vga3wt0BG3JjVA+CAKFEy0IPm/iJBAWcNl6lDlymZzS485O3ULB5E6tlGU5pWbDzWBLkQ548G1HGFzApCYLb4KFtjU+fZIvofNEzYZP+cB8s3mHWhehn7kMjUt+YEsYwbHmZR30ozxCfuwwWTz52/o6F2Poy8XYk+sBhrsSQN4FEFdzsDdnpEqhCoZLQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=a.jung@xxxxxxxxxxxxxxx;
  • Cc: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • Delivery-date: Thu, 19 Mar 2020 15:40:48 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHV/gS+Vp/w8T1D2k6eCoe7NbBrQg==
  • Thread-topic: [Minios-devel] [UNIKRAFT/HELLOWORLD PATCH] Add option to stay alive

Looks good! :D

Reviewed-by: Alexander Jung <a.jung@xxxxxxxxxxx>

On 19.03.20, 16:21, "Minios-devel on behalf of Simon Kuenzer" 
<minios-devel-bounces@xxxxxxxxxxxxxxxxxxxx on behalf of 
simon.kuenzer@xxxxxxxxx> wrote:

Adds an option that does not shutdown the guest. When the boot process
is done, an ASCII animation of a swimming fish is shown. This option
can be useful (and entertaining) for demo purposes. The example can
also be handy to test initial ports to new platforms or libcs.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 Config.uk |  7 +++++++
 main.c    | 34 ++++++++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/Config.uk b/Config.uk
index 5e25d05..56cea87 100644
--- a/Config.uk
+++ b/Config.uk
@@ -10,3 +10,10 @@ config APPHELLOWORLD_PRINTARGS
        default y
        help
          Prints argument list (argv) to stdout
+
+config APPHELLOWORLD_SPINNER
+       bool "Stay alive"
+       select LIBUKTIME
+       default n
+       help
+         Shows an animation instead of shutting down
diff --git a/main.c b/main.c
index 6afa19e..c442058 100644
--- a/main.c
+++ b/main.c
@@ -1,18 +1,48 @@
 #include <stdio.h>
+#include <unistd.h>
+#include <uk/essentials.h>
 
 /* Import user configuration: */
 #include <uk/config.h>
 
+#if CONFIG_APPHELLOWORLD_SPINNER
+static const char *spinner[] = {
+       ">))'>        ",
+       " >))'>       ",
+       "  >))'>      ",
+       "   >))'>     ",
+       "    >))'o    ",
+       "     >))'>°  ",
+       "     <'((< ° ",
+       "    <'((<   '",
+       "   <'((<     ",
+       "  <'((<      ",
+       " <'((<       ",
+       "<'((<        ",
+};
+#endif
+
 int main(int argc, char *argv[])
 {
+#if CONFIG_APPHELLOWORLD_PRINTARGS || CONFIG_APPHELLOWORLD_SPINNER
+       int i;
+#endif
        printf("Hello world!\n");
 
 #if CONFIG_APPHELLOWORLD_PRINTARGS
-       int i;
-
        printf("Arguments: ");
        for (i=0; i<argc; ++i)
                printf(" \"%s\"", argv[i]);
        printf("\n");
 #endif
+
+#if CONFIG_APPHELLOWORLD_SPINNER
+       i = 0;
+       printf("\n");
+       while (1) {
+               i %= ARRAY_SIZE(spinner);
+               printf("\r%s", spinner[i++]);
+               sleep(1);
+       }
+#endif
 }
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.