Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 119039 - initreq.h should be installed
Summary: initreq.h should be installed
Alias: None
Product: Fedora
Classification: Fedora
Component: sysvinit
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2004-03-24 07:10 UTC by Nathan Robertson
Modified: 2014-03-17 02:43 UTC (History)
2 users (show)

Fixed In Version: 2.86-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-12-19 21:00:39 UTC

Attachments (Terms of Use)
adds initreq.h to the RPM (deleted)
2004-03-24 07:14 UTC, Nathan Robertson
no flags Details

Description Nathan Robertson 2004-03-24 07:10:15 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Gecko/20031114 Epiphany/1.0.4

Description of problem:
initreq.h is a header file which is required by pbbuttonsd, a package
for controlling power management and the "extra keys" that do things
like volume, brightness, etc. on laptops (i386 and ppc). This header
file basically contains one structure which said program needs, and
there's no reason not to export it to /usr/include. See the attached

After this patch is applied, I can package up pbbuttonsd for FC.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Try to compile a program which #include's <initreq.h>

Additional info:

Comment 1 Nathan Robertson 2004-03-24 07:14:34 UTC
Created attachment 98817 [details]
adds initreq.h to the RPM

Of course, header files belong in -devel packages, but it seems hardly worth it
for one very small header file. If the maintainer feels it's worth it, I guess
technically it should be split up.

Comment 2 Bill Nottingham 2004-03-24 16:38:10 UTC
Why do the volume/brightness buttons need to signal *init*?

Comment 3 Nathan Robertson 2004-03-24 21:31:57 UTC

The daemon has two functions:
- those buttons
- power management

init is used in the latter function. More specifically, here's where
it's used to send SIGPWR to init:

send_sigpwr (char mode)
  struct init_request initreq;
  FILE *fd;
  int err = -1;
  initreq.magic     = INIT_MAGIC;
  initreq.cmd       = mode == 'F' ? INIT_CMD_POWERFAIL : INIT_CMD_POWEROK;
  initreq.sleeptime = 5;
  if ((fd = fopen(INIT_FIFO, "r+")) != NULL) {
    err = 0;
    if ((fwrite(&initreq, sizeof(initreq), 1, fd)) != 1)
      err = -1;
  if (err == -1) {
    if ((fd = fopen("/etc/powerstatus", "w")) != NULL) {
      err = 0;
      if ((fwrite(&mode, 1, 1, fd)) != 1)
        err = -1;
    err = kill(1, SIGPWR);  /* send SIGPWR to the INIT process */
  return err;

Comment 4 Bill Nottingham 2004-03-25 05:52:55 UTC
Hm, it would be simpler if those were gated through the same mechanism
as the ACPI buttons.

Comment 5 Nathan Robertson 2004-03-25 21:49:23 UTC
I forwarded on this bug report to the author of pbbuttonsd. Here is
his response:

pbbuttonsd is a power management daemon for apple powerpc machines 
which don't support ACPI. 
PBButtonsd can be configured to tell init about the low battery 
condition. Init has appropriate mechanisms to handle such emergency 
conditions. Usually an application writes the file /etc/powerstatus 
and send the signal SIGPWR to the init process but the man page of 
init (8) depreciated this method: 
--- quote --- 
Usage of SIGPWR and /etc/powerstatus is discouraged. Someone 
wanting to interact with init should use the /dev/initctl 
control channel - see the source code of the sysvinit package 
for more documentation about this. 
--- quote off --- 
You see installing the include file initreq.h is a step forward. 
 Best Regards 
   Matthias Grimm 

Comment 6 Nathan Robertson 2004-03-25 22:00:07 UTC
Also from the init man page:

Init  listens  on  a fifo in /dev, /dev/initctl, for messages. 
Telinit uses this to communicate with init. The interface is not very
well documented or finished. Those interested should study the
initreq.h file in the src/ subdirectory of the init source code tar

So, to use the /dev/initctl interface, you need the header that patch
provides. From initreq.h:

#define INIT_FIFO "/dev/initctl"

and from the code listing above:

if ((fd = fopen(INIT_FIFO, "r+")) != NULL)

So, this looks like the recommended way, from reading the man page.

Comment 7 Bill Nottingham 2004-03-25 22:05:35 UTC
Yes, it's just that there are also acpi-using buttons for doing
soft-power off. In the Grand Scheme, it would be nice to have them all
going through the same interface. :)

Comment 8 Nathan Robertson 2004-03-26 06:25:35 UTC
That may well be so (or not, my knowledge is limited in this area).

However, either way, the initreq.h header should be included in any
case, because it's inconsistent with the init(8) man page not to
include it. The man page says "we recommend you do this, see this
header file" (ie. use what's in there, implying #include it). Without
the header file included, there is no way *any* application could
follow the recommended practice from the man page.

Whether or not pbbuttonsd should be using this header file is another
discussion, I guess.

Comment 9 Bill Nottingham 2005-12-19 21:00:39 UTC
Will be fixed in 2.86-1.

Comment 10 David Lawrence 2007-06-22 02:10:40 UTC
Package name is now sysvinit in Fedora.

Note You need to log in before you can comment on or make changes to this bug.