You are not logged in.

#1 2020-07-08 09:28:59

idang1410
Member
Registered: 2020-03-01
Posts: 7

[SOLVED] reboot is symlink

Hey everyone

I don't have a problem i need to fix, I encountered something I couldn't explain.
As you know the commands halt. reboot, shutdown are symlinks to systemctl (on systemd machines).
But I don't understand how systemctl know how to act. It's not like the symlink has additional data like command to run. It's just pointer to systemctl.
So how systemctl knows to do the proper action?

Last edited by idang1410 (2020-07-08 09:42:37)

Offline

#2 2020-07-08 09:32:05

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,097

Re: [SOLVED] reboot is symlink

It checks argv[0] and acts depending on what it says. It is quite common to do this, eg kmod and vim does the same.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2020-07-08 09:42:04

idang1410
Member
Registered: 2020-03-01
Posts: 7

Re: [SOLVED] reboot is symlink

Mr.Elendig wrote:

It checks argv[0] and acts depending on what it says. It is quite common to do this, eg kmod and vim does the same.

It makes sense. It's also in the source code (I checked just now)
Thanks

Offline

Board footer

Powered by FluxBB