Article View: news.software.readers
Article #109520Re: [slrn] Getting It To Run At All [OT]
From: G. Wolfe Woodbury
Date: Fri, 13 Sep 2002 02:14
Date: Fri, 13 Sep 2002 02:14
66 lines
4440 bytes
4440 bytes
Blinky the Shark <no.spam@box.invalid> shaped electrons to say: > See <looking around>, <whispering> I haven't yet found out where > environment variables are set, *other than* from the prompt. I'd just > set the bastage from autoexec....OOPS.....from somewhere that gets read > on boot, if'n I could. IT all begins with 'init'. The boot sequence loads the kernel and transfers control to it. Among the first few things the kernel does at boot time (along with initializing memory management and the devices) is to craft the first "processes" in non-kernel memory. This is done specially because the newly booted kernel can't call 'exec' yet. This first process is called 'init' and lives in /sbin/init. Some other processes are created by the kernel as well, but they aren't relevant to userland operation. Init sets "PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin" (snipped right out of the strings(1) examination of /sbin/init). Init then examines the /etc/inittab file, and starts creating other processes based on the information it reads there. Some of the entries in inittab(5) call the sysinit scripts, which set up various other system services and daemons. Other entries run "gettys" on the consoles. The getty family program monitors the console (or serial line) device file waiting for something to happen. For the Linux consoles, it displays a banner and issues the "login: " prompt and waits for keyboard action. The getty sets some more environment variables, among them is TERM. /sbin/mgetty is an example of the getty programs. (There is a lot more that the getty does, including FAX reception.) The getty passes the username it gets from the login: prompt along to the /bin/login program. login(1) proceeds to reset the environment and do various accounting and housekeeping tasks. It reads the /etc/passwd entry for the given username, sets PATH (again) and some other variables, collects the password and checks it, establishes the stdin, stdout and stderr files, and (finally) calls the user's shell. Bash then does a few things to get itself going. Here is an excerpt from the bash(1) manual page: When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior. Then bash starts waiting for commands and fork/exec's them. Note that the sequence from getty to shell is done by each program "exec"ing its successor, meaning that the same "process" simply starts running new code. To "fork" means that a new process is created, and that usually exec's the new code. The distinction is somewhat critical. Now you may have more than you wanted to know. -- Gregory G. "Wolfe" Woodbury `-_-' Owner/Admin: wolves.durham.nc.us ggw at wolves.durham.nc.us U "The Line Eater is a boojum snark." Hug your wolf.
Technical Details
Message-ID:
<slrnao2igg.ik7.ggw_@wolves.homeip.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc04.gnilink.net.POSTED!5552e703!not-for-mailReferences:
<slrnantp90.8s2.tim@vegeta.ath.cx> <alp9n9012ns@enews2.newsguy.com> <slrnao0loj.1q5.usenet@calmeilles.co.uk> <slrnao0mar.np6.tim@vegeta.ath.cx> <7760280.40QTL0fHMe@blinkynews.invalid>Show Full Headers
Complete Article Headers
Message-ID: <slrnao2igg.ik7.ggw_@wolves.homeip.net> Subject: Re: [slrn] Getting It To Run At All [OT] Date: Fri, 13 Sep 2002 02:14:41 GMT From: "G. Wolfe Woodbury" <ggw_@no_spam.wolves.durham.nc.us> References: <slrnantp90.8s2.tim@vegeta.ath.cx> <alp9n9012ns@enews2.newsguy.com> <slrnao0loj.1q5.usenet@calmeilles.co.uk> <slrnao0mar.np6.tim@vegeta.ath.cx> <7760280.40QTL0fHMe@blinkynews.invalid> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc04.gnilink.net.POSTED!5552e703!not-for-mail Newsgroups: news.software.readers Organization: Wolves Den VI User-Agent: slrn/0.9.7.4 (Linux) Lines: 65 NNTP-Posting-Host: 4.64.249.178 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc04.gnilink.net 1031883281 4.64.249.178 (Thu, 12 Sep 2002 22:14:41 EDT) NNTP-Posting-Date: Thu, 12 Sep 2002 22:14:41 EDT