Le 16/06/2016 23:16, Steve Litt a écrit :
If the machine were anything but a demonstration experimental machine,
so would I contemplate suicide or systemd. Same with Python, Ruby, and
(urk) Javascript. But truth be told, if PID1 were written in Lua, I
would not be dismayed in the slightest.


IIUC (not having a very strong practice on English), you don't like it in Perl (except for demo) but you would love it written in Lua. I have written a program in Lua long ago and got a good opinion of this language, but he problem is that Lua is not as easily available as Perl. Even in the tiny Busybox, you can have Perl, or even a subset called Miniperl which is probably enough to run an init program.


Le 17/06/2016 03:44, Adam Borowski a écrit :
Yeah, we need to use an efficient language!

.globl _start
.data
nopid1: .ascii "No pid 1, no fun.\n"
command: .ascii "/sbin/osloader.sh"
norc: .ascii "Starting /sbin/osloader.sh failed!\n"
.text
_start:
        mov     $39, %rax       # getpid
        syscall
        cmp     $1, %rax
        je      pid1
        mov     $1, %rax        # write
        mov     $1, %rdi
        mov     $nopid1, %rsi
        mov     $18, %rdx
        syscall
        mov     $60, %rax       # _exit
        mov     $1, %rdi
        syscall
pid1:
        mov     $57, %rax       # fork
        syscall
        cmp     $0, %rax
        jne     child
parent:
        mov     $61, %rax       # wait4
        mov     $-1, %rdi
        xor     %rsi, %rsi
        xor     %rdx, %rdx
        syscall
        jmp     parent
child:
        mov     $59, %rax       # execve
        mov     $command, %rdi
        xor     %rsi, %rsi
        xor     %rdx, %rdx
        syscall
        mov     $1, %rax        # write
        mov     $1, %rdi
        mov     $norc, %rsi
        mov     $36, %rdx
        syscall
        mov     $60, %rax       # _exit
        mov     $1, %rdi
        syscall

Hmmm... I think I'd go with Perl after all.

Here again, I'm not sure if you are serious, but I take it seriously. I wouldn't like to have init written in assembly language because it is arch-dependent, but wether it is in C or Perl, I think it doesn't matter - I prefer the C language because I know it well while I don't know Perl, but this is just personnal.

However I think init must do more on the long run than reaping zombies. It should ensure in some way that at least someone can login to the system to do something, for example it should supervise a supervisor, or at least supervise a getty. Otherwise the only way to reboot a locked-in system is power-down.

    Didier

_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to