Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 720286 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/havege.c (-4 / +24 lines)
Lines 178-183 H_PTR havege_create( /* RETURN: app state */ Link Here
178
   havege_ndsetup(h);
178
   havege_ndsetup(h);
179
   return h;
179
   return h;
180
}
180
}
181
182
void havege_reparent(
183
  H_PTR hptr)
184
{
185
   H_THREAD *t = (H_THREAD *)hptr->threads;
186
   if (0 == t)
187
      return; /* single-threaded */
188
189
   t->main = getpid();
190
}
191
181
/**
192
/**
182
 * Destructor. In a multi-collector build, this method should be called from a signal handler
193
 * Destructor. In a multi-collector build, this method should be called from a signal handler
183
 * to avoid creating processes.
194
 * to avoid creating processes.
184
-- a/src/havege.h
195
++ b/src/havege.h
Lines 238-243 typedef enum { Link Here
238
 *                        H_NOINIT
238
 *                        H_NOINIT
239
 */
239
 */
240
H_PTR       havege_create(H_PARAMS *params);
240
H_PTR       havege_create(H_PARAMS *params);
241
242
/**
243
 * haveger_create() remembers parent pid and uses it to identify deallocating thread.
244
 * daemonize() forks parent and effectively loses parent thread.
245
 * havege_reparent(void) allows recovering new parent pid before havege_run() is started.
246
 */
247
void        havege_reparent(H_PTR hptr);
248
241
/**
249
/**
242
 * Frees all allocated anchor resources. If the multi-core option is used, this
250
 * Frees all allocated anchor resources. If the multi-core option is used, this
243
 * method should be called from a signal handler to prevent zombie processes.
251
 * method should be called from a signal handler to prevent zombie processes.
244
-- a/src/haveged.c
252
++ b/src/haveged.c
Lines 538-545 static void run_daemon( /* RETURN: nothing */ Link Here
538
      anchor_info(h);
538
      anchor_info(h);
539
      return;
539
      return;
540
      }
540
      }
541
   if (params->foreground==0)
541
   if (params->foreground==0) {
542
     daemonize();
542
     daemonize();
543
     havege_reparent(handle);
544
   }
543
   else printf ("%s starting up\n", params->daemon);
545
   else printf ("%s starting up\n", params->daemon);
544
   if (0 != havege_run(h))
546
   if (0 != havege_run(h))
545
      error_exit("Couldn't initialize HAVEGE rng %d", h->error);
547
      error_exit("Couldn't initialize HAVEGE rng %d", h->error);
546
- 

Return to bug 720286