Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Mar 2019 09:36:02 -0400
From:      Paul Mather <freebsd-lists@gromit.dlib.vt.edu>
To:        freebsd-questions@freebsd.org
Cc:        Polytropon <freebsd@edvax.de>, Michael Sierchio <kudzu@tenebras.com>, mayuresh@kathe.in
Subject:   Re: Sending Tcsh to packages/ports ...
Message-ID:  <0CE431C9-683E-423F-A0A5-D06C3363C411@gromit.dlib.vt.edu>
In-Reply-To: <mailman.5940.1553830572.52788.freebsd-questions@freebsd.org>
References:  <mailman.5940.1553830572.52788.freebsd-questions@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> Date: Fri, 29 Mar 2019 03:56:38 +0100
> From: Polytropon <freebsd@edvax.de>
> To: Michael Sierchio <kudzu@tenebras.com>
> Cc: mayuresh@kathe.in, FreeBSD Questions
> 	<freebsd-questions@freebsd.org>
> Subject: Re: Sending Tcsh to packages/ports ...
> Message-ID: <20190329035638.db780898.freebsd@edvax.de>
> Content-Type: text/plain; charset=3DUS-ASCII
>=20
> On Thu, 28 Mar 2019 19:03:24 -0700, Michael Sierchio wrote:
>> *kudzu@hearst:/bin 130>* ll -i | grep csh
>>=20
>> 198147 -r-xr-xr-x   2 root  wheel  427888 Jun 22  2018 csh*
>>=20
>> 198147 -r-xr-xr-x   2 root  wheel  427888 Jun 22  2018 tcsh*
>>=20
>=20
> The csh / tcsh is not the only system component known by
> more than one name:
>=20
> 	% hardlinks.sh /bin
> 	     23621: csh tcsh 	<--- !
> 	     23627: ed red=20
> 	     23633: link ln=20
> 	     23638: pgrep pkill=20
> 	     23644: rm unlink=20
> 	     24944: [ test
>=20
> It's important to note that by querying $0 or argv[0], a
> program can change its behaviour depending on the way it
> has been invoked. So a call to "csh" could cause the program
> to do things differently than if it was called by "tcsh".
>=20
> Of course this also applies to _any_ programs, being part
> of the OS or being installed by ports.


Indeed, this is the mechanism by which the /rescue system works: lots of =
hard links to a statically-linked /rescue/rescue binary, which behaves =
differently depending upon with which program name it's being invoked.  =
In the case of /rescue this saves a lot of space over having separate =
static binaries.

Cheers,

Paul.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0CE431C9-683E-423F-A0A5-D06C3363C411>