TIP: Click on subject to list as thread! ANSI
echo: linux
to: DAVE VANDERMEER
from: ALEXEY VISSARIONOV
date: 2017-08-11 11:11:00
subject: write your own /sbin/init

Good ${greeting_time}, Dave!

10 Aug 2017 12:39:10, you wrote to Maurice Kinal:

 MK>> Personally I am blaming systemd.  It appeared to me that it was
 MK>> 99.99% of the console grief I was seeing.
 DV> All distro's should give the option of fallback to OpenRC init for
 DV> those that don't want to run Gnome3 .. systemd is nothing but a pain
 DV> in the ass

People who use userspace crocks like udev and systemd simply don't know how to
use the kernel. And the /sbin/init itself may be as simple as

#include 
#include 

int main(void)
{
  sigset_t set;
  int status;

  if(getpid() != 1)
    return 1; /* change to running /etc/rc with given arguments if you need */

  sigfillset(&set);
  sigprocmask(SIG_BLOCK, &set, NULL);

  if(fork())
  {
    for(;;)
      wait(&status);
  }
  else
  {
    sigprocmask(SIG_UNBLOCK, &set, NULL);
    setsid();
    setpgrp();
    return execve("/etc/rc",
                (char *[]){"rc", NULL},
                (char *[]){NULL});
  }
}


--
Alexey V. Vissarionov aka Gremlin from Kremlin
gremlin.ru!gremlin; +vii-cmiii-cmlxxvii-mmxlviii

... that's why I really dislike fools.
--- /bin/vi
* Origin: http://openwall.com/Owl (2:5020/545)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.