🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.os.linux.programowanie
Article #215

Re: Jak rozpoznac init?

#215
From: Robert Luberda
Date: Thu, 09 Sep 1999 12:25
24 lines
1584 bytes
Daniel Mróz <beorn@cyberdeck.digital.pl> wrote:
> On 9 Sep 1999 01:02:02 GMT, Kamil Jonca <kjonca@kjonca.kjonca.bogus> wrote:
>>To nie jest trywialne :) W cegle Stewnsa jest dużo tekstu na ten temat i
>>konkluzja jest taka "nie da sie" w 100% 
>>Inaczej jeśli getppid()!=1 to na pewno nie przez init
>>natomiast inaczej nie bardzo wiadomoe
> Wlasnie :/. Qrde...musi byc jakis sposob...Bede dalej probowal...Dzieki za
> pomoc.

W manie  do inita jest napisane, że 
"Init sets the following environment variables for all its children:
 [...]
INIT_VERSION
	[...] Useful to determine if a script runs directly from init."

Czyli: 
if (getppid()==1 && getenv("INIT_VERSION"))
	printf("_Najprawdopodobniej_ moim ojcem jest init!");

Pozdrowienia, 
Robert 

-- 
robert@pingu.ii.uj.edu.pl
Technical Details
Message-ID: <7r88uv$6u2$1@info.cyf-kr.edu.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.icm.edu.pl!news.polbox.pl!rmf-fm!intranet.rmf.pl!cyfronet!not-for-mail
References: <slrn7tdb1r.hr.beorn@cyberdeck.digital.pl> <slrn7te1oa.ti5.kjonca@kjonca.kjonca.bogus> <slrn7tf1ej.h6.beorn@cyberdeck.digital.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.icm.edu.pl!news.polbox.pl!rmf-fm!intranet.rmf.pl!cyfronet!not-for-mail
From: Robert Luberda <robert@pingu.ii.uj.edu.pl>
Newsgroups: pl.comp.os.linux.programowanie
Subject: Re: Jak rozpoznac init?
Date: 9 Sep 1999 12:25:03 GMT
Organization: Inst. of Comp. Sciences, Jagiell. Univ., Cracow
Lines: 25
Message-ID: <7r88uv$6u2$1@info.cyf-kr.edu.pl>
References: <slrn7tdb1r.hr.beorn@cyberdeck.digital.pl> <slrn7te1oa.ti5.kjonca@kjonca.kjonca.bogus> <slrn7tf1ej.h6.beorn@cyberdeck.digital.pl>
NNTP-Posting-Host: pingu.ii.uj.edu.pl
Mime-Version: 1.0
User-Agent: tin/pre-1.4-19990517 ("Psychonaut") (Linux)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit