File introduce-once-1.patch of Package haveged.37149

From 98ead65f953a3431d53c5837eedd008100ce9ed7 Mon Sep 17 00:00:00 2001
From: Jirka Hladky <jhladky@redhat.com>
Date: Fri, 31 Dec 2021 02:28:02 +0100
Subject: [PATCH] New parameter --once to refill entropy once and quit
 immediatelly

---
 ChangeLog     |  6 +++++-
 src/haveged.c | 10 +++++++++-
 src/haveged.h |  2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)

Index: haveged-1.9.14/src/haveged.c
===================================================================
--- haveged-1.9.14.orig/src/haveged.c
+++ haveged-1.9.14/src/haveged.c
@@ -76,6 +76,7 @@ static struct pparams defaults = {
   .buffersz       = 0,
   .detached       = 0,
   .foreground     = 0,
+  .once           = 0,
   .d_cache        = 0,
   .i_cache        = 0,
   .run_level      = 0,
@@ -146,6 +147,7 @@ int main(int argc, char **argv)
       "i", "inst",        "1", SETTINGR("Instruction cache size [KB], with fallback to: ", GENERIC_ICACHE),
       "f", "file",        "1", "Sample output file,  default: '" OUTPUT_DEFAULT "', '-' for stdout",
       "F", "Foreground",  "0", "Run daemon in foreground",
+      "e", "once",        "0", "Provide entropy to the kernel once and quit immediatelly",
       "r", "run",         "1", "0=daemon, 1=config info, >1=<r>KB sample",
       "n", "number",      "1", "Output size in [k|m|g|t] bytes, 0 = unlimited to stdout",
       "o", "onlinetest",  "1", "[t<x>][c<x>] x=[a[n][w]][b[w]] 't'ot, 'c'ontinuous, default: ta8b",
@@ -273,6 +275,10 @@ int main(int argc, char **argv)
             params->setup |= RUN_IN_FG;
             params->foreground = 1;
             break;
+         case 'e':
+            params->setup |= RUN_ONCE;
+            params->once = 1;
+            break;
          case 'b':
             params->buffersz = ATOU(optarg) * 1024;
             if (params->buffersz<4)
Index: haveged-1.9.14/src/haveged.h
===================================================================
--- haveged-1.9.14.orig/src/haveged.h
+++ haveged-1.9.14/src/haveged.h
@@ -32,6 +32,7 @@ struct pparams  {
    H_UINT         buffersz;         /* size of collection buffer (kb)               */
    H_UINT         detached;         /* non-zero if daemonized                       */
    H_UINT         foreground;       /* non-zero if running in foreground            */
+   H_UINT         once;             /* 1: refill entropy once and quit immediatelly */
    H_UINT         run_level;        /* type of run 0=daemon,1=setup,2=pip,sample kb */
    H_UINT         d_cache;          /* size of data cache (kb)                      */
    H_UINT         i_cache;          /* size of instruction cache (kb)               */
@@ -67,6 +68,7 @@ struct pparams  {
 #define   SET_LWM       0x040
 #define   MULTI_CORE    0x080
 #define   CMD_MODE      0x100
+#define   RUN_ONCE      0x200
 /**
  * Default tests settings
  */
openSUSE Build Service is sponsored by