old-www/LDP/LG/issue90/TWDT.html

6094 lines
236 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE> Linux Gazette Table of Contents LG #90</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000" >
<center>
<!-- A HREF="http://www.linuxgazette.com/">
<H1><IMG SRC="../gx/newlogo.jpg" ALT="LINUX GAZETTE" border="0"></H1></A> -->
<A HREF="http://www.linuxgazette.com/">
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.png"
WIDTH="600" HEIGHT="124" border="0"></H1></A>
<H2>May 2003, Issue 90 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Published by <I>Linux Journal</I></H2>
<A HREF="../index.html">Front Page</A> &nbsp;|&nbsp;
<A HREF="../index.html">Back Issues</A> &nbsp;|&nbsp;
<A HREF="../lg_faq.html">FAQ</A> &nbsp;|&nbsp;
<A HREF="../mirrors.html">Mirrors</A> <!-- &nbsp;|&nbsp; --><BR>
<A HREF="../tag-kb.html">The Answer Gang knowledge base</A> (your Linux questions here!) <!-- &nbsp;|&nbsp; --><BR>
<A HREF="http://www.linuxgazette.com/search.html">Search (www.linuxgazette.com)</A>
<!-- *** BEGIN mirror site search link *** -->
<!-- &nbsp; <A HREF="http://www.linuxgazette.com/search.html">(SITE.COM
mirror)</A> -->
<!-- *** END mirror site search link *** -->
</CENTER>
<HR NOSHADE>
<!--=================================================================-->
<!-- H1><font color="#BB0000">Table of Contents:</font></H1 -->
<!-- *** BEGIN toc *** -->
<UL>
<LI> <A HREF="lg_mail.html">The MailBag</A>
<LI> <A HREF="lg_tips.html">More 2-Cent Tips</A>
<LI> <A HREF="lg_answer.html">The Answer Gang</A>
<LI> <A HREF="lg_bytes.html">News Bytes</A>, <EM>by Michael Conry</EM>
<LI> <A HREF="collinge.html">HelpDex</A>, <EM>by Shane Collinge</EM>
<LI> <A HREF="ecol.html">Ecol</A>, <EM>by Javier Malonda</EM>
<LI> <A HREF="forsberg.html">Software development for a Sharp Zaurus SL-5500 Linux PDA</A>, <EM>by Bruce Forsberg</EM>
<LI> <A HREF="okopnik.html">Perl One-Liner of the Month: The Mystery of the Red Worm</A>, <EM>by Ben Okopnik</EM>
<LI> <A HREF="puryear.html">Book Review: Perl for System Administration</A>, <EM>by Dustin Puryear</EM>
<LI> <A HREF="raghu.html">setjmp/longjmp Illustrated</A>, <EM>by Raghu J Menon</EM>
<LI> <A HREF="ward.html">The CUPS printing system</A>, <EM>by Alan Ward</EM>
<LI> <A HREF="weber.html">Programming with User Mode Linux</A>, <EM>by Nick Weber</EM>
</UL>
<!-- *** END toc *** -->
<HR NOSHADE>
<!--=================================================================-->
<H3 ALIGN="center"><EM>Linux Gazette</EM> Staff and The Answer Gang</H3>
<BLOCKQUOTE>
<STRONG>Editor:</STRONG> Michael Orr<BR>
<STRONG>Technical Editor:</STRONG> Heather Stern<BR>
<STRONG>Senior Contributing Editor:</STRONG> Jim Dennis<BR>
<STRONG>Contributing Editors:</STRONG>
Ben Okopnik, Dan Wilder, Don Marti
</BLOCKQUOTE>
<HR NOSHADE>
<!--=================================================================-->
<A HREF="TWDT.txt.gz">TWDT 1 (gzipped text file)</A><BR>
<A HREF="TWDT.html">TWDT 2 (HTML file)</A><BR>
are files containing the entire issue: one in text format, one in HTML.
They are provided
strictly as a way to save the contents as one file for later printing in
the format of your choice;
there is no guarantee of working links in the HTML version.
<HR NOSHADE>
<!--=================================================================-->
<center>
<I>Linux Gazette</I><img alt="[tm]" src="../gx/tm.gif">,
<A HREF="http://www.linuxgazette.com/">http://www.linuxgazette.com/</A><BR>
This page maintained by the Editor of <I>Linux Gazette</I>,
<A HREF="mailto: gazette@ssc.com"> gazette@ssc.com</A>
<P>
<H5>Copyright &copy; 1996-2003 Specialized Systems Consultants, Inc.</H5>
</center>
<HR NOSHADE>
<!--=================================================================-->
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD>
<center>
<BIG><BIG><STRONG><FONT COLOR="maroon">The Mailbag</FONT></STRONG></BIG></BIG><BR>
<!-- BEGIN wanted -->
<STRONG>From <A HREF="mailto:gazette@ssc.com">The Readers of <i>Linux Gazette</I></A></STRONG></BIG>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<HR>
<center>
<BIG><STRONG><FONT COLOR="maroon">HELP WANTED : Article Ideas</FONT></STRONG></BIG>
<BR>
<STRONG>Submit comments about articles, or articles themselves (after reading <a href="../faq/author.html">our guidelines</a>) to <A HREF="mailto:gazette@ssc.com">The Editors of <i>Linux Gazette</I></A>, and technical answers and tips about Linux to <A HREF="mailto:linux-questions-only@ssc.com">The Answer Gang</A>.
</STRONG>
</center><HR>
<UL>
<!-- index_text begins -->
<li><A HREF="#wanted.1"
><strong>Linux aol dial-up</strong></a>
<li><A HREF="#wanted.2"
><strong>Linux Infrared</strong></a>
<li><A HREF="#wanted.3"
><strong>On a slower computer...</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted.1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Linux aol dial-up</FONT></H3>
Thu, 17 Apr 2003 10:45:48 -0400
<BR>Narendra Shah (<a href="mailto:linux-questions-only@ssc.com?cc=nss99@hotmail.com&subject=%20Re%3A%20%5BLG%2090%5D%20help%20wanted%20%231">nss99 from hotmail.com</a>)
<P>
I have Peng client connect to AOL on RedHat 9.0. It connects to AOL
alright but my system doesn't recognise the active connection. For my
browser or gFTP clients do not connect to any http or ftp sites.
</P>
<P>
What do I have to do so that the system/n/w config understands the
active connection
</P>
<P>
-Narendra
</P>
<blockquote><font color="#000066">Well folks, it's not a late edition of a Fool's Day joke ..
<a href="http://www.peng.apinc.org">Peng</a>
really is intended for letting people use their AOL dialup to get what
we'd consider more ordinary connectivity. Anyone out there
hitting the net this way? Let us know how you do it!
-- Heather</font></blockquote>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted.2"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Linux Infrared</FONT></H3>
Sun, 6 Apr 2003 18:25:21 +0530
<BR>Joydeep Bakshi (<a href="mailto:linux-questions-only@ssc.com?cc=joy12@vsnl.net&subject=%20Re%3A%20%5BLG%2090%5D%20help%20wanted%20%232">joy12 from vsnl.net</a>)
<P>
Hi all,
I am interested to make an infrared remote for linux. I have also visited the
LIRC webpage. if there is any body who has already build this remote please
tell me how it is working and a little bit about the circuit &amp; driver
,library etc u have used. please share ur experience with me.
</P>
<P>
If some one is using creative infrasuite remote (credit card size) , please
let me know. does it need the separate IR receiver or the inbuilt IR in the
CD Rom is enough ? I have the Panasonic Tv remote at home. so please let me
know too if there is any body using this remote with LIRC.
</P>
<P>
thanks in advanced.
</P>
<!-- sig -->
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted.3"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">On a slower computer...</FONT></H3>
Tue, 8 Apr 2003 01:17:51 -0500
<BR>Thomas (<a href="mailto:linux-questions-only@ssc.com?cc=tea@cyberscope.net&subject=%20Re%3A%20%5BLG%2090%5D%20help%20wanted%20%233">tea from cyberscope.net</a>)
<P>
Hello,
</P>
<P>
About 8.0 LInux installation either "stand alone"? or install with
windows on a pc. can you offer tips on installing it to a 75 mhz
computer. what of fdisk or other info format?
</P>
<P>
You may refer my request on to someone else in club as you desire.
Thank you,for you time.
</P>
<blockquote><font color="#000066">Now, small distros and distros-on-floppy we have by the dozens. But RH
8 compatible? Or kickstart floppies that chop out a bunch of that
memory hogging, CPU slogging stuff? An article on keeping your Linux
installers on a diet would be keen. Just in time for Summer, too.
-- Heather</font></blockquote>
<!-- end 3 -->
<HR>
<center>
<BIG><STRONG><FONT COLOR="maroon">GENERAL MAIL</FONT></STRONG></BIG>
<BR>
</center><HR>
<UL>
<!-- index_text begins -->
<li><A HREF="#mailbag.1"
></a>Re: LG #89, Perl One-Liner --or--
<br><A HREF="#mailbag.1"
><strong>A Walk through Frink's Confusion</strong></a>
<li><A HREF="#mailbag.2"
><strong>Cloning workstations article</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag.1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">A Walk through Frink's Confusion</FONT></H3>
Wed, 2 Apr 2003 17:38:01 -0800 (PST)
<BR>Ben Okopnik (<a href="mailto:gazette@ssc.com?subject=%20Re%3A%20%5BLG%2090%5D%20mailbag%20%231">the <em>LG</em> Answer Gang</a>)
<BR>Question by Brad Chapman (jabiru_croc from yahoo.com)
<!-- ::
A Walk through Frink's Confusion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
I don't understand why this:
</STRONG></P>
<pre><strong>x=`echo -e "\240"`;mkdir $x;echo "hostname -f"&gt;$x/perl;chmod +x $x/perl;export PATH=$x:$PATH;clear
</strong></pre>
<P><STRONG>
combined with this:
</STRONG></P>
<pre><strong>perl -we'fqdn'
</strong></pre>
<P><STRONG>
is considered an Easter Egg. How do you enter it into a bash prompt to
make it an Easter Egg?
</STRONG></P>
<P><STRONG>
Brad
</STRONG></P>
<P><STRONG>
*looks for riffles, JIC*
</STRONG></P>
<BLOCKQUOTE>
[Ben]
I don't understand your question. What Easter Egg? What the heck does
"enter it into a bash prompt" mean ("enter at the command line", maybe?)
</BLOCKQUOTE>
<P><STRONG>
That's what I meant. Woomert's command line looked as if it was meant to
be entered directly into a shell prompt. Is it meant to be entered some
other way?
</STRONG></P>
<BLOCKQUOTE>
[Ben]
Ah, OK. Yes, it's meant to be entered at the shell prompt.
</BLOCKQUOTE>
<BLOCKQUOTE>
What did you try? What results did you get? What did you expect to see
instead? Give me some info to go on, and I might be able to help you -
if I can get an idea of what you're asking for.
</BLOCKQUOTE>
<P><STRONG>
I tried entering the x=&quot; line, then calling perl -we'fqdn' to see the output.
That worked.
</STRONG></P>
<BLOCKQUOTE>
[Ben]
&lt;grin&gt; Except... it didn't. There's no such function as "fqdn" in Perl;
it's just a random string that I munged up, an abbrvtn for "fully
qualified domain name."
</BLOCKQUOTE>
<P><STRONG>
What I was expecting was something which made perl stop working
or something which would munge my command line.
</STRONG></P>
<BLOCKQUOTE>
[Ben]
That's exactly what you've got: Perl is now "broken". No matter how you
invoke it, it will now type the FQDN.
</BLOCKQUOTE>
<P><STRONG>
I have an idea on what this is meant to do, though:
</STRONG></P>
<pre><strong>x=`echo -e "\240"`;mkdir $x;echo "hostname -f"&gt;$x/perl;chmod +x $x/perl;export PATH=$x:$PATH;clear
</strong></pre>
<pre><strong>echo -e "\240" : ASCII code 240
mkdir $x : create a directory with name $x
</strong></pre>
<BLOCKQUOTE>
[Ben]
Well, with the content of $x - which is an "invisible" ASCII character
(at least with the default LOCALE), easy to miss when you do an "ls".
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<BLOCKQUOTE>
[Jason]
Hmmm....my 'ls' shows the escape character. ("\240") That's becasue the '-b'
(show escape characters) is in $LS_OPTIONS, which is used in my 'ls' alias.
That's pretty neat, but I find a backspace character has more intersting
effects:
</BLOCKQUOTE>
<blockquote><pre>~/tmp$ x=$(echo -e '\b')
~/tmp$ mkdir $x
~/tmp$ touch $x/lala
~/tmp$ ls
\b/
~/tmp$ cd ^H/
~/tmp$ ls
lala
~/tmp$ cd ..
~/tmp$
</pre></blockquote>
<BLOCKQUOTE>
It makes it look like you don't even change directory! And the output of the
'ls' command is, of course, given the -b options via my alias. Normally, (my
version of) ls outputs a '?' when there's an unprintable character.
</BLOCKQUOTE>
<pre><strong>echo "hostname -f"&gt;$x/perl : echo the hostname into a file named perl in $x
</strong></pre>
<BLOCKQUOTE>
[Ben]
Nope. Echo <EM>the string</EM> "hostname -f" into that file.
</BLOCKQUOTE>
<pre><strong>chmod +x $x/perl : make the perl file executable
</strong></pre>
<BLOCKQUOTE>
[Ben]
Thus making it an executable shell script which runs "hostname -f".
</BLOCKQUOTE>
<pre><strong>export PATH=$x:PATH;clear : adds $x to the $PATH
</strong></pre>
<BLOCKQUOTE>
[Ben]
Much more importantly, putting $x <EM>at the front</EM> of the PATH - meaning
that the executables in there will get run instead of the others. When
you type "perl", the actual Perl binary never gets executed: the shell
script is now the first "perl" in the path!
</BLOCKQUOTE>
<P><STRONG>
Is this Easter Egg supposed to make perl act strange?
</STRONG></P>
<BLOCKQUOTE>
[Ben]
It's not an "Easter Egg"; that term has a specific meaning (hidden
feature that does something cute when you run it, like the maze in MS
Excel, a mini-version of a Doom-like game in Word some years ago, etc.)
That's what had me confused. It's a hack (not a software hack, either;
Woomert just hacked Frink's naivete, too easy of a target by half.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<BLOCKQUOTE>
As to what it does - it makes Perl go away.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> Until Frink finds the
problem and fixes it (possibly by logging out, closing that xterm, or
rebooting), invoking "perl" will do nothing more than print the FQDN.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Jason]
Only in UNIX can you do so much interesting stuff with a few commands. A while
back I was playing with a script that would, when run, print
</BLOCKQUOTE>
<blockquote><pre>rm -rf /home/username.....12345K deleted
</pre></blockquote>
<BLOCKQUOTE>
where username is your username and 12345K is however much stuff you have in
your home directory. The disk churning sounds would be 'du' running to figure
out how much stuff in your home directory there was. Then the tricky bit was
that the script would add some commands to your .bashrc, which changes $HOME
to <TT>/tmp/$RANDOM</TT> and cds to that directory, so when the user logs in again he
thinks all his files are gone. I thought about uuencoding it and posting it to
the TAG on April 1st, but decided not to.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
Oh, <EM>massively</EM> cute! You should, of course, set the command prompt to
show that the user is still in his home directory...
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">))
</BLOCKQUOTE>
<BLOCKQUOTE>
[Jason]
That's what setting $HOME does.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
Oh, I meant an explicit "<TT>/home/joe</TT>" rather than "~", but you're right -
that's even better.
</BLOCKQUOTE>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag.2"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Cloning workstations article</FONT></H3>
Wed, 30 Apr 2003 17:06:28 +0200
<BR>Dirk Schouten (<a href="mailto:gazette@ssc.com?subject=%20Re%3A%20%5BLG%2090%5D%20mailbag%20%232">schoutdi from knoware.nl</a>)
<P><STRONG>
Esteemed editor,
</STRONG></P>
<P><STRONG>
In your April issue of Linxu Gazette there is an an article on
<A HREF="../issue89/ward.html">Cloning Workstations with Linux</A> by Mr. Alan Ward.
An article that starts with:
</STRONG></P>
<P><STRONG><BLOCKQuote>
"Anybody who has had to install a park of 10 - 100 workstations with
exactly the same operating system and programs will have wondered if ...etc"
is able to raise my curiousity.
</BLOCKQuote></STRONG></P>
<P><STRONG><DL><DT>
To my surprise 'Ghost for Unix' was not mentioned by the author.
<DD><A HREF="http://www.feyrer.de/g4u"
>http://www.feyrer.de/g4u</A>
</DL></STRONG></P>
<P><STRONG>
IMHO the best solution for a hundred or so workstations.
</STRONG></P>
<P><STRONG>
Kind regards,
<BR>Dirk
</STRONG></P>
<P>
Please note that g4u is based on BSD, not Linux.
The techniques used are, however, very similar.
</P>
<P>
Best regards,
<BR>Alan Ward
</P>
<!-- end 2 -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
<h5>This page edited and maintained by the Editors of <I>Linux Gazette</I><br>HTML script maintained by <A HREF="mailto:star@starshine.org">Heather Stern</a> of Starshine Technical Services, <A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
<br>Copyright &copy; 2003
<br>Copying license <A HREF="http://www.linuxgazette.com/copying.html">http://www.linuxgazette.com/copying.html</A>
<BR>Published in Issue 90 of <i>Linux Gazette</i>, May 2003</H5>
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD>
<center>
<BIG><BIG><STRONG><FONT COLOR="maroon">More 2&cent; Tips!</FONT></STRONG></BIG></BIG><BR>
<!-- BEGIN tips -->
<STRONG>By <A HREF="mailto:linux-questions-only@ssc.com">The Readers of <i>Linux Gazette</I></A></STRONG></BIG>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<center><STRONG>See also: The Answer Gang's
<a href="../tag/kb.html">Knowledge Base</a>
and the <i>LG</i>
<a href="http://www.linuxgazette.com/search.html">Search Engine</a></STRONG>
</center><HR>
<UL>
<!-- index_text begins -->
<li><A HREF="#tips.1"
><strong>linux baby clothes?</strong></a>
<li><A HREF="#tips.2"
><strong>bookmark conversion</strong></a>
<li><A HREF="#tips.3"
><strong>Cups</strong></a>
<li><A HREF="#tips.4"
><strong>DOS functions in Linux' gcc?</strong></a>
<li><A HREF="#tips.5"
><strong>Internet by call in USA?</strong></a>
<li><A HREF="#tips.6"
><strong>[GL] nis problem</strong></a>
<li><A HREF="#tips.7"
><strong>Pctel hsp micromodem 56 config.........RedHat 8.0</strong></a>
<li><A HREF="#tips.8"
><strong>Debian upgrade howto</strong></a>
<li><A HREF="#tips.9"
><strong>more verbose and useful assert()</strong></a>
<li><A HREF="#tips.10"
><strong>carrier errors</strong></a>
<li><A HREF="#tips.11"
><strong>architecture</strong></a>
<li><A HREF="#tips.12"
><strong>floppy woes</strong></a>
<li><A HREF="#tips.13"
><strong>firewalls</strong></a>
<li><A HREF="#tips.14"
><strong>Internet Cafe ?</strong></a>
<li><A HREF="#tips.15"
><strong>Making IPTABLES complain...</strong></a>
<li><A HREF="#tips.16"
><strong>iso</strong></a>
<li><A HREF="#tips.17"
><strong>mcrypt</strong></a>
<li><A HREF="#tips.18"
><strong>how to config a modem to received call</strong></a>
<li><A HREF="#tips.19"
><strong>mounting cd</strong></a>
<li><A HREF="#tips.20"
><strong>linux S/W ? for movies</strong></a>
<li><A HREF="#tips.21"
><strong>mouse driver, rather not</strong></a>
<li><A HREF="#tips.22"
><strong>root like permissions</strong></a>
<li><A HREF="#tips.23"
><strong>UPS Problems..</strong></a>
<li><A HREF="#tips.24"
><strong>To find out what's in an RPM</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">linux baby clothes?</FONT></H3>
Tue, 8 Apr 2003 12:40:53 +0200
<BR>Robos (<a href="mailto:linux-questions-only@ssc.com?cc=koopzy@optushome.com.au&cc=robos@muon.de&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%231">the <em>LG</em> Answer Gang</a>)
<BR>Question by J.Cooper (koopzy from optushome.com.au)
<P><STRONG>
gday - how'd it go with the inquiry about Linux baby clothes?
</STRONG></P>
<P><STRONG>
<a href="../issue67/lg_mail67.html#wanted/5">Help Wanted #5, Issue 67</a>
</STRONG></P>
<blockquote><DL><DT>
How about this one here:
<DD><A HREF="http://www.thinkgeek.com/tshirts/kids"
>http://www.thinkgeek.com/tshirts/kids</A>
</DL></blockquote>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.2"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">bookmark conversion</FONT></H3>
Tue, 08 Apr 2003 11:03:48 +0300
<BR>Miron Brezuleanu (<a href="mailto:linux-questions-only@ssc.com?cc=mbrezu@home.ro&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%232">mbrezu from home.ro</a>)
<P>
Hi,
</P>
<P>
I have a www browser bookmark conversion problem (and a partial answer
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> ). I'm currently using Opera as a browser but I wanted to also use
Konqueror. As always, there is an issue with the bookmarks: it's
difficult to "port" them. After one hour of groping and hacking I
managed to write a little script that does the opera-&gt;konqueror port.
But it is ugly and it doesn't work in the other direction.
</P>
<P>
Do you know of such bookmark converting apps/scripts (on linux!)?
Konqueror (in kde 3.0) seems to know how to import/export bookmarks to
netscape and mozilla, but not more.
</P>
<P>
I hope this qualifies as a Linux question
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> . It's an all platform
issue, but that doesn't mean it's not linux, right ?
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</P>
<P>
I included my partial-answer-script. Maybe someone can use it
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> . I
don't really know perl, my script is probably very ugly but it worked
for me. It's a filter, you have to use redirection and then copy the
output file to the konqueror bookmark file.
</P>
<P>
Thanks,
<BR>Miron Brezuleanu
</P>
<p align="center">See attached <tt><a href="misc/tips/op2konq.pl">op2konq.pl</a></tt></p>
<BLOCKQUOTE>
[K.-H.]
Hmm... opera has some bookmark export variants too.
</BLOCKQUOTE>
<BLOCKQUOTE>
Like file-export-bookmarks_as_html looks like a very much universal export
format if you simply load that html page and klick on the bookmark you want.
</BLOCKQUOTE>
<BLOCKQUOTE>
As I remember netscape bookmarks are a simple html layout as well which you
can directly load as an html-page.
</BLOCKQUOTE>
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.3"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Cups</FONT></H3>
Wed, 9 Apr 2003 12:33:11 -0700
<BR>Rick Moen (<a href="mailto:linux-questions-only@ssc.com?cc=leonc@workforce.co.za&cc=rick@linuxmafia.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%233">the <em>LG</em> Answer Gang</a>)
<BR>Question by Leon Coertzen (leonc from workforce.co.za)
<P><STRONG>
This is a multi-part message in MIME format.
</STRONG></P>
<P><STRONG>
------=_NextPart_000_0030_01C2FDD5.E597FE00
Content-Type: text/plain;
</STRONG></P>
<P><STRONG>
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
</STRONG></P>
<P>
I'm sure you're unaware of this, but you sent your message
with extraneous MIME headers like the foregoing, and with your entire
message printed a second time in HTML. Please change your mailer's
settings to stop it from doing this. Instructions are here:
<A HREF="http://expita.com/nomime.html#outlook5"
>http://expita.com/nomime.html#outlook5</A>
</P>
<P>
For more information, please see
(<A HREF="../tag/ask-the-gang.html#non_text"
>http://www.linuxgazette.com/tag/ask-the-gang.html#non_text</A>)
</P>
<blockquote><font color="#000066">Normally I leave this part out. However, since I note that Rick has had
to utter this little macro an awful lot of times this month, I figured
I'd help a few souls out there by seeing it get mentioned. The answer
in this case is tiny - so this brings it up to a whole Two Cents worth
:D
-- Heather</font></blockquote>
<P><STRONG>
How do you set printing priorities with cups?
</STRONG></P>
<P><CODE>
Using the -p option:
</CODE></P>
<P><CODE>
$ /usr/bin/lp -d LaserJet -p 90 foo
</CODE></P>
<P>
...gives the job of printing file foo a priority of 90 out of 100.
Default priority level is 50.
</P>
<!-- end 3 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.4"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">DOS functions in Linux' gcc?</FONT></H3>
Wed, 23 Apr 2003 21:50:38 +0100
<BR>Jimmy O'Regan (<a href="mailto:linux-questions-only@ssc.com?cc=sarifali_007@rediffmail.com&cc=jimregan@o2.ie&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%234">the <em>LG</em> Answer Gang</a>)
<BR>Question by Arif Ali Saiyed (sarifali_007 from rediffmail.com)
<P><STRONG>
Respected sir/ madam ,
</STRONG></P>
<P><STRONG>
can i use execute interrupt 11h and 13 h as i
can use in TURBO C using int86 function , plz give some
inforamtion or notes how to do that in linux using gcc
thanking you in advance
</STRONG></P>
<P>
I'm not sure if it's possible in the same way it is in DOS, but it's
definitely not the done thing. Wine (<A HREF="http://www.winehq.com"
>http://www.winehq.com</A>) has code in
its DOS emulation dll, which you could probably use in a similar way.
Look in wine/msdos/ and wine/dlls/winedos
</P>
<P>
Int 11 is equipment check and 13 is disk services, right? For int 11,
you might try using Discover
(<A HREF="http://www.progeny.com/products/discover"
>http://www.progeny.com/products/discover</A>). For int 13, you'd need to
be more specific
</P>
<!-- sig -->
<!-- end 4 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.5"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Internet by call in USA?</FONT></H3>
Thu, 10 Apr 2003 12:39:55 +0200
<BR>Uwe Altmann (<a href="mailto:linux-questions-only@ssc.com?cc=matthi@gmx.li&cc=uwe.altmann@web.de&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%235">uwe.altmann from web.de</a>)
<BR>Question by matthi (matthi from gmx.li)
<blockquote><font color="#000066">In response to
<a href="http://www.linuxgazette.com/issue89/lg_mail.html#wanted.6">Help Wanted #6, Issue 89.</a>
-- Heather</font></blockquote>
<P>
Hi matthi
</P>
<P>
In US, visit the next public library - there are some PCs in every
public library with which you can access internet (and therefore via
webmailer your mail) for free.
Also, many Hotels/Motels have free web-access by LAN or, al least, an PC
with freee webaccess (motels with moderate prices too, afaik motel 8,
motel 6) - you can choose your accomodation by that.
</P>
<!-- end 5 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.6"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">[GL] nis problem</FONT></H3>
Wed, 23 Apr 2003 15:11:47 -0700
<BR>Dan Wilder (<a href="mailto:linux-questions-only@ssc.com&cc=dan@ssc.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%236">SSC sysadmin</a>)
<BR>Question by glue-list (<a href="http://www.ssc.com:8080/glue/">http://www.ssc.com:8080/glue/</a>)
<blockquote><font color="#000066">The author here - a member of the GLUE list, contacts for "Groups of
Linux Users Everywhere" - was really hoping he was wrong, but this is how the
dreaded YP stuff really works. A tip for all who have to deal with NIS.
-- Heather</font></blockquote>
<P><STRONG>
1) I search various web-sites, but I cann't find this.my nis-server and
nis-client works properly. ypbind at client detects the nis-server also.
yp.conf,network files all r fully configured in client and server both.
"ypcat passwd" also displays the user info in both client &amp; server. But when
I create any new user at nis-server,I can get user-info by running "ypcat
passwd" only when then I execute make command in <TT>/var/yp</TT> or "ypinit -m" in
<TT>/lib/usr/yp</TT> folder AGAIN.I want to know that IS it Required to execute MAKE
COMMAND AGAIN &amp; AGAIN When any New User Created ?
</STRONG></P>
<P>
In a word, yes.
</P>
<!-- end 6 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.7"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Pctel hsp micromodem 56 config.........RedHat 8.0</FONT></H3>
22 Apr 2003 23:26:58 +0530
<BR>Kapil Hari Paranjape (<a href="mailto:linux-questions-only@ssc.com?cc=vivek_ravindranath@softhome.net&cc=kapil@imsc.res.in&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%237">the <em>LG</em> Answer Gang</a>)
<BR>Question by Vivek Ravindranath (vivek_ravindranath from softhome.net)
<P><STRONG>
Hi there,
</STRONG></P>
<P><STRONG>
I wonder if this would be useful to some of you out there.I had
some problems configuring my Pctel PCI modem.After a lot of searching I
found a driver at linmodems.org.The compilation went on perfectly but
when I tried to load the modules with insmod I could not load the
modules and it would display that the module is compiled with GCC 3 and
hence cannot be loaded.
</STRONG></P>
<BLOCKQUOTE>
[Kapil]
Thanks for your hints ...
</BLOCKQUOTE>
<BLOCKQUOTE>
Note that many distro kernels are compiled with gcc 2.95 (in fact I
don't believe I have successfully compiled a kernel with gcc &gt;= 3.0).
</BLOCKQUOTE>
<BLOCKQUOTE>
Thus a possibly better solution is to install gcc-2.95 and compile kernel
modules using that.
</BLOCKQUOTE>
<BLOCKQUOTE>
An alternative is to re-compile your kernel with gcc 3 and then you can
use modules compiled with gcc 3 as well.
</BLOCKQUOTE>
<P><STRONG>
If you are facing the same problem do this....
</STRONG></P>
<P><STRONG>
1.At the console type
</STRONG></P>
<pre><strong>insmod -f pctel
insmod -f ptserial
</strong></pre>
<P><STRONG>
(instructions on installing the modules can be found
in the readme file found with the package).
(If you are using the same tarball from linmodems.org
i.e.,pctel-0.9.6.tar.gz you have to type commands as it is).
You will see some messages but it does not matter much.
</STRONG></P>
<BLOCKQUOTE>
[Kapil]
Generally speaking, I would do an "insmod -f" only if I was in a hurry
or if I couldn't even boot-to-fix witout it. But it should never be
allowed to be a "permanent" solution.
</BLOCKQUOTE>
<P><STRONG>
2.If you are using KPPP to connect to the internet do this.....
create a new connection,fill in the connection details and other things.
Then go to the modem tab and click on modem commands.In the section
named initialization string 2 give the following "AT&amp;FX1&amp;C1" and press
ok.
</STRONG></P>
<P><STRONG>
3.Instead of loading the modules each time the above given commands you
create a script which you can execute before starting kppp.
I can't assure that it is going to work,but you might as well give it a try.
</STRONG></P>
<P><STRONG>
Hope this will help.
Vivek.
</STRONG></P>
<BLOCKQUOTE>
[Kapil]
Me too.
</BLOCKQUOTE>
<!-- end 7 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.8"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Debian upgrade howto</FONT></H3>
Sun, 13 Apr 2003 01:47:20 -0700
<BR>Rick Moen (<a href="mailto:linux-questions-only@ssc.com?cc=arjun2@hotpop.com&cc=rick@linuxmafia.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%238">the <em>LG</em> Answer Gang</a>)
<BR>Question by ARJUN (arjun2 from hotpop.com)
<P><STRONG>
how to upgrade the existing debian version without reinstalling ?
(for an ex. potato to woody)
</STRONG></P>
<P>
<A HREF="http://www.debian.org/">Debian</A>'s built-in upgrade process is controlled by the
<TT>/etc/apt/sources.list</TT> file and by the apt-get package-retrieval utility.
sources.list specifies where to look for new packages (Web or ftp sites,
CD-ROMs, hard drive directories, etc.), and apt-get fetches both
available-package catalogues and the packages themselves. Your
sources.list probably looks like this:
</P>
<code>deb <A HREF="http://http.us.debian.org/debian"
>http://http.us.debian.org/debian</A> stable main non-free contrib
<br>deb <A HREF="http://non-us.debian.org/debian-non-US"
>http://non-us.debian.org/debian-non-US</A> stable/non-US main contrib non-free
<br>deb <A HREF="http://security.debian.org"
>http://security.debian.org</A> stable/updates main contrib non-free
</code>
<P>
Notice the word "stable". At the time you installed Debian, "stable"
referred to 2.2/potato. These days, "stable" has progressed to
3.0/woody: The alias name "oldstable" can still be used to refer to
potato, or you can just use the name potato.
</P>
<P>
That is, <EM>if</EM> the machine you're talking about has Internet access, you
can upgrade in two stages, like this.
</P>
<P>
1. Edit sources.list to refer to "potato" by name:
</P>
<code>deb <A HREF="http://http.us.debian.org/debian"
>http://http.us.debian.org/debian</A> potato main non-free contrib
<br>deb <A HREF="http://non-us.debian.org/debian-non-US"
>http://non-us.debian.org/debian-non-US</A> potato/non-US main contrib non-free
<br>deb <A HREF="http://security.debian.org"
>http://security.debian.org</A> potato/updates main contrib non-free
</code>
<P>
As root, retrieve the latest available-packages list for potato:
</P>
<P><CODE>
# apt-get update
</CODE></P>
<P>
Now, upgrade all installed packages to the latest for the potato series:
</P>
<P><CODE>
# apt-get dist-upgrade
</CODE></P>
<P>
2. Re-edit sources.list to refer to "stable" (which is now 3.0/woody):
</P>
<P><BLOCKQuote>
deb <A HREF="http://http.us.debian.org/debian"
>http://http.us.debian.org/debian</A> stable main non-free contrib
deb <A HREF="http://non-us.debian.org/debian-non-US"
>http://non-us.debian.org/debian-non-US</A> stable/non-US main contrib non-free
deb <A HREF="http://security.debian.org"
>http://security.debian.org</A> stable/updates main contrib non-free
</BLOCKQuote></P>
<P><CODE>
# apt-get update
<BR># apt-get dist-upgrade
</CODE></P>
<P>
The point of doing the upgrade in two stages is to avoid introducing
dramatic version differences, all at once.
</P>
<P>
However, it may be that pulling down a hundred or so packages from the
<EM>Internet</EM> isn't practical. If so, you can acquire a set of Official
Debian 3.0r1 CD-ROMs. The full set is 7 CDs. (You don't need to get
all seven, if you don't want to.) To register them in sources.list,
first comment out any existing "deb" lines in that file, and then run
the apt-cdrom utility once for each CD. Then:
</P>
<P><CODE>
# apt-get update
<BR># apt-get dist-upgrade
</CODE></P>
<P>
That's just about all there is to it. Make sure you take note of any
warnings or advisories shown to you during the upgrade process.
</P>
<HR width="10%" align="center"><P><STRONG>
I was looking for this a long. and U have given me the solution.
I know that "thanks a lot" is not enough. any how wish u my best wishes -
<IMG SRC="../gx/dennis/smily.gif" ALT=";)"
height="24" width="20" align="middle">))
</STRONG></P>
<!-- end 8 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.9"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">more verbose and useful assert()</FONT></H3>
Sun, 6 Apr 2003 12:32:02 -0700 (PDT)
<BR>Mike Sharov (<a href="mailto:linux-questions-only@ssc.com?cc=msharov@talentg.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%239">msharov from talentg.com</a>)
<P>
In reference to the <TT> assert()</TT> macro that good
programmers use to catch bugs that should be fixed before
the user sees them -
</P>
<P>
Unfortunately, when a programmer debugs
somebody else's code, an assert failure may be rather
difficult to interpret. What does assert(p == NULL); failure
mean? You will not know until you look at the source code at
that point and try to understand what's going on. But what
if the assert was changed to:
</P>
<blockquote><pre>assert (p == NULL &amp;&amp; "Please deallocate your GC handle before allocating a new one");
</pre></blockquote>
<P>
Now the programmer can read the message, which will be printed
along with the rest of the stuff in the assert, smack himself
on the forehead and shout "doh. I know where the problem is!"
The assert works because the string pointer is always non-zero
and if p == NULL, will not cause the assert to fail.
</P>
<P>
This seems pretty obvious, now that I have figured it out, but
I have never seen this technique used in any piece of code. The
effect can be achieved by using a custom assert library, but why
introduce a dependency when you don't have to?
</P>
<P><STRONG>
[Jimmy O'Regan]
Would it not be better to use
</STRONG></P>
<pre><strong>if (!assert (p == NULL))
fprintf (stderr, "Please deallocate your GC handle before allocating a new one");
</strong></pre>
<BLOCKQUOTE>
[Didier Heyden]
Nope; <TT> assert()</TT> actually aborts the program if its argument is 'false.'
This means that your own message would never be printed, even if the 'p'
variable were NULL. Instead, you'd see something like:
</BLOCKQUOTE>
<blockquote><pre>PROGNAME: SOURCE.c:31415: FUNCTION: Assertion `p == NULL' failed.
Aborted
</pre></blockquote>
<BLOCKQUOTE>
then the program would terminate (and possibly dump core).
</BLOCKQUOTE>
<BLOCKQUOTE>
OTOH, with Mike's method you'd get a message similar to:
</BLOCKQUOTE>
<blockquote><pre>PROGNAME: SOURCE.c:27182: FUNCTION: Assertion `p == NULL &amp;&amp;
"Please deallocate your GC handle..."' failed.
Aborted
</pre></blockquote>
<BLOCKQUOTE>
The reason his solution works is that a string constant in C (even
an "empty" one) always evaluates as a 'true' condition (a non-null
memory reference indeed).
</BLOCKQUOTE>
<BLOCKQUOTE>
Another advantage of sticking with "simple" <TT> assert()</TT> macro calls is
that you can disable all of them at once, merely by #defining the
NDEBUG macro at compilation time. In that case, all <TT> assert()</TT>
instructions will expand to nothing at all.
</BLOCKQUOTE>
<P><STRONG>
[Jimmy]
(or similar, apologies for my rusty C)
</STRONG></P>
<BLOCKQUOTE>
[Didier]
Naaah.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> I wish I could remember the specific syntactical issues of
my own rusty programming languages as precisely as you do. Expect my
over-volatile memory to bring back sooner or later awful games of 2^^7
errors such as
</BLOCKQUOTE>
<blockquote><pre>#/usr/bin/perl -W
using strict;
my despair = {'Why', 'the heck', 'doesn't this', 'work'}
for each (@cry in $despair) { echo @cry, " (sob) " }
</pre></blockquote>
<BLOCKQUOTE>
(Don't laugh: it's based on countless true stories).
</BLOCKQUOTE>
<!-- end 9 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.10"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">carrier errors</FONT></H3>
Wed, 23 Apr 2003 12:28:18 -0400
<BR>Kapil Hari Paranjape (<a href="mailto:linux-questions-only@ssc.com?cc=kuhman@myrealbox.com&cc=kapil@imsc.res.in&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2310">the <em>LG</em> Answer Gang</a>)
<BR>Question by Harry (kuhman from myrealbox.com)
<P><STRONG>
I came across your "Answer guy" site while searching for info
on ifconfig errors. Unfortunately, it did not help with my
problem, but since you provide an e-mail link, I'm not too
proud to ask.
</STRONG></P>
<P><STRONG>
The question I'm trying to understand is "what are "carrier"
errors. I'm getting "carrier" errors on 100% of my my TX packets
and can't connect to the rest of the network, but the man pages
for ifconfig don't tell me what the errors are and I'm at a loss
so far to find information on this.
</STRONG></P>
<BLOCKQUOTE>
Carrier errors is jargonese for Cable fault. Please check the cable you
are using (try a different one if you have one). Of course it could also
be a loose contact problem.
</BLOCKQUOTE>
<BLOCKQUOTE>
Carrier = Signal Carrier = standing wave on which signals are
transmitted using "modulation". That's about as much as I remember from
by College course in Electronics.
</BLOCKQUOTE>
<P><STRONG>
The complete problem is that I'm running both WinXP and Linux
(Knoppix booted from CD) on an HP notebook. Knoppix used to boot
and connect to the network fine, but now it has stopped working!
I'm running strictly from CD, no install or configuration
information on my system, just the normal Knoppix auto-
configuration that worked fine on the hardware before, yet now
for reasons unknown I get these carrier errors and can not
transmit anything on the network (sniffing the wire confirms
that nothing is going out). Obviously I can no longer get my
network settings with DHCP (which also used to work fine on
my local network for this computer), but I cannot manually
configure the card to work either. Do you have any insight to
what might cause this?
</STRONG></P>
<HR width="10%" align="center"><P><STRONG>
Thanks. Unfortunately, in this case the "carrier errors" are not cable
errors. Here are the details that confirm this:
</STRONG></P>
<P><STRONG><BLOCKQuote>
The hardware works 100% correctly under WinXP, including sniffing the
cable and seeing absolutely no errors in a large number of packets.
</BLOCKQuote></STRONG></P>
<P><STRONG>
The hardware used to work under Linux (Knoppix booted from CD) but
no longer does, even with the very same bootable CD. There are no
packets getting out onto the cable at all, again confirmed by sniffing
the cable.
</STRONG></P>
<P><STRONG>
A completely different cable was also used to route the notebook
computer to a separate hub where the packets could be watched by
another computer. Still no packets were on the wire.
</STRONG></P>
<BLOCKQUOTE>
I wrote earlier:
Carrier = Signal Carrier = standing wave ...
</BLOCKQUOTE>
<BLOCKQUOTE>
So at least I feel partially vindicated. There is no standing wave hence
no signal
<IMG SRC="../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<P><STRONG>
Apparently other Linux issues can manifest themselves as carrier errors,
but I have not yet been able to determine what counts as a carrier error
in Linux.
</STRONG></P>
<BLOCKQUOTE>
Let's apply Occam's razor here based on the fact the "it used to work
with the same Knoppix CD". What could have changed?
</BLOCKQUOTE>
<blockQuote><ol>
<LI>Not the CD. And hence not Linux or the software that comes with it.
<LI>Not the cable (this has been checked by you).
<LI>Not the hardware (it works under that other OS so its not critically
damaged).
</ol></blockQuote>
<BLOCKQUOTE>
Thus the problem has to be with the remaining "soft" component. That is
BIOS/flash settings. Some Network cards store some settings. You could
examine these settings using the <a href="http://www.scyld.com/diag/">mii-tools</a>.
Additionally, check whether
you have made some changes to the BIOS.
</BLOCKQUOTE>
<HR width="10%" align="center"><P><STRONG>
I just wanted to give you some feedback. Thanks very much for the reference
to mii-rtools, it really helped. It looks almost certain at this point that
Microsoft's "security updates" are changing NIC configuration eeproms. And,
of course, Microsoft knows not to use the bad configuration and works fine
with the change, but another OS like Linux that trusts that the configuration
in the eeprom is what the manufacturer or user wants fails. I've found
several other users that have been trying to figure out what happened, why
their CD used to work fine but now fails on the same system. We all accepted
Microsoft "security updates". We are now trying to get a test done with
some networking tools that can watch the content of the eeprom and catch
when it changes, so I expect to have evidence to support this soon.
</STRONG></P>
<blockquote><font color="#000066">I'm pretty sure it can - I know a
dyed-in-the-wool linuxer who currently
has to consider his happy little Orinoco family wireless pcmcia card a piece
of junk because a "helpful" Microsoft update has put it into a state
that Linux and BSD tools don't seem to be able to get it out of. Of
<EM>course</EM> it works fone in the other OS. Grrr.
-- Heather</font></blockquote>
<!-- end 10 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.11"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">architecture</FONT></H3>
Wed, 9 Apr 2003 10:51:11 -0700
<BR>Rick Moen (<a href="mailto:linux-questions-only@ssc.com?cc=rick@linuxmafia.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2311">the <em>LG</em> Answer Gang</a>)
<P><STRONG>
I have seen that different linux architecture are present based on different
processor architecture. like i386, i586, i686 etc. what are these &amp; how to
know the architecture of my processor ?
</STRONG></P>
<P>
JK, Linux provides an excellent facility for this sort of thing, in the
form of <TT>/proc/cpuinfo.</TT> Here's the one from the server I'm mailing this
from:
</P>
<blockquote><font color="#000066">For those ignorant of or who simply are happy to avoid the text editor
vi (or its friendlier cousin vim) :r is a command which, when issued
from command mode, will read what comes after it. :r! runs a command,
which can be nice for inhaling man page fragments, too. Making this a
Three Cent Tip...
-- Heather</font></blockquote>
<blockquote><pre>:r /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Pentium III (Katmai)
stepping : 2
cpu MHz : 498.755
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips : 996.14
</pre></blockquote>
<P>
There. More than you really wanted to know about the host's CPU. Of
course, the above gives information about the <EM>hardware</EM>. The machine's
kernel may or may not have been compiled with appropriate optimistions,
though that will generally be included in the output of uname -r (kernel
release).
</P>
<BLOCKQUOTE>
[Pradeep]
i386, i586, i686 are different kind of processor architectures developed
by intel. The following link has some info about this:
<A HREF="http://www.rebourne.org/chiparch.htm"
>http://www.rebourne.org/chiparch.htm</A>
</BLOCKQUOTE>
<blockquote><font color="#000066">In the terminology of the hardware hackers, these are considered the same
architecture (32 bit Intel, "i386" if you're looking in the kernel source
tree). There are a few optimizations, but the <EM>way</EM> they think is similar.
Contrast a Sparc, a Strongarm (found in many handhelds), or even Intel's
own ia64 ("Itanium" if you prefer them by name).
-- Heather</font></blockquote>
<!-- end 11 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.12"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">floppy woes</FONT></H3>
Mon, 14 Apr 2003 08:11:21 +0530
<BR>Kapil Hari Paranjape (<a href="mailto:linux-questions-only@ssc.com?cc=ursacava@mindspring.com&cc=kapil@imsc.res.in&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2312">the <em>LG</em> Answer Gang</a>)
<BR>Question by Ronald Russell (ursacava from mindspring.com)
<P><STRONG>
I'm running <A HREF="http://www.suse.com/">SuSE</A> 7.1 and Win98 on separate hard drives in a 900 Mhz Celeron
machine. Things were working fine until recently, when I could no longer
access my floppy while in SuSE. The same drive reads and writes perfectly in
Win98. When attempting to mount the floppy either by clicking the desktop
icon, or by typing the command in the terminal, I receive the error
'<TT>/dev/fd0</TT> is not a block device'.
What could have happened to cause this, and what can I do to repair it?
</STRONG></P>
<P>
Some possibilities suggest themselves.
</P>
<blockQuote><ol>
<LI>The device node is not properly created. Run '<tt>ls -l /dev/fd0</tt>' and
check.
<LI>You have a modular floppy driver which is not loaded. Run
'<tt>/sbin/lsmod</tt>' to check whether the driver is loaded.
</ol></blockQuote>
<BLOCKQUOTE>
[Didier Heyden]
A third possibility is that your floppy disks and/or drive are actually
defective. A '<tt>mount</tt>' command issued on <TT>/dev/fd0</TT> (assuming that this block
device file and the kernel modules are all set up properly) will first
try to access the disk's boot sector. If <EM>any</EM> I/O error occurs then,
the 'mount' will fail with the error message you mention.
</BLOCKQUOTE>
<BLOCKQUOTE>
Take a look at the system log files (usually <TT>/var/log/messages</TT>, but you
can also use the 'dmesg' command). Check whether errors like
</BLOCKQUOTE>
<BLOCKQUOTE><code>
[...] kernel: end_request: I/O error, dev 02:00 (floppy), sector 0
</code></BLOCKQUOTE>
<BLOCKQUOTE>
are present; if so, try to mount a few other floppy disks. If the system
keeps producing an error similar to the above, chances are that you
will have to replace your floppy drive very soon -- in particular if
the very same diskettes are correctly mounted and read on some other
(Linux) box.
</BLOCKQUOTE>
<BLOCKQUOTE>
There was a time when such a problem could be caused by a drive head
"misalignment", but I'm not sure it's still the case these days.
</BLOCKQUOTE>
<blockquote><font color="#000066">I think it can be; also, depending on your console setup, you might not
have to dig in the logs to see these complaints, as they might spew on
your console rather vocally.
</font></blockquote>
<blockquote><font color="#000066">First thing I'd check is whetehr there's a file in your /dev/ area that
used to be your floppy node, fd0 or any of the others starting with fd.
-- Heather</font></blockquote>
<BLOCKQUOTE>
I don't know much about WinXX, though I guess that that other OS either
does more retries before giving up or is too lax regarding sanity
checks prior to granting access to the user (I can't help favoring the
latter explanation).
</BLOCKQUOTE>
<!-- end 12 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.13"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">firewalls</FONT></H3>
Wed, 09 Apr 2003 17:52:39 +0200
<BR>Didier Heyden (<a href="mailto:linux-questions-only@ssc.com?cc=deepaselvaraju@yahoo.co.in&cc=fakir@teledisnet.be&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2313">the <em>LG</em> Answer Gang</a>)
<BR>Question by deepa lakshmi (deepaselvaraju from yahoo.co.in)
<P>
On Wed, 9 Apr 2003 13:48:45 +0100 (BST), deepa lakshmi wrote:
</P>
<P><STRONG>
hello
</STRONG></P>
<P>
Hi,
</P>
<P><STRONG>
i have a firewall machine .i also have a machine with ip 192.168.1.7
behind the firewall.
</STRONG></P>
<P><STRONG>
i added prerouting rules to forward incoming request to internal web
servers which are behind firewall.
</STRONG></P>
<P><STRONG>
now i want machine with ip 192.168.1.7 to have
internet access through firewall.
i have tried with this rules.but no resonse fron machine
rules are
</STRONG></P>
<pre><strong>-A POSTROUTING -o eth0 -j SNAT --to-source 202.54.100.54
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
</strong></pre>
<P><STRONG>
but it's not working.
</STRONG></P>
<P><DL><DT>
First, let me suggest to you to read carefully:
<DD><A HREF="../tag/ask-the-gang.html#doesnt_work"
>http://www.linuxgazette.com/tag/ask-the-gang.html#doesnt_work</A>
</DL></P>
<P>
before saying that. Since we have no means to guess what actually happens
on your system when you try the firewall rules you mention, you cannot
expect us to be able to provide much help in exchange for so little
information as you've given.
</P>
<P>
For example, is the above ruleset complete, or is it (as is more likely)
only a subset of the actual rules you're using? Are these rules accepted
at all when you enter them on the command line? What do the log files on
your firewall machine say? Did you try a packet sniffer such as "tcpdump"
or "ethereal" on its network interfaces? Did you make sure all required
kernel modules have been compiled, installed and are actually loaded?
Is "IPv4 forwarding" enabled? etc, etc.
</P>
<P>
I'm not an "iptables" expert myself, but I think the "-t &lt;table&gt;" option
is not an unimportant one.
</P>
<P>
Here's a precious resource about setting up a Netfilter/iptables
firewall. It covers pretty much everything (including source NAT and
masquerading) and has a number of useful examples:
</P>
<P><BLOCKQuote>
<A HREF="http://iptables-tutorial.frozentux.net/iptables-tutorial.html"
>http://iptables-tutorial.frozentux.net/iptables-tutorial.html</A>
</BLOCKQuote></P>
<P>
&lt;solemnly&gt;
Beware that in order to set up a firewall in the Right Way, you
must definitely know what you're doing. Help yourself. Googlesearch.
Read howtos, tutorials and examples; once you have understood them,
give them a try. Observe the results carefully. Then -- only then --
ask a <EM>precise</EM> question.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
&lt;/solemnly&gt;
</P>
<BLOCKQUOTE>
[Jason Creighton]
Well, a problem I see is that for the SNAT rule, you need to specify the
table, like this:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
-t nat -A POSTROUTING -o eth0 -j SNAT --to-source 202.54.100.54
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
All the NAT rules go in the (guess what?) "nat" table. The default table is
'filter', which is used when no table is specified.
</BLOCKQUOTE>
<!-- end 13 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.14"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Internet Cafe ?</FONT></H3>
Tue, 08 Apr 2003 20:54:43 +0100
<BR>Jimmy O'Regan (<a href="mailto:linux-questions-only@ssc.com?cc=wbannon@nadf.org&cc=jimregan@o2.ie&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2314">the <em>LG</em> Answer Gang</a>)
<BR>Question by Wally Bannon (wbannon from nadf.org)
<P>
Wally Bannon wrote:
</P>
<P><STRONG><BLOCKQuote>
I have a client who is Aboriginal here in Northern ontario looking to
set up a Internet Cafe. There are no location in the city of Thunder Bay.
Can you direct me to where I can get info on " how to set up or
establish an Internet Cafe"
This person is a youth age 25 who can access Gov't funding for
assistance to capitalize the project
</BLOCKQuote></STRONG></P>
<P>
If you want to use some combination of both Linux and Windows clients
controlled by a Linux server, try Zeiberbude:
</P>
<P><BLOCKQuote>
<A HREF="http://zeiberbude.sourceforge.net"
>http://zeiberbude.sourceforge.net</A>
</BLOCKQuote></P>
<P>
If you want Linux clients connecting to a Linux server, you could also
try DireqCafe:
</P>
<P><BLOCKQuote>
<A HREF="http://akinimod.sourceforge.net/icafereal.html"
>http://akinimod.sourceforge.net/icafereal.html</A>
</BLOCKQuote></P>
<P>
This is built for the Linux Terminal Server project:
</P>
<P><BLOCKQuote>
<A HREF="http://www.ltsp.org"
>http://www.ltsp.org</A>
</BLOCKQuote></P>
<P>
If you want Windows clients connecting to a Linux server, try Prepaid
Accounting:
</P>
<P><BLOCKQuote>
<A HREF="http://quozl.netrek.org/ppa"
>http://quozl.netrek.org/ppa</A>
</BLOCKQuote></P>
<P>
If you want Windows clients connecting to a Windows server, you'll have
to try asking somewhere else.
</P>
<BLOCKQUOTE>
[Faber Fedor]
If you go to www.google.com and type in "internet cafe howto" the first
link is back to us -- <A HREF="../issue70/tag/9.html"
>http://www.linuxgazette.com/issue70/tag/9.html</A> !
There are several other good links mentioned there on google.
</BLOCKQUOTE>
<!-- end 14 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.15"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Making IPTABLES complain...</FONT></H3>
Tue, 8 Apr 2003 12:46:53 -0600
<BR>Jason Creighton (<a href="mailto:linux-questions-only@ssc.com?cc=ryujin_ssdt@yahoo.co.uk&cc=androflux@softhome.net&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2315">androflux from softhome.net</a>)
<BR>Question by =?ISO-8859-1?Q?\=CE=B6=BF=C0\?= (ryujin_ssdt from yahoo.co.uk)
<P><STRONG>
I have a little question. I have a iptables rule set that works perfectly. The
problem is that to check if it is working as it has to I have to check the
long log files every some time.
</STRONG></P>
<P><STRONG>
I really would like my laptop to complain when some unauthorized conection is
attempted in real time or when my laptop tries to connect to other host
without me doing it. Much the way Zonealarm complains. I just want the system
to tell me that something strange is going on without me having to see the
logfiles all the time or installing a dedicated IDS (snort).
</STRONG></P>
<P><STRONG>
I think if I can get iptables to send all the dropped packets somewhere a
normal user (not root) can read them, I can grab that data periodically and
display a little alarm with it using maybe karamba?? Any sugestions??
</STRONG></P>
<P><STRONG>
Just a little personal firewall for my desktop, since linux is becoming a
candidate for personal desktop (It is already for me) this feature would be a
good add-on.
</STRONG></P>
<BLOCKQUOTE>
[Jason]
Now, do you want the <EM>data</EM> that the packets contain, or just the packet
headers? The LOG target, will, as you know (if you're reading log files) give
that information. If you really need the data, look into the ULOG target. The
ULOG target sends the packet through a netlink socket to any listening process
in userspace, so you'll need a daemon running to "catch" all those packets.
Search the web for "iptables ULOG target", I haven't done much research into
that method, so I don't know how well it would work.
</BLOCKQUOTE>
<BLOCKQUOTE>
It sounds like you want a pop-up window every time somebody sends you a packet
that iptables drops. That's tricky to implement. Here's a half-way solution:
</BLOCKQUOTE>
<blockquote><pre>tail -f /var/log/syslog | perl -ne 'print "\a$1\n" if (/.*?firewall: *(.*)/)'
</pre></blockquote>
<BLOCKQUOTE>
Assuming you have the --log-prefix option that's given to the LOG target set
to 'firewall:' and that the kernel messages are ending up in <TT>/var/log/syslog</TT>,
this will beep and print the packet details whenever a dropped packet comes
in. You could then leave this running in a terminal. You might also want to
have the 'limit' match on your logging rule, for two reasons:
</BLOCKQUOTE>
<blockQuote><ul>
<LI>Somebody who knows what packets you're logging would flood your logs by
send lots of illegal packets.
<LI>You don't want to be driven crazy by beeps if somebody starts port-scanning
you.
</ul></blockQuote>
<BLOCKQUOTE>
There's probably some better solutions out there, but this works if all you
want is the packet details. Also, it's probably overkill to have perl doing
this.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Matthias]
You could configure your logging client to log your iptables log to a second
file which is group writeable (e.g. group "log") and then parse this log
file.
</BLOCKQUOTE>
<BLOCKQUOTE>
You should search for a <TT>/etc/syslog.conf</TT> or similar. If you have problems you
may ask on the list how to configure your particular logging client (syslogd)
on your distribution.
</BLOCKQUOTE>
<!-- end 15 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.16"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">iso</FONT></H3>
Wed, 9 Apr 2003 09:33:00 -0700
<BR>Rick Moen (<a href="mailto:linux-questions-only@ssc.com?cc=emery_558@hotmail.com&cc=rick@linuxmafia.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2316">the <em>LG</em> Answer Gang</a>)
<BR>Question by mark (emery_558 from hotmail.com)
<P><STRONG>
i have an iso image how do i burn it to auto run from cd
</STRONG></P>
<BLOCKQUOTE>
[Rick]
You use cdrecord.
</BLOCKQUOTE>
<blockquote><font color="#000066">Yes, cdrecord is available for Windows, albeit usually built under
cygwin, so you might need the cygwin runtime libraries. We also had
a considerable discussion of many avialable types of CD burning software
in a past issue:
<a href="http://www.linuxgazette.com/issue68/tag/11.html">Best of ISO Burning Under Windows</a>
</font></blockquote>
<blockquote><font color="#000066">I've seen that there is software to soft-mount a .iso raw CD image file
as a filesystem under Windows - much like the way Linux and other UNIX
users can "loopback" mount them (so they look like a real disc). Search
Tucows or some other MSwin software archive to find that stuff.
-- Heather</font></blockquote>
<P><STRONG>
its easy cd/dvd.6
</STRONG></P>
<BLOCKQUOTE>
[Rick]
No, when you're mailing a mailing list called <A HREF="mailto:linux-questions-only@ssc.com"
>linux-questions-only@ssc.com</A>,
it most definitely is <EM>not</EM> Roxio Easy CD/DVD 6 for MS-Wind*ws. It's
cdrecord. Get it?
</BLOCKQUOTE>
<blockquote><font color="#000066">Much thrashing by the gang about whether a reader can "get" that we're
going to describe free software to them when they haven't really got
their hands on that first Linux CD yet, snipped. Suffice it to say we
support folks escaping from addiction to the Borg's sugar cubes, but if
you have proprietary software, questions about it <EM>really</EM> ought to go to
its paid support staff.
-- Heather</font></blockquote>
<BLOCKQUOTE>
[Karl-Heinz Herrman]
if it is an true and real iso9660 (plus extensions like Joliet or Rockridge)
yous take it and burn as it is onto a CD. That's it.
</BLOCKQUOTE>
<BLOCKQUOTE>
To add some guesses myself:
</BLOCKQUOTE>
<blockQuote><ul>
<LI>That Roxio thingy is obviously a WinXX program
<LI>"auto run" might mean boot. But then it might mean autorun, which is an
inherent feature of WinXX to execute autorun.inf on inserting a CD (and the
first thing I switch off if I have to put my fingers on a Winbox).
</ul></blockQuote>
<BLOCKQUOTE>
In any case -- the bootability of a CD or the autorun.inf file are either in
the iso or not. If not, it won't "auto run".
</BLOCKQUOTE>
<!-- end 16 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.17"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">mcrypt</FONT></H3>
Wed, 2 Apr 2003 19:58:38 -0500
<BR>Ben Okopnik (<a href="mailto:linux-questions-only@ssc.com?cc=Hans.Borg@Physics.umu.se&cc=ben@callahans.org&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2317">the <em>LG</em> Answer Gang</a>)
<BR>Question by Hans Borg (Hans.Borg from Physics.umu.se)
<P><STRONG>
Have started to play around with mcrypt (my version 2.6.4) mostly
to learn. It works fine, but have a Q:
</STRONG></P>
<P><STRONG><BLOCKQuote>
Having an encrypted file on a (read only) CD, I would like to know
if there is any way to use the CD-file as input only and needed
working files directed to a normal (R/W) diskfile ?
</BLOCKQuote></STRONG></P>
<P><STRONG>
Have tried redirection "mcrypt .... CD-file &gt; HD-file" but mcrypt
reports "read only media". Any tricks to do this ? Currently I have
to copy the CD-file to a R/W-file and then decrypt it.
</STRONG></P>
<P>
Well, running "strace" on "mcrypt" shows it acting like it left its
brain in the dishwasher for too long: it tries (non-optionally) to write
the encrypted file in the same place where the source file is - even if
you issue the request from somewhere else. Duh! Plus, the "-F" switch
that's supposed to make it go to STDOUT does <EM>exactly the same thing</EM> in
the above case. The program is BAD (Broken As Designed.)
</P>
<P>
Here's a solution that works, though:
</P>
<blockquote><pre>cat /mnt/cdrom/foo | mcrypt -F &gt; foo.nc
</pre></blockquote>
<P><STRONG>
Hi Ben,
</STRONG></P>
<P><STRONG>
Thanks a lot. I do recal your name, you have helped out lot in the past.
</STRONG></P>
<P><STRONG>
Your method "cat <TT>/.../foo</TT> | mcrypt .." works fine. NOTE that I am in a learning
phase (as always). Are there better crypt applications around.
</STRONG></P>
<P><STRONG>
Thanks a lot.
</STRONG></P>
<P><STRONG>
Hans.
</STRONG></P>
<!-- end 17 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.18"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">how to config a modem to received call</FONT></H3>
Mon, 21 Apr 2003 16:22:50 +0530 (IST)
<BR>Karl-Heinz Herrmann (<a href="mailto:linux-questions-only@ssc.com?cc=lovett@radoint.com&cc=k.-h.herrmann@fz-juelich.de&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2318">k.-h.herrmann from fz-juelich.de</a>)
<BR>Question by radoint.com (lovett from radoint.com)
<P><STRONG>
i have the problem to config my modem for received login in , i ready
make the test to call out the work, but i can't do for received. becouse
i tried to make a login in for internet service.
</STRONG></P>
<P>
You want to have a look at sendfax and mgetty:
for example at: <A HREF="http://www.leo.org/~doering/mgetty"
>http://www.leo.org/~doering/mgetty</A>
</P>
<P>
mgetty is a daemon which is run by init (see <TT>/etc/init.conf</TT> for
configuration). It will reply to an incoming call on a modem.
</P>
<P>
K.-H.
</P>
<!-- end 18 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.19"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">mounting cd</FONT></H3>
Fri, 28 Mar 2003 08:41:30 -0800
<BR>Dan Wilder (<a href="mailto:linux-questions-only@ssc.com?cc=badrijimale@hotmail.com&cc=dan@ssc.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2319">SSC sysadmin</a>)
<BR>Question by BADRI JIMALE (badrijimale from hotmail.com)
<P><STRONG>
hi
</STRONG></P>
<P><STRONG>
i had problem with my unix.
i would like to know how to mount cd on my system which is running redhat
7.0
</STRONG></P>
<P><STRONG>
thank you
</STRONG></P>
<P>
1) Find out which device your CD is attached to. Try
</P>
<blockquote><pre> dmesg | less
</pre></blockquote>
<P>
spacebar takes you forward, q to quit. Look for something
in the messages about a CD. It'll probabably be attached to
<TT>/dev/hdc</TT> or <TT>/dev/hdb.</TT> Unless it's something unusual like
a USB or SCSI CD.
</P>
<P>
As root,
</P>
<blockquote><pre> mkdir /cdrom
</pre></blockquote>
<P>
add a line to <TT>/etc/fstab</TT> that looks like:
</P>
<blockquote><pre> /dev/hdc /cdrom iso9660 defaults,noauto,ro,user 0 0
</pre></blockquote>
<P>
using your favorite text editor, such as vi, emacs,
nedit, kedit, pico, whatever.
</P>
<P>
If the CD is on <TT>/dev/hdd</TT>, use that in place of hdc.
</P>
<P>
As yourself, put a CD in the slot and give command
</P>
<blockquote><pre> mount /cdrom
</pre></blockquote>
<P>
to look at files there
</P>
<blockquote><pre> cd /cdrom
ls
</pre></blockquote>
<P>
and so on.
</P>
<P>
To unmount it,
</P>
<blockquote><pre> umount /cdrom
</pre></blockquote>
<!-- end 19 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.20"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">linux S/W ? for movies</FONT></H3>
Fri, 28 Mar 2003 07:19:33 +0100
<BR>Huibert Alblas (<a href="mailto:linux-questions-only@ssc.com?cc=cave_man@hotpop.com&cc=huibert_alblas@web.de&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2320">huibert_alblas from web.de</a>)
<BR>Question by JK Malakar (cave_man from hotpop.com)
<BLOCKQUOTE>
[Huibert Alblas]
There are some GUIs (Graphical User Interfaces available for these things too:
avidemux (<A HREF="http://avidemux.sourceforge.net"
>http://avidemux.sourceforge.net</A>) (frontend to transcode avi-&gt;everything)
DVD::RIP (<A HREF="http://www.exit1.org/dvdrip"
>http://www.exit1.org/dvdrip</A>) (frontend for transcoding DVD-&gt;everything)
</BLOCKQUOTE>
<BLOCKQUOTE>
Then you are set to go:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
Safest way is to demultiplex the audio and video from the 3 avi's.
Then concat the 3 audio and video streams, resulting in 1 big audio and 1 big
video stream.
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
[Ben Okopnik]
I've also had good luck with "mplayer" (a wonderful all-around piece of
software); just a couple of days ago, I wanted to grab the audio stream
from a DVD title, so -
</BLOCKQUOTE>
<blockquote><pre>mplayer -dvd 12 -ao:pcm &gt; file.wav
</pre></blockquote>
<BLOCKQUOTE>
Of course, there's the obvious complement of "-vo" for video. For the
available output formats, see
</BLOCKQUOTE>
<blockquote><pre>mplayer -ao help
</pre></blockquote>
<BLOCKQUOTE>
or
</BLOCKQUOTE>
<blockquote><pre>mplayer -vo help
</pre></blockquote>
<BLOCKQUOTE>
Quite an impressive list in both.
</BLOCKQUOTE>
<P><STRONG>
Hi all,
</STRONG></P>
<P><STRONG>
I have downloaded the great <EM>MPlayer</EM> &amp; compiled it under debian.
but whenever I play with
</STRONG></P>
<pre><strong>mplayer /cdrom/movie.dat
</strong></pre>
<P><STRONG>
...MPlayer plays it
within a very small window. maximizing the window can't change the display
area. again there is a synchronization problem between the audio &amp; video
output.
</STRONG></P>
<BLOCKQUOTE>
[Robos]
if you have xvideo support (mplayer -vo xv) try "f" during playback.
Else, try -zoom and|or -fs. If you post your grafic card I can (maybe) tell
you what option to use to get fullscreen.
</BLOCKQUOTE>
<P><STRONG>
it plays sound more quickly than the video. I have also tried with
the option <tt>-autosync n</tt> (where n=1,2 etc), but result is same. could any
one suggest me a solution ?
</STRONG></P>
<P><STRONG>
another newbie question. I have gone through the HTML doc of mencoder. still
the difference between <em>2-pass</em> &amp; <em>3-pass</em> method is not clear to me.
*2-pass* gives better image quality. but what is the advantage of <em>3-pass</em> ?
is it superior to 2-pass. please let me know.
</STRONG></P>
<BLOCKQUOTE>
[Robos]
If I understand it correctly 3 pass does mp3 separately of the video...
</BLOCKQUOTE>
<blockquote><font color="#000066">Anyone who has sufficient info to keep us in sync here? Maybe you could
write an article for us :D
-- Heather</font></blockquote>
<!-- end 20 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.21"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">mouse driver, rather not</FONT></H3>
10 Apr 2003 13:46:09 -0000
<BR>palla ravikiran reddy (<a href="mailto:linux-questions-only@ssc.com?cc=solarflares@rediffmail.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2321">solarflares from rediffmail.com</a>)
<P>
Hello,
</P>
<P>
I tried editing the makefile in the drivers/char directory by
removing busmouse.o and other other mice. I then compiled the
kernel and booted using the new image. The mouse was still running
after the reboot.
</P>
<P>
what does this mean? Isn't gpm an application that uses the
busmouse and other mice functions? Only when i kill the gpm daemon
does the mouse stop functioning.
</P>
<P>
Any information would be useful to me.
</P>
<BLOCKQUOTE>
[Joel Mayes]
An .o file is generally an object file, it is the result of the
compilation, so removing one will generally just get it remade
the next time you compile.
</BLOCKQUOTE>
<BLOCKQUOTE>
Also the busmouse.[c|h] files are for an old style serial busmouse
driver, if you have a reasonably modern PC the chances are you have
either a USB or a PS2 mouse.
</BLOCKQUOTE>
<BLOCKQUOTE>
If you want to remove mouse support from the kernel, rather then
deleting files from the kernel source, which could have interesting
results (and you might want to include that support your deleting in the
futher) in "menuconfig" goto "Character Devices" -&gt; "Mice" and disable
support
</BLOCKQUOTE>
<BLOCKQUOTE>
[Heather]
Hi Joel. Ravi, there's more to this that you haven't mentioned, so I'm
going to have to fill in with some guessing.
</BLOCKQUOTE>
<BLOCKQUOTE>
If you didn't tell your bootloader about your new kernel (even if you
succeeded at chopping the mice out, instead of merely asking the build
system to ignore them) ... it's probably still booting the old kernel.
</BLOCKQUOTE>
<BLOCKQUOTE>
Type 'uname -a' to see your running kernel version.
</BLOCKQUOTE>
<BLOCKQUOTE>
When you build your kernel, go into the Makefile at the top of your
sources, and add a marker of your own into the EXTRAVERSION variable.
That way, if you succeed at grafting your own kernel in, then you will
see your marker from the uname output. Also its modules will be
seperated by the extended version, so you won't chance loading the
mouse support module of a kindred kernel, at least not unless you
deliberately insmod it.
</BLOCKQUOTE>
<BLOCKQUOTE>
I do this all the time to mention a systemname when I build kernels that
are only supposed to run on a specific host. Usually it's a warning
that the kernel is unlikely to boot other boxen; sometimes it's a sign
that I succeeded at applying a particular patch, or have a particular
list of options selected.
</BLOCKQUOTE>
<BLOCKQUOTE>
Then type '<tt>make menuconfig</tt>' (not just 'menuconfig') and tweak whatever
things you want or not. Note that X will be useless without some
serious tweaking, e.g. maybe using a windowmanager like ratpoison which
is keyboard driven, and adjusting the config so it won't die without a
mouse.
</BLOCKQUOTE>
<BLOCKQUOTE>
It may be easier to simply adjust the sysvinit setup so it does not
automatically launch gpm for you. You could directly remove the gpm
package so it will stop haunting you (try as root, either '<tt>rpm -e gpm</tt>'
or '<tt>apt-get --purge remove gpm</tt>')... or modify your init sequence so
that gpm is no longer automatically invoked. Note that most distros
also have helper apps to set all the right things for that too - debian
has update-rc.d, <A HREF="http://www.suse.com/">SuSE</A> has YaST, <A HREF="http://www.redhat.com/">Red Hat</A> had linuxconf and may have newer
and more friendly interfaces now, etc. The ultimate arbiter of what
happens during your startup though, is <TT>/etc/inittab</TT>, which is really the
file that init reads when it gets started. All the other stuff is just
following its instructions through a few layers of shell scripts.
</BLOCKQUOTE>
<!-- end 21 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.22"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">root like permissions</FONT></H3>
Fri, 11 Apr 2003 21:27:44 -0600
<BR>Jason Creighton (<a href="mailto:linux-questions-only@ssc.com?cc=Chris.Love@ktd-kyocera.com&cc=androflux@softhome.net&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2322">androflux from softhome.net</a>)
<BR>Question by Chris Love (Chris.Love from ktd-kyocera.com)
<P><STRONG>
I am setting up a few Linux machines for the development group and I don't
want them to have root access, but they need to be able to install packages
and whatnot. Is there a way to do this? I tried logging them in as root
and the 1st thing they did was change root password - so that idea no good.
Is there a way to make them a root clone but not able to mess with roots
password and other such files? Similar to a Windows Power User?
</STRONG></P>
<BLOCKQUOTE>
[David Mandala]
What you are looking for is the sudo command. You can let specific users
do specific things that (a limited subset) root can do. This can be by
person or groups of persons.
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
man sudo.
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
[Jason Creighton]
Well......this is a tricky question, because if you set up 'sudo' to let them
use 'rpm', they'll just write a clever RPM that does Bad Things(tm). So, what
you <EM>could</EM> do is something like this:
</BLOCKQUOTE>
<blockQuote><ul>
<LI>Tell them to install software in their home directories. Compile the
software from source, setting the --prefix option to point to somewhere that
user can write to. Then have them adjust PATH and whatnot to point to include
the right directories.
<LI>Use User Mode Linux. (<A HREF="http://user-mode-linux.sourceforge.net"
>http://user-mode-linux.sourceforge.net</A>) This would
set up a virtual linux machine that they could be "root" in, but wouldn't
affect the rest of the machine.
</ul></blockQuote>
<blockquote><font color="#000066">With a particularlty tricksy mind, it's possible to set up a sudo to
make people only have access to a command when they are using the right
parameters. It could get ugly pretty quick though. I like the user
mode linux plan. If you've got some developers working on the same
project, you might even lock them into the same virtual machine, and let
them share full ownership inside it. You will want to keep an eye on
the machines for unusual behavior - defensively and in everyone's best
interests, of course.
-- Heather</font></blockquote>
<!-- end 22 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.23"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">UPS Problems..</FONT></H3>
Wed, 23 Apr 2003 08:05:51 -0700
<BR>Dan Wilder (<a href="mailto:linux-questions-only@ssc.com?cc=smiley0@myrealbox.com&cc=dan@ssc.com&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2323">SSC sysadmin</a>)
<BR>Question by Smiley (smiley0 from myrealbox.com)
<P><STRONG>
I recently got an APC SmartUPS700 for my debian server from a friend. I installed it (although without the serial connection, so the server really shouldn't know that it's there) and an hour or two later my server did something strange - it rebooted itself abruptly, on its own accord. I naturally figured this was something to do with the UPS and since it was late at night and i didn't feel like troubleshooting at the time, i took the UPS out of the picture altogether, and rebooted my server, plugged straight into the mains.
</STRONG></P>
<P><STRONG>
Same thing happened.
</STRONG></P>
<P><STRONG>
This has never happened before and I can't figure out why it's happening. At first i thought it must be a hardware problem, perhaps the UPS has somehow damaged the power supply of the server or something like that - but when I booted it into windows and left it for a few hours nothing happened. It only ever happens in linux.
</STRONG></P>
<P><STRONG>
I really don't know what to do to fix the problem, and it's really getting
to me - i can't listen to any music, surf the web, do email (i'm rushing
to get this written before the computer reboots - the time seems random,
anything from 5 minutes uptime to 3 hours..) or anything else..
</STRONG></P>
<BLOCKQUOTE>
[Dan Wilder]
Very likely hardware. Not likely anything the UPS did.
</BLOCKQUOTE>
<BLOCKQUOTE>
First thing to do is check memory. I recommend memtest86,
</BLOCKQUOTE>
<BLOCKQUOTE>
<A HREF="http://www.memtest86.com"
>http://www.memtest86.com</A>
</BLOCKQUOTE>
<BLOCKQUOTE>
If it finds problems, you certainly have a problem. If it doesn't
it still doesn't mean all is well with hardware or even memory.
Let it run at least four complete passes.
</BLOCKQUOTE>
<BLOCKQUOTE>
Also make sure your processor cooling fan is working and there's
no excessive dust buildup on the processor heat sink or the motherboard
chipset heat sink, if any.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
I'll strongly ditto that one. Wind0ws doesn't "work" the memory as hard
as Linux does, particularly if you do something like compiling a kernel.
Wind0ws also treats a number of core errors as warnings - viz. the GPFs
and the BSODs ("Blue Screen of Death") - whereas Linux will dump core on
pretty much <EM>any</EM> core error. That policy has lead to a kernel that is
as bug-free as possible, and the process still goes on.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ken Dodge]
I agree with Dan. I ran across a similar problem with a Win2K box I had
built for my daughter (EPoX EP-8KHA, 1.4GH Athlon) that would
continually reset, sometimes even before completing a boot cycle. She,
too, couldn't depend on it to get anything done. I eventually found a
flakey DIMM, using memtest86. All has been fine since pulling it out
(well ... it IS still running Win2K, but that's another problem!)
</BLOCKQUOTE>
<BLOCKQUOTE>
[Jason Creighton]
Yep. I had a problem once with a box crashing that looked like bad memory.
Turned out that I had EDO turned on in the BIOS but I didn't had EDO RAM in
the box. But in most cases it's bad memory. If you're really hard up for
memory, (Just buying more memory would be much easier) you might want to patch
your kernel to support "BadRAM". You can tell the kernel to not use certain
parts of memory. Here's the URL for that:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
<A HREF="http://rick.vanrein.org/linux/badram"
>http://rick.vanrein.org/linux/badram</A>
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
memtest86 has an option to output patterns that BadRAM can understand.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Dan WIlder]
Also make sure your processor cooling fan is working and there's
no excessive dust buildup on the processor heat sink or the motherboard
chipset heat sink, if any.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben Okopnik]
Or in the power supply vents. Make sure that your power supply fan is
running, too - I've seen that cause more reboots than I could count.
</BLOCKQUOTE>
<!-- end 23 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.24"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">To find out what's in an RPM</FONT></H3>
Fri, 4 Apr 2003 11:17:33 -0600
<BR>Gary Sears (<a href="mailto:linux-questions-only@ssc.com?cc=gsears@kane.k12.il.us&subject=%20Re%3A%20%5BLG%2090%5D%202c%20Tips%20%2324">gsears from kane.k12.il.us</a>)
<P>
<a href="../issue89/lg_mail.html#wanted.5">(see question in mailbag, Gazette 4/2003)</a>
</P>
<P>
To emulate rpm's query on a .rpm file, just use gnu's less on it.
Simple. Nice filter.
It shows you the info, patches and files.
</P>
<P>
Since the source for less is available, it might give him a direction...
</P>
<P>
Gary Sears
</P>
<BLOCKQUOTE>
[Jason Creighton]
less doesn't do this. Look at the program named in the LESSOPEN enviromental
varible. On most distos, it's a script that calls diffent programs depending
on the filename. For example, if it's tag.gz or .tgz
</BLOCKQUOTE>
<blockquote><pre>tar -tzvvf filename.tgz
</pre></blockquote>
<BLOCKQUOTE>
to view the contents of a tarball. Or, on my system,
</BLOCKQUOTE>
<blockquote><pre>rpm -qpvl filename.rpm
</pre></blockquote>
<BLOCKQUOTE>
if it's an RPM.
</BLOCKQUOTE>
<P><STRONG>
[John Karns]
Very cool. I had wondered how less was able to handle gzipped text files.
Didn't know it (via $LESSOPEN=lesspipe.sh ... at least on <A HREF="http://www.suse.com/">SuSE</A> 7.x) was
config'd to handle rpm and some others as well.
</STRONG></P>
<!-- end 24 -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
<h5>This page edited and maintained by the Editors of <I>Linux Gazette</I><br>HTML script maintained by <A HREF="mailto:star@starshine.org">Heather Stern</a> of Starshine Technical Services, <A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
<br>Copyright &copy; 2003
<br>Copying license <A HREF="http://www.linuxgazette.com/copying.html">http://www.linuxgazette.com/copying.html</A>
<BR>Published in Issue 90 of <i>Linux Gazette</i>, May 2003</H5>
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<H3>Contents:</H3>
<dl>
<dt><a href="#tag/greeting"
><strong>&para;: Greetings From Heather Stern</strong></A></dl>
<DL>
<!-- index_text begins -->
<dt><A HREF="#tag.1"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Re: Hidden master DNS</strong></a>
<dt><A HREF="#tag.2"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Virtual LINUX</strong></a>
<!-- index_text ends -->
</DL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/greeting"><HR WIDTH="75%" ALIGN="center"></A>
<H3 align="left"><img src="../gx/dennis/hbubble.gif"
height="50" width="60" alt="(&para;) " border="0"
>Greetings from Heather Stern</H3>
<!-- begin hgreeting -->
<p>We got a decent number of juicy Tips this month. And despite the incredible effort Dan puts into clobbering them, a record number of spams leaking through. Oh well. (Mind you, "record" is something like almost 20. This beats the crap out of the ratios we used to see... Yay for Dan!)</p>
<p>From a "peeves of the month" point of view though (hey, I haven't done those in a while) we also got a record number of people whose mail is quoted-printable in the text portion AND carrying useless HTML around with it. Super ouchie! Rick has long since macro'd his respone to the mime header to tell people how to undo that... I usually have some funnin' on them... such as, "Argh! I need to stomp out all these dratted =2E thingies!" You get the idea.</P>
<p>In the land of Linux itself - Hey, the household firewire pretty much works, USB runs great, we've got sound support coming out of... errr, into our ears... at least around my household, things are looking good. What's eating you that Linux isn't doing for you? Ask the Answer Gang - maybe it's not as hard as all that, or we can point you at who's picking up on that task.</p>
<p>My local Starship and free software group is running an Internet Lounge at the local science fiction convention in my area, <a href="http://www.baycon.org/">Baycon</a>. If you'll be in the San Jose area around the end of the month, drop on by and maybe you can meet a few us who live around here. Or just have a silly time in the 24th century.</p>
<p>Sorry for the short column this time folks. Have a happy.</p>
<!-- end hgreeting -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.1"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 1 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Re: Hidden master DNS</H3>
<p><strong>From Dan Wilder
</strong></p>
<p></strong></p>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
How do you do the hidden master trick for DNS? In my case, my computer
is the real master and my friend runs two secondaries. However, the
registrar lists only his servers. Is that all that's needed to make
his secondary appear to be the master from the public's
perspective, or do I have to do something else too?
</STRONG></P>
<blockQuote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Dan]
First bear in mind that "master" and "slave", a relationship
between servers, has nothing whatever to do with "primary"
and "secondary", an arbitrary ordering of servers on a list
your registrar maintains for you. Many sysadmins confuse the
two, partly because similar terms are sometimes used, and
much grief results.
</blockQuote>
<blockQuote>
1) List any servers you think will serve your domain with your
registrar, in any order you please.
</blockQuote>
<blockQuote>
2) Set up any relationship you want between your DNS servers.
The master/slave relationship is established (when using BIND)
in the named.conf stanzas. For the master:
</blockQuote>
<blockquote><pre>zone "mydomain.com" {
type master;
file "mydomain.com";
};
</pre></blockquote>
<blockQuote>
and put the "mydomain.com" zone file where the server expects
to find it.
</blockQuote>
<blockQuote>
For a slave:
</blockQuote>
<blockquote><pre>zone "mydomain.com" {
type slave;
masters { xxx.xxx.xxx.xxx; };
file "mydomain.com";
};
</pre></blockquote>
<blockQuote>
the slave will download mydomain.com from the master.
</blockQuote>
<blockQuote>
About "hidden":
</blockQuote>
<blockQuote><BLOCKQuote>
You don't have to list the actual master server at all. It is
sufficient that the listed servers know the IP address of the
actual master. The registrar doesn't need this information.
Then it's a "hidden master".
</BLOCKQuote></blockQuote>
<blockQuote>
Somewhat related to this is so-called "split DNS". Use this when
you have a firewalled network containing hosts known internally
as a part of your domain, but which are not visible outside.
</blockQuote>
<blockQuote>
Set up a master DNS server inside and point all your hosts at it.
In the "options" section:
</blockQuote>
<blockquote><pre>options {
...
notify no;
allow-transfer { none; };
forward only;
forwarders {
xxx.xxx.xxx.xxx;
xxx.xxx.xxx.xxx;
xxx.xxx.xxx.xxx;
};
};
</pre></blockquote>
<blockQuote>
which turns off notification to anybody, allows nobody to
get a copy of locally maintained zone files, and specifies
a few nameservers, typically those of your ISP, as the
places to query for domains the server doesn't consider
itself definitive for.
</blockQuote>
<blockQuote>
Then, for your own domain, a stanza that says:
</blockQuote>
<blockquote><pre>zone "mydomain.com." IN {
type master;
file "mydomain.com";
};
</pre></blockquote>
<blockQuote>
and the "mydomain.com" zone file contains records for
internal hosts, <EM>plus</EM> all external hosts listed in the
mydomain.com zone file in the outside nameserver.
</blockQuote>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
All my domains are "master" in my <TT>/etc/bind/bind.conf.</TT> My friend has
who-knows-what settings to download my information to his secondary
servers. I'm not sure whether the records appear as "master" or "slave"
on his server. I want his first secondary server (the one listed first
at the registrar) to appear authoritative to the public, so that the
public won't be querying my server. Does he have to do anything else?
I asked him, but he said he thought hidden master was something I set at
my end.
</STRONG></P>
<blockQuote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Dan]
Nope.
</blockQuote>
<blockQuote>
"Hidden" is set at the registrar. That is, you don't register your
server. That makes it hidden.
</blockQuote>
<blockQuote>
Your server has to consider itself "master" but that's already set up.
</blockQuote>
<blockQuote>
If you want your hidden master to actually control anything, your
friend has to set the stanza for your domain in his named.conf file
to "slave" with the ip of your machine in the "masters" keyword
in the stanza. That's what makes your server a "master".
</blockQuote>
<blockQuote>
Or else he has to set his stanza to "master", and you have to
send him a copy of your zone file every time you change it, and he
has to put it in place. But then your machine isn't a "hidden master".
</blockQuote>
<blockQuote>
If the transfer happens on a timely basis, nobody outside cares how the
zone file gets to his machine. If he'll cooperate it saves work
on your part and on his.
</blockQuote>
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
He's already set up to automatically pull the data from my server; that
was set up years ago. I guess that means he's a "slave". But I thought
"secondary" was the term for that, and that his record would tell the
public to go to my server for the authoritative source, but I guess
that's not the case.
</STRONG></P>
<blockQuote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Dan]
No. That's the confusion due to similar terms being used in the
same context for different things, that I've been fighting off and
on about with slightly underqualified sysadmins who don't realize
the extent of their underqualification, for years.
</blockQuote>
<blockQuote>
"Primary" and "Secondary" should be used to denote a matter of
public record, the nameservers listed with a registrar for
a domain. They should never be used to denote the private
relationship between servers, of which the registrar knows
nothing.
</blockQuote>
<blockQuote>
"Master" and "Slave" should be used to denote a privately
arranged relationship between servers configured to furnish
DNS information about a particular domain. This has nothing
to do with the matter of public record mentioned previously.
</blockQuote>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.2"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 2 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Virtual LINUX</H3>
<p><strong>From Dan Wilder
</strong></p>
<p></strong></p>
<p align="right"><strong>Answered By Dan Wilder, Rick Moen, Jim Dennis, Heather Stern, Huibert Alblas,
Jason Creighton, Jimmy O'Regan, Ben Okopnik
</strong></p>
<P><STRONG><FONT COLOR="#000099"><EM><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
<BR>&gt;Content-Transfer-Encoding: quoted-printable
</EM></FONT></STRONG></P>
<blockquote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] eeek! I hate stomping out all these little extra = and =2E thingies
<IMG SRC="../gx/dennis/unsmily.gif" ALT=":("
height="24" width="20" align="middle">
Unless, of course, you're really defending some foreign letterset from
destruction by mail programs. Then it's kinda useful.
</blockquote>
<blockquote>Don't do this. Here's how not to: <A HREF="http://expita.com/nomime.html#outlook5"
>http://expita.com/nomime.html#outlook5</A>
</blockquote>
<P><STRONG><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Dear Sir,
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
We're "The Answer Gang"
<IMG SRC="../gx/dennis/smily.gif" ALT=":D"
height="24" width="20" align="middle"> We answer Linux questions, and crossover
stuff like this is cool too.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I'm using Windows XP Pro on my home workstation. Which 3rd party
applications would allow loading &amp; "running" Redhat8 from RAM as a
virtual machine? If none which 3rd party applications might emulate
Redhat8? Are any shareware (freeware)?
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
RedHat 8 fits in RAM? Wow. I want your computer. It must be <EM>really</EM>
expensive. No wonder you can't afford more commercial software for it
<IMG SRC="../gx/dennis/smily.gif" ALT=";P"
height="24" width="20" align="middle">
I'll translate that as "need to run Linux without ruining my copy of
Windows", hope that's ok.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I'm studying network security and need to run or emulate Redhat8 on
XP (preferably without partitioning NTFS for dual boot) to pass the
tests.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
Ok, that clarifies why you want to make sure it's <A HREF="http://www.redhat.com/">Red Hat</A> that you run.
The instructor wants it?
</blockQuote>
<blockQuote>
They don't have their own live-CD as far as I can tell, but somebody
put some extra effort into basing one off of a Red hat 7.3 distro -
perhaps that will be close enough. Or maybe the live flavor isn't
handy because RH just released 9, and haven't finished up a demo disk
yet. Who knows. Anyways, you can try this one:
<A HREF="http://sourceforge.net/projects/emergencycd2"
>http://sourceforge.net/projects/emergencycd2</A>
</blockQuote>
<blockQuote>
If you really just need a Linux of some sort and your instructor was
thinking of RedHat because it's the only distro he knows, perhaps you'd
like one of the flavors which can install into your Windows disk space
without repartitioning. Look at <A HREF="http://old.lwn.net/Distributions"
>http://old.lwn.net/Distributions</A>
under the heading "DOS/Windows install".
</blockQuote>
<blockQuote>
Or, it can be noted that while RedHat really soaks up the disk space on
older hardware, is someone has a paperweight computer around, you could
boot it off of one of the many floppy based distros easily. Nearly all
Linux flavors have similar networking abilities, though only the fancier
ones will have cool stuff like samba support.
</blockQuote>
<blockQuote>
I hope the extra stuff below is helpful too, and makes your road to network
techieness a little more fun.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Dan]
Vmware
</blockQuote>
<blockQuote>
But it'd be a lot cheaper, not to mention faster, to purchase a spare
hard drive and install Red Hat on it.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Rick]
As Dan Wilder points out, you may have asked the wrong question.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
While I agree with the guys that it seems like you may be looking for
the opposite answer, I'm gonna go out on a limb and answer the question
you actually posed. It's probably overkill, but heck, we specialize in
that around here
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> Mostly 'cuz the juiciest bits get pubbed in Linux
Gazette for the world to read. So forgive me if I shoot off on a few
tangents.
</blockQuote>
<blockQuote>
(and for some repeated info, as a few of these products can live in
Windows, carrying Linux on their shoulders, or the other way around.)
</blockQuote>
<blockQuote>
The company "VMware" makes a reasonably good virtual machine product.
I haven't kept track of whether they can run in winXP as the host yet
but it seems likely. 'Course they sell their host for Linux, as well,
and you would be able to host MSwin or many other OS' under that. It
may interfere with MS' nefarious plans for your computer a little, but
it's really great for rolling back the damage from any virii that come
after you. They do have a trial edition, at least, so I guess that
counts as shareware:
<A HREF="http://www.vmware.com"
>http://www.vmware.com</A>
</blockQuote>
<blockQuote>
...Brief pause while I check whether winXP has joined their extensive
list of OS' that can be successfully hosted this way. My own experience
shows that win98 can be hosted just fine - but it runs a little slower
under this emulation, than the apps themselves do under <A HREF="http://www.winehq.com/">WINE</A>'s direct
binary support for MSwin apps. Not that this is perfect mind you, but
it's gotten pretty damn good, and there's a handful of commercial vendors
helping give WINE a booster shot if you need that.
<A HREF="http://www.winehq.com"
>http://www.winehq.com</A> and boatloads of useful links from Rick, below.
</blockQuote>
<blockQuote><DL><DT>
Oh yeah, VMWare's current Workstation product can host all that stuff:
<DD><A HREF="http://www.vmware.com/products/desktop/ws_features.html"
>http://www.vmware.com/products/desktop/ws_features.html</A>
</DL></blockQuote>
<blockQuote>
Wow, they've got an SMP edition now too, that is, where the fake PC you
get is an SMP box. Scary.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Halb]
It is not free ( costs about $300 ) but a 30 day fully working demo is availble.
It emulates a harddisk, networkcard, SVGA card, in short a whole PC.
But unlike BOCHS it does not emulate the CPU.
</blockQuote>
<blockQuote>
I doubt that you will be able to run VMware with a 2 Gig harddisk completely from ram,
but I doubt that you meant running the <em> _complete</em> OS from RAM anayway.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
'Course if you were asking this from the point of view of a Macintosh
user I'd have to recommend VirtualPC. (warning: Connectix' website isn't
clean if you're not running javascript. Dratted bogus redirectors.
Grrrrrr.) Doesn't look like they do a Linux edition, but they have it
for Windows(tm) too:
<A HREF="http://www.connectix.com/products/vpc5w.html"
>http://www.connectix.com/products/vpc5w.html</A>
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jimmy]
They have a free trial. I've used it. It's quite nice.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
At least last time I looked at it 'twas a bit better at hosting Linux than
SoftWindows, its competitor, was. Heh, back in our own issue 32 someone
asked The Answer Guy if there was a Linux port of it. Well, it looks
like Insignia went and sold that off to somebody else, so if someone out
there with a PowerMac wants RealPC look for the current vendor:
<A HREF="http://www.fwb.com/html/realpc.html"
>http://www.fwb.com/html/realpc.html</A>
</blockQuote>
<blockQuote>
If I believe this news item
(<A HREF="http://www.nwfusion.com/newsletters/servers/2003/0303server2.html"
>http://www.nwfusion.com/newsletters/servers/2003/0303server2.html</A>) then
Microsoft is in the process of purchasing either Connectix, or at least
its virtual machine stuff. I hope they don't screw up a decent product.
It did mention one more commercial competitor though, SW-soft. Their
"Virtuozzo" looks like it's on way too grand a scale for what you need
to do. I doubt they have much to fear from MS:
<A HREF="http://www.sw-soft.com/en/products/virtuozzo"
>http://www.sw-soft.com/en/products/virtuozzo</A>
</blockQuote>
<blockQuote>
However, you wanted something free as in bucks. Or cheap anyway. I can
assure you these vendors have put some effort into the goodies, but let's
look at that.
</blockQuote>
<blockQuote>
Frankly, TUCOWS is a much better place to look for MSwin shareware than
the linux-questions-only folks:
<A HREF="http://www.tucows.com"
>http://www.tucows.com</A>
</blockQuote>
<blockQuote>
Normally I'd leave you to your own homework there, but I'm curious if
anything new has cropped up that would let the MSwin-bound run Linux.
Unfortunately surfing their site has become more painful than it used
to be; I seem to recall being able to find small product blurbs, on
the order of the paragraph or two found at freshmeat for projects listed
there. Even one-liners would have been nice. I mourn the demise of more
pleasant interfaces like the "program manager" style icon map that
winfiles.com used to have before zdnet inhaled them. Hitting up Google
for the "windows virtual download" idea finds me an easier to use
shareware trove - maybe you'll find it handy. I didn't find more
virtual machines there, but I stopped looking after awhile. At least
this one's search widget looks in the descriptions as well as titles:
<A HREF="http://www.sofotex.com"
>http://www.sofotex.com</A>
</blockQuote>
<blockQuote>
Linux, of course, is free if you want to spend some time downloading it,
or pretty darn cheap if you choose the right place to buy your ISOs and
don't need a manual. So perhaps we can look at virtual-machine projects
under Linux.
</blockQuote>
<blockQuote>
For Linux under Linux, there's User Mode Linux, usually abbreviated to
UML. A few of the folk on the lnx-bbc project use it to test the builds.
Looking for it via Google! finds me both
<A HREF="http://user-mode-linux.sourceforge.net"
>http://user-mode-linux.sourceforge.net</A> (hey cool! It's available as debian
packages
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> Even better, this page has a lot more content and organization
than most SourceForge hosted sites) and <A HREF="http://usermodelinux.org"
>http://usermodelinux.org</A> (a
PHP-nuke community board, looks like it's got lots of juicy links too).
Also, the white paper "Know Your Enemy: Learning with User-Mode Linux" at
<A HREF="http://project.honeynet.org/papers/uml"
>http://project.honeynet.org/papers/uml</A> might serve as a nice quick Howto
for getting it spun up and useful.
</blockQuote>
<blockQuote>
<blockquote><font color="#000066"><em>See
<A HREF="weber.html">Nick Weber's article</A> this issue for UML. -- Heather
</em></font></blockquote>
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
Maybe some of the free and opensource projects listed on <A HREF="http://www.freshmeat.net/">Freshmeat</A> will
work on MSwin environments too? Well, what the heck, can't hurt to
look. Both this and a search on TUCOWS for "virtual machine" are likely
to hit a few extra links for Java stuff, numerous other OS emulators,
and some bytecode-modelled programming environs. Oh well, comes with
the buzzword...
</blockQuote>
<blockQuote>
Wow. I didn't know there was a liveCD flavor of Linux for hosting UML
sessions - the ADIOS project. That's more like it:
<A HREF="http://dc.qut.edu.au/adios"
>http://dc.qut.edu.au/adios</A>
</blockQuote>
<blockQuote>
While I'm tipping my hat to the Mac folk there's a virtual-machine for
running MacOS under Linux/PPC. Basically it seems to be a shim allowing
access back to the Mac hardware so you can run another OS ... even more
flavors of Linux/PPC, if you like:
<A HREF="http://www.maconlinux.org"
>http://www.maconlinux.org</A>
</blockQuote>
<blockQuote>
The analogous project for the PC-compatible platform is currently named
Plex86, used to be called FreeMWare. Of course GNU's savannah project is
roughly similar to SourceForge, so if a project doesn't wanna make it easy
to find their FAQ or other docs, you'll have to thrash around on your own.
Anyways it looks like their win32 port isn't terribly useful yet:
<A HREF="http://savannah.nongnu.org/projects/plex86"
>http://savannah.nongnu.org/projects/plex86</A>
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jimmy]
A patch is available
(<A HREF="http://savannah.nongnu.org/patch/?func=detailpatch&amp;patch_id=238&amp;group_id=869"
>http://savannah.nongnu.org/patch/?func=detailpatch&amp;patch_id=238&amp;group_id=869</A>)
which allows you to use it as an NT host, but AFAICT you'll need Visual
C++ to compile it.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
The folks there recommend "bochs" for emulating a 32-bit PC on non-PC
hardware. (I know, they haven't made Windows for non-PC hardware in
a coon's age. Oh well.) As far as I know bochs runs on PCs also, so
that might very well do the trick.
<A HREF="http://bochs.sourceforge.net"
>http://bochs.sourceforge.net</A>
</blockQuote>
<blockQuote>
It seems likely that it would be much easier to set yourself up with a
runs-from-CD setup, if you want it in RAM simply 'cuz you don't want to
ruin a local hard disk while experimenting a little. Many Linux vendors
offer "live CD" editions of their stuff to whet your whistle. I can't
blame you for asking us, since my own quick glance around their website
doesn't seem to reveal Red Hat as one of them.
</blockQuote>
<HR width="10%" align="left"><blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Rick]
...how to preserve access to the few legacy proprietary Win32 applications...
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jason]
It's interesting you should mention this, I was just thinking about legacy
applications for Linux the other day.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Rick]
Once or twice, just to make sure it can be done, I dig out a source
tarball from the vanished world of 1992 Linux, and see if it can be
still made to compile and run. The answer is usually "You bet".
11 years of compatibility is pretty good, esecially given that the OS
was brand-new back then.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
Interesting; seems we have a habit in common. I do that myself,
occasionally.
</blockQuote>
<blockQuote>
I've managed to compile - with either no or minimum tweaking - stuff
that K&amp;R wrote <EM>way</EM> back (found it on the web page where one of them is
reminiscing about the Good Old Days.) It's been a few years, but I still
remember being pleasantly shocked.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jimmy]
Maybe you two would be interested in this:
<A HREF="http://www.southern-storm.com.au/v7upgrade.html"
>http://www.southern-storm.com.au/v7upgrade.html</A>
</blockQuote>
<blockQuote>
- a project to make Unix V7 work on Linux
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Rick]
Hey, cool! I'll have to install it, fire up teco, and UUCP you some
mail about it.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
Pardon me, I'll just go to the corner and retch quietly...
</blockQuote>
<blockQuote>
(Great Ghu, what a sick idea. Worse yet, there's a "teco.el" for
Emacs... talk about coming full circle.)
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
I'm afraid I have to take full blame for that one. I asked RMS if the
original macros worked under the teco emulator for emacs. He was
suddenly just like a little kid -- he just <EM>had</EM> to know where he could
get it, was it free, would they enjoy joining the gnu project, would...
</blockQuote>
<blockQuote>
I had to slow him down enough to say that I'd heard of it so I just
wondered. I figured he probably had the originals around for old times'
sake. He later made sure it got into the standard emacs distro somehow.
And yes, he said... they do.
</blockQuote>
<blockQuote>
Now <EM>that</EM> is full circle. Or maybe full toroid. Hmm, donuts...
</blockQuote>
<blockquote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] Well, only almost full blame. I didn't write it, I just enabled it to
delight/torture/confuse an unsuspecting modern emacs audience.
</blockquote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jimmy]
I found the sources of the original teco (along with the sources of ITS
- Great Gnu indeed!) somewhere, but misplaced the link.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Rick]
Just remember the magic word: "Retrocomputing"!
<A HREF="http://www.pdc.kth.se/~jas/retro/retromuseum.html"
>http://www.pdc.kth.se/~jas/retro/retromuseum.html</A>
</blockQuote>
<blockQuote>
I personally think that making a teco with ANSI terminal support is
cheating, robbing you of that cutting-edge ASR33 experience. (I suppose
it would be arch to exclaim "curses!" at this point.)
</blockQuote>
<blockQuote>
Kids, these days! Spoiled rotten with their fancy gnome-teco
contraptions, I say. The terminal that's not terminal makes you
stronger.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jimmy]
The sources of
IBMs OS/360 are out there too - AFAICT in the public domain, because
they were published without a copyright notice before some law came into
effect.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Rick]
USA copyright law was amended in 1978, to comply with treaty, removing the
prior requirement of copyright notices. Until that point, it was
possible to lose copyright through omitting notice. <em> _Starting</em> 1978,
covered works became subject to automatic copyrigh -- under proprietary
terms by default.
</blockQuote>
<blockQuote>
Typically, binary-only applications have almost the same longevity of
backwards compatibility, if you take care to furnish old support libs
(<A HREF="http://linuxmafia.com/wpfaq/downloadwp8.html#FIX"
>http://linuxmafia.com/wpfaq/downloadwp8.html#FIX</A>
<IMG SRC="../gx/dennis/smily.gif" ALT="8)"
height="24" width="20" align="middle">, and both source and
binary interfaces have if anything standardised.
</blockQuote>
<blockQuote>
And this (along with adherence to public standards and documented
interfaces) is why we tell people that Linux can help them escape
the forced-upgrade treadmill.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jason]
If/When the next big open source OS
comes along (Supposing it isn't a UNIX. If it was, we'd just recompile
everything.), we really don't have to worry about supporting our old Linux
apps on it as long as it has a terminal emulator and an X11 implementation.
Then you could just set up a Linux PC specifically to run programs for other
computers on the network.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jimmy]
You probably wouldn't even need that - Next Big Thing OS would probably
have a Unix compatibility layer a la Cygwin written for it. There's
already a linux emulator for Cygwin (LINE -
<A HREF="http://line.sourceforge.net"
>http://line.sourceforge.net</A>) and for SysV (LxRun -
<A HREF="http://www.ugcs.caltech.edu/~steven/lxrun"
>http://www.ugcs.caltech.edu/~steven/lxrun</A>) as well as the in-kernel
stuff that the BSDs have. And you can assume that Bochs and VNC will be
ported to this OS.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [JimD]
It's possible that the next major non-UNIX OS to
take a look at would be EROS. It has a vitally different security model
from that of UNIX - a true capabilities system, of which the "privs" in
the latest linux kernels are a mere shot in the right direction, and
where virtual spaces are part of the basic environment.
(<A HREF="http://www.eros-os.org"
>http://www.eros-os.org</A>)
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jason]
I'm hoping, that as Microsoft's market share slips, they'll actually have to
make their OS compatible with other OSes. Windows 2000 uses Kerberos for
network security. Of course, they had to add their own extensions to it, but
still, when Microsoft is using a standard protocol, you know <EM>something</EM> is
up.
</blockQuote>
<HR width="10%" align="left"><blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Rick]
I'm actually more used to answering the reverse question of yours, that
of how to preserve access to the few legacy proprietary Win32
applications one might still need after upgrading to Linux.
</blockQuote>
<blockQuote>
Accordingly, my stock answer to <em> _that</em> question follows, and you may be
able to use some of its suggestions despite your
through-the-looking-glass perspective on the problem. E.g., you could
use the Win32 version of VMware, running RH9 within its virtual session.
</blockQuote>
<blockQuote>
The text below is cited from my WordPerfect on Linux FAQ
(<A HREF="http://linuxmafia.com/wpfaq/future.html#ALTERNATIVESWIN32"
>http://linuxmafia.com/wpfaq/future.html#ALTERNATIVESWIN32</A>):
</blockQuote>
<blockQuote><BLOCKQuote>
8.6. What alternatives to WP exist involving Win32 apps on Linux?
</BLOCKQuote></blockQuote>
<blockQuote>
Such alternatives are outside the scope of this document, but include
</blockQuote>
<blockQuote><ol>
<LI>the numerous ways of running Win32 applications on Linux in some
</ol></blockQuote>
<blockQuote>
%-%
-) VMware, Inc.'s VMware, <A HREF="http://www.vmware.com"
>http://www.vmware.com</A>
(simulation in a virtual environment of a
particular theoretical x86 box's hardware, which then can boot various
OSes including Win9x/ME/NT/2k/XP within the emulated environment,
necessitating a copy of that OS, as well),
</blockQuote>
<blockQuote>
-) NeTraverse's Win4Lin, <A HREF="http://www.netraverse.com"
>http://www.netraverse.com</A>
(an MS-Windows 9x/ME emulation environment
for x86 Linux, requiring a copy of MS-Windows 9x/ME to work)
</blockQuote>
<blockQuote>
-) WINE, <A HREF="http://www.winehq.com"
>http://www.winehq.com</A>
(an LGPLed library and program loader
implementing on x86 Unixes the Win32 and Win16 application interfaces)
</blockQuote>
<blockQuote>
-) ReWind, <A HREF="http://rewind.sourceforge.net"
>http://rewind.sourceforge.net</A>
(an MIT/X11-licensed fork of an earlier WINE release),
</blockQuote>
<blockQuote>
-) CodeWeavers's Crossover Office, <A HREF="http://www.codeweavers.com/products/office"
>http://www.codeweavers.com/products/office</A>
(WINE with some extra support for MS Office applications)
</blockQuote>
<blockQuote>
-) CodeWeavers's Wine Preview, <A HREF="http://www.codeweavers.com/technology/wine"
>http://www.codeweavers.com/technology/wine</A>
(an MIT/X11-licensed variant of an earlier WINE release tweaked for stability, and
with an improved installer)
</blockQuote>
<blockQuote>
-) CodeWeavers's Crossover Plugin, <A HREF="http://www.codeweavers.com/products/crossover"
>http://www.codeweavers.com/products/crossover</A>
(WINE variant for x86
Linux to support Web browser plugins such as QuickTime)
</blockQuote>
<blockQuote>
-) TransGaming Technologies, Inc.'s WineX, <A HREF="http://www.transgaming.com"
>http://www.transgaming.com</A>
(another WINE
extension for x86 Linux, with enhanced DirectX support, primarily for 3D
games)
</blockQuote>
<blockQuote>
-) the Bochs Project's Bochs, <A HREF="http://bochs.sourceforge.net"
>http://bochs.sourceforge.net</A>
(software environment for any CPU family emulating an entire x86 CPU, common I/O
devices, and BIOS),
</blockQuote>
<blockQuote>
-) and Drew Northup's Plex86, <A HREF="http://savannah.nongnu.org/projects/plex86"
>http://savannah.nongnu.org/projects/plex86</A>
(software environment emulating on x86 a virtual x86 session),...
%-%
</blockQuote>
<blockQuote>
...and
</blockQuote>
<blockQuote><ol>
<LI>the numerous ways of remotely running Win32 applications from
</ol></blockQuote>
<blockQuote><ul>
<!-- -) RealVNC Limited's VNC Server, http://www.realvnc.com/ -->
<LI>RealVNC Limited's VNC Server, <A HREF="http://www.realvnc.com"
>http://www.realvnc.com</A>
<!-- -) Constantin Kaplinsky's TightVNC, http://www.tightvnc.com/ -->
<LI>Constantin Kaplinsky's TightVNC, <A HREF="http://www.tightvnc.com"
>http://www.tightvnc.com</A>
<!-- -) Tridia Corporation's TridiaVNC, http://www.tridiavnc.com/ -->
<LI>Tridia Corporation's TridiaVNC, <A HREF="http://www.tridiavnc.com"
>http://www.tridiavnc.com</A>
<!-- -) and Matt Chapman's rdesktop, http://www.rdesktop.org/ -->
<LI>and Matt Chapman's rdesktop, <A HREF="http://www.rdesktop.org"
>http://www.rdesktop.org</A>
</ul></blockQuote>
<blockQuote>
I maintain a listing
(<A HREF="http://linuxmafia.com/~rick/linux-info/vnc-and-alternatives"
>http://linuxmafia.com/~rick/linux-info/vnc-and-alternatives</A>) of options
in the latter category.
</blockQuote>
<HR width="10%" align="left"><P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Thank you all for your answers to my question. I actually do
appreciate the time most of you took to give me alot of information. To
answer some of your questions: Yes I do have an expensive machine. I've
an 80GB HDD partitioned NTFS so, although I have the space, I'm not
going to repartition to install LINUX nor buy another HDD. I've 512MB of
RDRAM with 566MHZ FSB &amp; a 2.27GHz P4. (Yes, I'm a hardware geek). I can
understand your pro LINUX position but frankly, hardening the security
of a server from the command line is difficult, but you can't beat free,
now can you?
</STRONG></P>
<P><STRONG>
Anyway heartfelt thanks for your time and effort.
</STRONG></P>
<P><STRONG>
Imrahil O'Belalas
</STRONG></P>
<!-- end 2 -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
<h5>
<br>Copyright &copy; 2003
<br>Copying license <A HREF="">http://www.linuxgazette.com/copying.html</A>
<BR>Published in Issue 90 of <i>Linux Gazette</i>, May 2003</H5>
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<SMALL><CENTER><H6 ALIGN="center">HTML script maintained by
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H6></SMALL></CENTER>
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">News Bytes</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/conry.html">Michael Conry</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
</p><center>
<table cellpadding="7"><tbody><tr><td>
<img src="../gx/bytes.gif" border="1" alt="News Bytes">
</td><td>
<h3>Contents:</h3>
<ul>
<li><a href="#links">Linux Links</a>
</li><li><a href="#conferences">Conferences and Events</a>
</li><li><a href="#general">News in General</a>
</li><li><a href="#distro">Distro News</a>
</li><li><a href="#commercial">Software and Product News</a>
</li></ul>
</td></tr></tbody></table>
<strong>Selected and formatted by <a href="mailto:michael.conry@softhome.net">Michael Conry</a></strong>
</center>
<p> Submitters, send your News Bytes items in
<font size="+2"><strong>PLAIN TEXT</strong></font>
format. Other formats may be rejected without reading. You have been
warned! A one- or two-paragraph summary plus URL gets you a better
announcement than an entire press release. Submit items to
<a href="mailto:gazette@ssc.com">gazette@ssc.com</a>
</p><hr> <p>
<!-- =================================================================== -->
</p><h3><img alt=" " src="../gx/bolt.gif">
<font color="green">
May 2003 <i>Linux Journal</i>
</font>
</h3>
<img alt="[issue 109 cover image]" src="misc/bytes/lj-cover109.png" width="200" height="268" align="left" hspace="20">
The May issue of <a href="http://www.linuxjournal.com/"><i>Linux
Journal</i></a> is on newsstands now.
This issue focuses on Kernel Internals. Click
<a href="http://www.linuxjournal.com/modules.php?op=modload&amp;name=NS-lj-issues/issue109&amp;file=index">here</a>
to view the table of contents, or
<a href="http://www.linuxjournal.com/subscribe/">here</a>
to subscribe.
<p>
<font color="green">All articles older than three months are available for
public reading at
<a href="http://www.linuxjournal.com/magazine.php">http://www.linuxjournal.com/magazine.php</a></font>.
Recent articles are available on-line for subscribers only at
<a href="http://interactive.linuxjournal.com/">http://interactive.linuxjournal.com/</a>.
<BR CLEAR="all">
<!-- =================================================================== -->
<a name="links"></a>
<p><hr><p>
<!-- =================================================================== -->
<center><H3><font color="green">Linux Links</font></H3></center>
<FONT COLOR="green"><IMG ALT="Linux Focus"
SRC="http://www.linuxfocus.org/common/images/lflogo_sbutton.gif"
WIDTH="143" HEIGHT="45">
</FONT>
</H3>
The E-zine
<A HREF="http://www.linuxfocus.org/">LinuxFocus</A>:
has for May/June the following articles:
<ul>
<li>
<a href="http://linuxfocus.org/English/May2003/article288.shtml">
Implementing a scroller in SDL graphics</a>
</li>
<li>
<a href="http://linuxfocus.org/English/May2003/article289.shtml">
Packet filtering with Linux</a>
</li>
<li>
<a href="http://linuxfocus.org/English/May2003/article290.shtml">
A short Ximian Evolution installation guide</a>
</li>
<li>
<a href="http://linuxfocus.org/English/May2003/article291.shtml">
GWorkspace, the GNUstep Workspace Manager</a>
</li>
<li>
<a href="http://linuxfocus.org/English/May2003/article293.shtml">
Case Study: Open Source Content Management Systems Make E-commerce Websites Affordable</a>
</li>
<li>
<a href="http://linuxfocus.org/English/May2003/article295.shtml">
GUI Programming with GTK</a>
</li>
<li>
<a href="http://linuxfocus.org/English/May2003/article296.shtml">
Concurrent programming - Message queues (2)</a>
</li>
</ul>
<P>
Some tips from Linux Journal on
<a href="http://www.linuxjournal.com/article.php?sid=6795">
experimenting with the 2.5 kernel</a>.
<P>
Linux Journal
<a href="http://www.linuxjournal.com/article.php?sid=6790">
report on LinuxWorld Ireland 2003</a>.
<P>
Building a
<a href="http://newsvac.newsforge.com/article.pl?sid=03/04/10/1838234">
Linux Media Jukebox</a>
to handle digital photos, audio, video, DVD and TV.
<P>
Massachusetts-based Open-Pc founder/CEO Morgan Lim
<a href="http://newsforge.com/article.pl?sid=03/03/15/0145211">
discusses the business he has built</a> around Linux.
<P>
<a href="http://newsvac.newsforge.com/article.pl?sid=03/03/29/1135203">
Fujitsu preps Linux-based robot</a>. It is based on a real-time Linux
running on a 700MHz Pentium III.
<P>
Some links highlighted by
<a href="http://www.linuxtoday.com/">Linux Today</a>:
<ul>
<li>
Two articles on
<a href="http://nwn.bioware.com/downloads/linuxclient.html">Linux
RPG's</a>.
<li>
New version of
<a href="http://tuxmobil.org/Infrared-HOWTO/Infrared-HOWTO.html">
The Infrared-HOWTO</a> released.
<li>
<a href="http://www.linuxplanet.com/linuxplanet/reports/4747/1/">
Reasoning your way to Linux</a>.
<li>
<a href="http://www-106.ibm.com/developerworks/linux/library/l-perf/?ca=dgr-lnxw02FasterLinux">
Improving Linux performance</a> in application development
<li>
<a href="http://cin.earthweb.com/news/article.php/2191811">
Linux tackles SARS virus</a>.
<li>
<a href="http://www.bargainpda.com/reviews/sharp_zaurus_sl_5600.html?newsID=0&showComments=true">
Review</a> of the Sharp Zaurus SL-5600 Linux-powered PDA.
</ul>
<P>
<a href="http://linux.oreillynet.com/pub/a/linux/2003/03/17/enterprise.html">
Managing Linux releases</a> for large numbers of installations.
<P>
Keith Parkansky's linux tips website
<a href="http://www.aboutdebian.com">
www.aboutdebian.com</a>
has a series of "hands on" walk-throughs
to help Linux beginners go from the basics to
server and firewall setups while doing some fun
things (like killing a telnet process to cut
someone off) along the way. The material is particularly
relevant to Debian users, but mostly it will be useful to
anybody using GNU/Linux.
<P>
Richard Stallman on why he
<a href="http://newsforge.com/article.pl?sid=03/03/17/1259203">refused
to speak</a>
at the eGovOS conference.
<P>
<a href="http://newsvac.newsforge.com/article.pl?sid=03/03/19/0449221">
Using Free (Open Source) Software in a Grassroots Organisation</a>.
Reports on the use of Linux at the Low-Income Networking and Communicaitons
Project of the Welfare Law Center.
<a name="conferences"></a>
<p><hr><p>
<!-- =================================================================== -->
<center><H3><font color="green">Upcoming conferences and events</font></H3></center>
<P> Listings courtesy <EM>Linux Journal</EM>. See <EM>LJ</EM>'s
<A HREF="http://www.linuxjournal.com/events.php">Events</A> page for the
latest goings-on.
<!-- *** BEGIN events table [this line needed by Linux Gazette events.py *** -->
<table cellpadding=5 border=0 width=100%>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>Penguicon</b><BR>
<td valign=top>May 2-4, 2003<BR>Warren, MI<BR>
<a href="http://penguicon.sourceforge.net/" target="_blank">
http://penguicon.sourceforge.net/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>USENIX First International Conference on Mobile Systems,
Applications, and Services (MobiSys)</b><BR>
<td valign=top>May 5-8, 2003<BR>San Francisco, CA<BR>
<a href="http://www.usenix.org/events/" target="_blank">
http://www.usenix.org/events/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>Linux Clusters Workshop in France</b><BR>
<td valign=top>May 12-16, 2003<BR>IBM Montpellier Laboratory<BR>
<a href="http://www.linuxclustersinstitute.org" target="_blank">
http://www.linuxclustersinstitute.org</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>Third Open Source Content Management Conference</b><BR>
<td valign=top>May 28-30, 2003<BR>Cambridge, MA<BR>
<a href="http://www.oscom.org/" target="_blank">
http://www.oscom.org</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>CeBIT America</b><BR>
<td valign=top>June 18-20, 2003<BR>New York, NY<BR>
<a href="http://www.cebit-america.com/" target="_blank">
http://www.cebit-america.com/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>ClusterWorld Conference and Expo</b><BR>
<td valign=top>June 24-26, 2003<BR>San Jose, CA<BR>
<a href="http://www.clusterworldexpo.com/"
target="_blank">
http://www.clusterworldexpo.com</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>O'Reilly Open Source Convention</b><BR>
<td valign=top>July 7-11, 2003<BR>Portland, OR<BR>
<a href="http://conferences.oreilly.com/" target="_blank">
http://conferences.oreilly.com/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>12th USENIX Security Symposium</b><BR>
<td valign=top>August 4-8, 2003<BR>Washington, DC<BR>
<a href="http://www.usenix.org/events/" target="_blank">
http://www.usenix.org/events/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>HP World</b><BR>
<td valign=top>August 11-15, 2003<BR>Atlanta, GA<BR>
<a href="http://www.hpworld.com/" target="_blank">
http://www.hpworld.com</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>LinuxWorld UK</b><BR>
<td valign=top>September 3-4, 2003<BR>Birmingham, United Kingdom<BR>
<a href="http://www.linuxworld2003.co.uk" target="_blank">
http://www.linuxworld2003.co.uk</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>Linux Lunacy</b><BR><i>Brought to you by Linux Journal and
Geek Cruises!</i><br>
<td valign=top>September 13-20, 2003<BR>Alaska's Inside Passage<BR>
<a href="http://www.geekcruises.com/home/ll3_home.html" target="_blank">
http://www.geekcruises.com/home/ll3_home.html</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>Software Development Conference & Expo</b><BR>
<td valign=top>September 15-19, 2003<BR>Boston, MA<BR>
<a href="http://www.sdexpo.com" target="_blank">
http://www.sdexpo.com</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>PC Expo</b><BR>
<td valign=top>September 16-18, 2003<BR>New York, NY<BR>
<a href="http://www.techxny.com/pcexpo_techxny.cfm" target="_blank">
http://www.techxny.com/pcexpo_techxny.cfm</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>COMDEX Canada</b><BR>
<td valign=top>September 16-18, 2003<BR>Toronto, Ontario<BR>
<a href="http://www.comdex.com/canada/" target="_blank">
http://www.comdex.com/canada/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>IDUG 2003 - Europe</b><BR>
<td valign=top>October 7-10, 2003<BR>Nice, France<BR>
<a href="http://www.idug.org" target="_blank">
http://www.idug.org</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>LISA (17th USENIX Systems Administration Conference)</b><BR>
<td valign=top>October 26-30, 2003<BR>San Diego, CA<BR>
<a href="http://www.usenix.org/events/lisa03/" target="_blank">
http://www.usenix.org/events/lisa03/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>HiverCon 2003</b><BR>
<td valign=top>November 6-7, 2003<BR>Dublin, Ireland<BR>
<a href="http://www.hivercon.com/" target="_blank">
http://www.hivercon.com/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
<tr><td valign=top>
<b>COMDEX Fall</b><BR>
<td valign=top>November 17-21, 2003<BR>Las Vegas, NV<BR>
<a href="http://www.comdex.com/fall2003/" target="_blank">
http://www.comdex.com/fall2003/</A><BR>
<tr><td colspan=2><HR size=5 width=100% noshade align=center></td></tr>
</table>
<!-- *** END events table [this line needed by Linux Gazette events.py *** -->
<a name="general"></a>
<p><hr><p>
<!-- =================================================================== -->
<center><H3><font color="green">News in General</font></H3></center>
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Linux Test Project
</FONT>
</H3>
The
<a href="http://ltp.sourceforge.net">
Linux Test Project</a> ltp-2003DD has been released. It comprises over
1000 tests the GNU/Linux OS.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Eventide
</FONT>
</H3>
<P>
<a href="http://www.eventide.com/">Eventide Inc.</a>,
a producer of digital logging technology, have
created a Linux-based digital logging and archiving system
capitalising on the stability and reliablility of GNU/Linux.
Such reliability is crucial in the public safety marketplace during mission
critical situations.
<P>
The
<a href="http://www.eventide.com/vr778/vr778data.pdf">specifications</a>
of the Eventide VR778 digital logging and archiving system are available in
pdf format. Eventide claims that the VR778 is the first digital logger to
use the Linux O/S. This enables Eventide to provide a highly sophisticated
digital system with no licensing requirements and an O/S that does not
carry any other applications overhead "like many other Microsoft server
based systems".
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Anti-Spam Task Force Established by ActiveState
</FONT>
</H3>
<P>
<a href="http://www.ActiveState.com">
ActiveState Corp.</a>,
a producer of
email content filtering software, has
<a href="http://www.activestate.com/Corporate/Communications/Releases/Press1048902672.html">
announced</a>
the creation of an internal blue ribbon team comprised of the world's
foremost anti-spam researchers. The Task Force members include: Dr. John
Graham Cumming, creator of the popular open source Perl-based Bayesian mail
filtering program, POPfile; Tim Peters, creator of SpamBayes, a
Python-based open source Bayesian email classifier; Jason Rennie of MIT's
Artificial Intelligence lab and creator of the open source tool, ifile, an
automated email classification system; and Gary Robinson, an innovator in
collaborative filtering. The Task Force is focusing on anti-spam issues
affecting the enterprise, and is led by ActiveState's Director of
Development, Jesse Dougherty.
<P>
The Anti-spam Task Force is focusing on several technical initiatives
to optimize enterprise email messaging, including:
<ul>
<li>
Developing "next generation" methods for analyzing email content to
more accurately distinguish between desirable and undesirable email
</li>
<li>
Pioneering the development of non-spam gateway email filtering features
to enhance organizational productivity
</li>
<li>
Identifying and facilitating collaboration within the messaging
industry to implement standards and email policies
</li>
</ul>
<a name="distro"></a>
<p><hr><p>
<!-- =================================================================== -->
<center><H3><font color="green">Distro News</font></H3></center>
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Ark
</FONT>
</H3>
<P>
<a href="http://newsvac.newsforge.com/article.pl?sid=03/03/25/0218257">
Ark Linux H20: Simple and (Nearly) Complete</a>.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Knoppix
</FONT>
</H3>
<P>
<a href="http://www.knopper.net/knoppix/index-en.html">
Knoppix 3.2</a> has been released
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Linux From Scratch
</FONT>
</H3>
<P>
The latest version of
<a href="http://www.linuxfromscratch.org">
LFS</a> (4.1) will be available in
<a href="http://www.linuxfromscratch.org/hardcopy41.shtml">
printed-book form</a>. The book will be
available with or without companion CDRom from
<a href="http://www.cheapbytes.com">
CheapBytes</a>.
<P>
When you have your LFS 4.1 system up and running, you can get stuck into
BLFS (Beyond LFS) which has just been updated to version 1.0.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Lindows
</FONT>
</H3>
<P>
<a href="http://newsvac.newsforge.com/article.pl?sid=03/03/14/2129214">
LindowsOS 3.0 Review</a>.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Mandrake
</FONT>
</H3>
<P>
<a href="http://www.mandrakelinux.com/en/9.1/91PR.php3">
Mandrake Linux releases 9.1.</a>. This relese has been
<a href="http://www.osnews.com/story.php?news_id=3116">
reviewed at OSNews</a> (links courtesy Linux Today).
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">PCQLinux
</FONT>
</H3>
<P>
<a href="http://newsforge.com/article.pl?sid=03/03/11/1252203">
NewsForge reports on PCQLinux</a>.
An Indian monthly magazine, PCQuest, has
released its own variant Linux distribution based on Red Hat Linux 8.0.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Peanut
</FONT>
</H3>
<P>
<a href="http://newsvac.newsforge.com/article.pl?sid=03/03/14/1612205">
Moving to Peanut Linux</a>.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Slackware
</FONT>
</H3>
<P>
<a href="http://www.slackware.com/">Slackware</a> 9.0 has been
<a href="http://slackware.com/announce/ANNOUNCE.9_0">
released</a>.
Check out the
<a href="ftp://ftp.slackware.com/pub/slackware/slackware-current/ChangeLog.txt">
ChangeLog</a> to see what's new.
<P>
This release has been
<a href="http://www.tinyminds.org/modules.php?op=modload&name=Reviews&file=index&req=showcontent&id=23">
reviewed</a>
at TinyMinds.org,
while OSNews
<a href="http://www.osnews.com/story.php?news_id=3329">
debunks some myths</a>
surrounding the distribution (courtesy Linux Today).
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">UnitedLinux
</FONT>
</H3>
<P>
UnitedLinux has announced that its four founding partner companies
will offer special support programs and discounts to
<a href="http://www.unitedlinux.com/oracleisv/">ISV</a>
participants in the Oracle's Unbreakable Linux Partner Initiative.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Yellow Dog
</FONT>
</H3>
<P>
<a href="http://newsvac.newsforge.com/article.pl?sid=03/03/24/1846210">
Yellow Dog Linux 3.0 Review</a>.
<a name="commercial"></a>
<p><hr><p>
<!-- =================================================================== -->
<center><H3><font color="green">Software and Product News</font></H3></center>
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Phoenix Rises From Ashes As Firbird
</FONT>
</H3>
<P>
The name of the Mozilla spinoff browser Phoenix has
<a href="http://newsvac.newsforge.com/article.pl?sid=03/04/15/035214">
been changed</a>
to Firebird.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Kerio Adds SpamAssassin to Latest Mail Server Release
</FONT>
</H3>
<P>
<a href="http://www.kerio.com">Kerio Technologies</a>,
a security solutions software developer has launched the new version of its
multi-platform corporate messaging solution, Kerio MailServer 5.6 with
augmented anti-spam protection. Existing anti-spam tools have been
enriched by the award-winning spam detection technology:
<a href="http://www.spamassasin.org">
SpamAssassin</a>.
<P>
<hr width="20%" noshade>
<P>
Kerio has also formed a partnership with Sophos to fight viruses in emails.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">CourseForum/ProjectForum 2.1
</FONT>
</H3>
<P>
<a href="http://www.courseforum.com">CourseForum Technologies</a>
has announced the
availability of both CourseForum 2.1 and ProjectForum 2.1.
These web-based applications are intended to bring enhanced
interaction, coordination and communication to online or face-to-face
courses, student groups, workgroup projects, business teams, and
corporate intranets. CourseForum and ProjectForum can be hosted on Mac OS
X, Windows, Linux and FreeBSD.
Users need only a standard web browser.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">iConductor Goes Shareware
</FONT>
</H3>
<P> The
<a href="http://www.i-conductor.com">iConductor</a>
Server Module designed to simplify the development
of rules-based web applications on the Apache server is now
available as shareware, including for the Apache Version 2.0.
iConductor's creator,
<a href="http://www.farpointer.com">Farpointer Technologies</a>,
has changed its distribution model to allow unrestricted distribution of
the iConductor module for non-commercial purposes. The target market is
Linux-based Apache server users.
<P> <hr> <P>
<!-- =================================================================== -->
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
<FONT COLOR="green">Other software
</FONT>
</H3>
Nvidia has released new versions the
<a href="http://www.nvidia.com/view.asp?IO=linux">
Linux drivers</a> for its range of graphics cards.
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<P> Mick is LG's News Bytes Editor.
<!-- *** BEGIN bio *** -->
<P>
<IMG ALIGN="LEFT" VALIGN="top" ALT="[Picture]" SRC="../gx/2002/tagbio/conry.jpg"
WIDTH="128" HEIGHT="158">
<em>Born some time ago in Ireland, Michael is currently working on
a PhD thesis in the Department of Mechanical Engineering, University
College Dublin. The topic of this work is the use of Lamb waves in
nondestructive testing. GNU/Linux has been very useful in this work, and
Michael has a strong interest in applying free software solutions to
other problems in engineering. When his thesis is completed, Michael
plans to take a long walk.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Michael Conry.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">HelpDex</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/collinge.html">Shane Collinge</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<EM>These cartoons are scaled down to minimize horizontal scrolling.
To see a panel in all its clarity, click on it.</EM>
<P>
<A HREF="misc/collinge/447monitor.jpg">
<IMG ALT="[cartoon]" SRC="misc/collinge/447monitor.jpg"
WIDTH="640" HEIGHT="240"></A>
<BR CLEAR="all">
<P>
<A HREF="misc/collinge/445flunkie.jpg">
<IMG ALT="[cartoon]" SRC="misc/collinge/445flunkie.jpg"
WIDTH="640" HEIGHT="240"></A>
<BR CLEAR="all">
<P> All HelpDex cartoons are at Shane's web site,
<A HREF="http://www.shanecollinge.com/">www.shanecollinge.com</A>.
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
Part computer programmer, part cartoonist, part Mars Bar. At night, he runs
around in a pair of colorful tights fighting criminals. During the day... well,
he just runs around. He eats when he's hungry and sleeps when he's sleepy.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Shane Collinge.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">Ecol</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/malonda.html">Javier Malonda</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
The Ecol comic strip is written for
<A HREF="http://escomposlinux.org">escomposlinux.org</A> (ECOL), the web site that
supports, es.comp.os.linux, the Spanish USENET newsgroup for Linux. The strips
are drawn in Spanish and then translated to English by the author. Text
commentary on this page is by LG Editor Iron. Your browser has shrunk the
images to conform to the horizontal size limit for LG articles. For better
picture quality, click on each cartoon to see it full size.
<P>
<A HREF="misc/ecol/ecol-95-e.png"><IMG SRC="misc/ecol/ecol-95-e.png" WIDTH="600" HEIGHT="240"></A>
<P>
<A HREF="misc/ecol/ecol-96-e.png"><IMG SRC="misc/ecol/ecol-96-e.png" WIDTH="600" HEIGHT="240"></A>
<P>
<A HREF="misc/ecol/ecol-108-e.png"><IMG SRC="misc/ecol/ecol-108-e.png" WIDTH="600" HEIGHT="240"></A>
<P>
<HR NOSHADE> <!-- ****************************************************** -->
All Ecol cartoons are at
<A HREF="http://tira.escomposlinux.org/">tira.escomposlinux.org</A> (Spanish),
<A HREF="http://comic.escomposlinux.org/">comic.escomposlinux.org</A> (English) and
<A HREF="http://tira.puntbarra.com/">http://tira.puntbarra.com/</A> (Catalan).
The Catalan version is translated by the people who run the site; only a few
episodes are currently available.
<P> <SMALL>These cartoons are copyright Javier Malonda. They may be copied, linked
or distributed by any means. However, you may not distribute modifications. If
you link to a cartoon, please <A
HREF="mailto:jmr@escomposlinux.org">notify</A> Javier, who would appreciate
hearing from you.
</SMALL>
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- *** BEGIN bio *** -->
<!-- P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
</em>
<br CLEAR="all" -->
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Javier Malonda.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">Software development for a Sharp Zaurus SL-5500 Linux PDA</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/forsberg.html">Bruce Forsberg</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<P>Recently I have been looking for an MP3 player that would satisfy several
criteria. One, be usable with Linux and second, be usable with Old Time Radio
shows. I am a big fan of what is called Old Time Radio here in the USA. This
is radio shows from the 1930's, 40's, and 50's. One can buy a CD-R full of
shows all in MP3 format. OTR shows are typically encoded at 24, 32, or 48
kbps in mono format with a sample rate of 22050 and are 1/2 hour to 1 hour in
length. Not all MP3 players work well under these conditions. Thus began my
search for a better solution. After some search I came to the conclusion that
a Linux PDA would be my best bet where I could write custom software to
perform the needed functionality that is required. Since the Sharp Zaurus
SL-5500 uses Linux with Qtopia, a Qt system for embedded systems, this became
an obvious choice since I already know Qt programming on Linux.
<P>When I looked at the Sharp web site I saw two Linux PDA models present for
sale in the USA. The SL-5500 and the SL-5600. At the time of writing this
article the SL-5600 has just become available. There are several main
differences between the two models but the main one is that the SL-5600
contains a 400 Mhz Intel Xscale processor whereas the SL-5500 contains a
206 Mhz Strong ARM SA-1110 processor. I decided on the SL-5500 since that
was the only option when I bought. The 400 Mhz would be nice but not needed
for audio. If I wanted video I would have waited for the 5600. This device
contains a Linux 2.4 Embedix kernel stored in a 16 MB Flash ROM with many
other standard applications. It contains 64 MB SDRAM of which about half
is used for program memory usage and the other half for user program storage.
It contains a host of accessories and other capabilities.
<P>I was able to purchase my Sharp Zaurus SL-5500 new on EBAY for about $300
plus $20 shipping. It came with a docking station with a USB connector and
software for MS Windows. That was several months ago. Now that the SL-5600
has come out the SL-5500 is selling for about $200-$300 new.
<P><H3>SETUP FOR DEVELOPMENT</H3>
<P>In order to learn how to program on this platform I decided that my OTR
MP3 project was too big for a first project so I choose a simpler project.
It is a car mileage calculator. I just purchased a Toyota Prius Hybrid
automobile. Since I get around 45-50 MPG I like to track my mileage. So I wrote
down a few requirements for the program and started out on how to program for
the SL-5500 PDA. The following are my findings.
<P>First you will need several pieces of software. When you develop for the
Sharp Zaurus you will develop in two phases. You will perform all your GUI
layout, coding, debugging, and testing on your Linux Intel box. Then when you
have finished that, you will cross-compile and package the software for the
Sharp Zaurus PDA using the Strong ARM architecture. You will need several
RPMs to accomplish this. Here are the packages that you will need.
<P>qtopia-free-1.X.X-1.i386.rpm -- Qtopia SDK for Linux Intel. Get the latest from <A HREF="http://www.trolltech.com/download/qtopia/index.html">Trolltech's web site.</A>
<P>binutils-cross-arm-2.11.2-0.i386.rpm -- Arm binary utilities for Linux Intel
<P>gcc-cross-sa1100-2.95.2-0.i386.rpm -- Arm cross compiler for Linux Intel
<P>glibc-arm-2.2.2-0.i386.rpm -- Arm glibc
<P>linux-headers-arm-sa1100-2.4.6-3.i386.rpm -- Arm header files
<P>The above 4 files can be obtained from <A HREF="http://docs.zaurus.com/linux_compiler_setup_howto.shtml">the Zaurus Documentation web site</A> along with instructions on how to install them.
<P>To begin with you will need the standard stuff that comes with your Linux
on Intel distribution for compiling C++ programs. Next you will need to
install the Qtopia SDK (Software Development Kit). Please note that there is
a commercial SDK as well as a free SDK. If you use the free SDK you might be
limited as to the licensing of your program. Be sure to read Trolltech's
information regarding this. Once this is installed you will be able to
compile, run, and debug on your Linux on Intel box. When this is done and you
are ready to test your program you will need to install the last 4 rpms
listed above. This will give you the ability to cross compile your program
for the Strong ARM processor.
<P><H3>DEVELOPMENT</H3>
<P>Now that you have development setup you are ready to start developing. If
you have never developed before, the Sharp Zaurus is the ideal platform. This
is because of limited storage and memory the best programs are simple
programs. Full function office suites are not wanted. If you need an idea
then I suggest you look at program search engines for the Palm and Microsoft
OS PDAs. Then look at the Zaurus PDA search engines. When you find an
application that is not available for the Zaurus but is for the others then
chances are this is a good choice. Also choose a program that interests you.
<P>Before you get started you will need to set environment variables for
developing on your Linux on Intel box. You will need to set the following
in your bash shell assuming that you placed the software package in the
default location:
<PRE>
QPEDIR=/opt/Qtopia
QTDIR=/opt/Qtopia
TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-x86-g++/
PATH=$QTDIR/bin:$QPEDIR/bin:${PATH}:/opt/Embedix/tools/bin
LD_LIBRARY_PATH=$QTDIR/lib:${LD_LIBRARY_PATH}
export QPEDIR QTDIR PATH TMAKEPATH LD_LIBRARY_PATH
</PRE>
<P>The next few steps entail developing just like you develop a normal Qt
application. I will not go into this since there have been many articles on
this already. A good book on the subject is published by O'Reilly and is
called "Programming with Qt" by Matthias Kalle Dalheimer. Briefly you will
use designer to create your GUIs. Keep in mind that the display is 240x320.
Then generate a ui file. Next you will create a project file. Usually called
your project name dot pro (ie example.pro). If you need a little help look in
the SDK directory /opt/Qtopia/example. This is an example program that
contains most of the components needed to build a program. Use this .pro
file as a starting point. Once your .pro file is created then you will
generate your Makefile by:
<PRE>
tmake -o Makefile yourprogram.pro
</PRE>
<P>Now start your coding. Create your classes and your slots and connections
as with ordinary Qt programming. When this is completed then build your
program by typing "make". Fix any errors and when you have a successful
build then you are ready to run your program in the emulator. Since the Sharp
Zaurus has no X server you need an emulator to simulate the environment of
the Sharp Zaurus. First you need to run the Qt/Embedded Virtual X11
Framebuffer. In the same shell type:
<PRE>
qvfb &
</PRE>
<P>You should now have an X11 application running that is the emulator. Now
you will need to run the equivalent of a window manager. To do this type in
the same shell:
<PRE>
qpe &
</PRE>
<P>If everything has gone well then you should see an emulation of a Sharp
Zaurus PDA. It is in this environment that you will be able to test and debug
your program. Even though you don't see your program all you need to do to
have it run is to start it from your development directory. Just run your
program normally. You should be able to run it in a debugger as well. You can
now fully test your application.
<P>Your next step is to generate an ipkg file that can be loaded onto your
PDA and installed. ipkg format is the format used on the Sharp Zaurus PDA.
To do this you need to first compile your program for the Strong ARM processor
using the cross compiler and tools that you installed in the section above.
To start with it is best to start a new shell. Once in this shell setup the
following environment variables:
<PRE>
CROSSCOMPILE=/opt/Embedix/tools
QPEDIR=/opt/Qtopia/sharp
QTDIR=/opt/Qtopia/sharp
PATH=$QTDIR/bin:$QPEDIR/bin:$CROSSCOMPILE/bin:${PATH}
TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-sharp-g++/
LD_LIBRARY_PATH=$QTDIR/lib:${LD_LIBRARY_PATH}
export QPEDIR QTDIR PATH LD_LIBRARY_PATH TMAKEPATH
</PRE>
<P>Next you need to generate a new Makefile that is for the Strong ARM
processor. So type:
<PRE>
tmake -o Makefile yourprogram.pro
</PRE>
<P>Then "make clean" to remove all the old object files. Then "make", you
should now be building everything with the cross compiler. Since there is a
limit to the size that a PDA can hold I recommend that you strip your
executable. But, don't make the mistake that I made and use strip. You need
to use the cross compiled strip, in this case arm-linux-strip.
<P>Now that you have your executable you need to package everything in an
ipk file. First you need to create a top level directory, we will use prog
for our example. Next you need to create the following directory trees:
<PRE>
prog/opt/QtPalmtop/bin
prog/opt/QtPalmtop/lib (if needed)
prog/opt/QtPalmtop/apps/Applications
prog/opt/QtPalmtop/help/en/html
prog/opt/QtPalmtop/pics
prog/CONTROL
</PRE>
<P>First of all put your executable in the bin directory. If you have
libraries as well then put them into the lib directory. Your help file will
be in html format. So create a html file with your favorite editor and place
this into the html directory. The file name should be your executable name
dot html. The directory shown above assumes an english
html file (ie en). If you use a different language then you will need to use
a directory other than en. In the pics directory place an image file in png
format that is 32 X 32 pixels. This will show up as the icon used for this
application. This leaves us with two directories, CONTROL and Applications.
In CONTROL you will place a file called control. This will be used for ipk.
In Applications create a file called yourprogramname.desktop.
<P>For my mileage program I use a control file with the following entries:
<PRE>
Package: mileage
Priority: optional
Section: Misc
Version: 2.0
Architecture: arm
Maintainer: Bruce Forsberg forsberg@tns.net
Description: A Car Mileage Calculator Program
</PRE>
<P>The Package field contains the name of the package. Priority should be
optional for most other applications. Section can be Misc for now but should
be changed later to an appropriate value. See the IPKG docs for more
information. Version should be the version of your application. Architecture
should be arm for the SL-5000 and SL-5500 Zaurus PDAs. Maintainer should be
the name and email address of the person maintaining this package. Description
should be a brief description of the program. Depends is an optional field
if your application depends on other packages being present. See the
resources section of this article for more detailed information on the
IPKG format.
<P>If you want your icon to show up in the Qtopia desktop you will need to
add a desktop file in the Applications directory. For the desktop file for
my mileage program I use the entries shown below. The fields should be
self explanatory.
<PRE>
[Desktop Entry]
Comment=A Car Mileage Calculator Program
Exec=mileage
Icon=mileage
Type=Application
Name=Mileage Calculator
</PRE>
<P>Now that we have all these files created and stored into the subtree of
prog we are ready to build the package. Use this
<A HREF="http://docs.zaurus.com/downloads/ipkg-build.sh">script</A>
and then type "ipkg-build.sh
prog". You now have a .ipk file. Simply use the normal methods of loading
software onto zaurus and install your program and test it. If you launch your
program and nothing happens, one thing to try is to install the qpe-terminal
application. This will give you the equivalent of an xterm on the Zaurus.
Start the terminal application and enter your application name from this
window and see if you get any error messages. Also you can type dmesg. This
will display the messages sent to the error log.
<P>I hope this article will inspire you to start programming for the Sharp
Zaurus PDAs. It is a lot of fun and adds to the success of Open Source and
Linux. You also will be surprised just how much you will wind up using your
new PDA. After you finish your project and are ready to release it check out
sourceforge.net. This is a great place to host your project. Then upload your
ipk to the Zaurus PDA search engine at <A HREF="http://www.killefiz.de/zaurus">
http://www.killefiz.de/zaurus.</A> Be prepared
to release another version in a couple of weeks after the first release. You
should fix any major bugs found with this release so that your program will
be useable. Also think like a user when you create your program. Make it as
easy to use as possible. For example for my mileage program I added a GUI
keypad to enter odometer and fuel and a button to enter today's date. Even
though the Zaurus has a keyboard, the GUI keypad makes entry so much easier.
So, get your Zaurus start developing and have fun.
<P><H3>RESOURCES</H3>
<PRE>
How to docs for the Sharp Zaurus - <A HREF="http://docs.zaurus.com">http://docs.zaurus.com</A>
IPKG How to for Sharp Zaurus - <A HREF="http://docs.zaurus.com/ipkg_howto.shtml">http://docs.zaurus.com/ipkg_howto.shtml</A>
IPKG Home Page - <A HREF="http://www.handhelds.org/z/wiki/iPKG">http://www.handhelds.org/z/wiki/iPKG</A>
IPKG build script - <A HREF="http://docs.zaurus.com/downloads/ipkg-build.sh">http://docs.zaurus.com/downloads/ipkg-build.sh</A>
Programming with Qt book - <A HREF="http://www.oreilly.com/catalog/prowqt2">http://www.oreilly.com/catalog/prowqt2</A>
Sharp SL-5500 - <A HREF="http://www.sharpusa.com/products/ModelLanding/0,1058,698,00.html">http://www.sharpusa.com/products/ModelLanding/0,1058,698,00.html</A>
Sharp SL-5600 - <A HREF="http://www.sharpusa.com/products/ModelLanding/0,1058,1016,00.html">http://www.sharpusa.com/products/ModelLanding/0,1058,1016,00.html</A>
Zaurus Developer site - <A HREF="http://www.zaurus.com/dev">http://www.zaurus.com/dev</A>
Zaurus Program Search Engine - <A HREF="http://www.killefiz.de/zaurus">http://www.killefiz.de/zaurus</A>
Must-Have Zaurus Hardware and Software - Linux Journal Jan 2003 Article, not available on-line yet.
Linuxdevices.com article - <A HREF="http://www.linuxdevices.com/articles/AT6553340334.html">http://www.linuxdevices.com/articles/AT6553340334.html</A>
Car Mileage PDA Calculator Home Page - <A HREF="http://mileage.sourceforge.net">http://mileage.sourceforge.net</A>
</PRE>
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
Bruce is just an average guy having fun with Linux. He is the
founder of the
<A HREF="http://osalp.sourceforge.net">Open Source Audio Library Project</A>.
He got his start programing freeware on
windows 3.1. When he realized that all one had to do was to not
return from a message and it would hang the entire operating
system, he knew there had to be a better way. Linux was the answer.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Bruce Forsberg.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">Perl One-Liner of the Month: The Mystery of the Red Worm</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/okopnik.html">Ben Okopnik</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<p> - "It's just a little further along... right through here, Frink." </p>
Woomert and Frink had had a long walk along the tunneled VPN connection,
their footsteps echoing against the titanium walls; once they reached the
comfortable spacious environment of their destination system, Frink had wanted
to pull up a comfortable variable and rest his tired feet, but Woomert had
insisted on pushing on. Now, Woomert turned and entered the room marked "<tt>/var/log/apache</tt>".
<p> "Ah, here we are - there's `<tt>/var/log/apache/access.log</tt>' - and
just in time from the looks of it. The poor thing is up to 400MB and it's
nearly filling up the partition, and it's only been a few days since it
was rolled over!" </p>
Frink, having dropped onto the sparkling clean floor (the system had
recently been swept by "cruft") and arranging himself in a tailor's seat,
stared at the bulging log file in fascination.
<p> - "What happened here, Woomert? I just came in to tell you about the
latest story in the newspapers, praising you to the sky for your solution
to the Missing Databases Mystery <a href="#1">[1]</a> at the Bigrich Bank,
and you dragged me off without a word. Not that I mind, but..." </p>
The famous detective smiled self-deprecatingly.
<p> - "I do tend to get a bit concentrated while on the job, don't I? Oh
well - there are worse things. All right, here is what's happening: the
client, a small company that specializes in making horseshoe welding sprockets
for accountants working in the napkin-fringing industry, has become suspicious
of a few odd things happening with their web site. For example, their response
time often spikes right through the roof, and they've been returning the
`<tt>Server busy</tt>' message much too often as compared to normal operation.
There hasn't been any huge jump in the amount of business they do - less,
since the economy these days doesn't permit too many luxuries like their
product - so..." </p>
Frink nodded.
<p> - "It sounds like a DoS (Denial of Service) attack, Woomert." </p>
- "Indeed." Woomert, deep in thought, pulled on his typing gloves and
approached the local terminal. "This <b>is</b> a highly competitive industry,
you know. This company maintains its lead by ferret-polishing the final product,
but it's a narrow margin; the competitors would all love to get an advantage,
and DoSing their web site just might do it. We've been hired to look around
and report anything unusual, so this is just a statistics gathering mission.
<p> Here, let's test a few things. First, though, lets make a couple of copies
of this file where it won't cram things quite as badly... There, I've put
them both in `<tt>/home/woomert</tt>'. We don't really want to lose any of
the data if we should accidentally damage or destroy one file, do we? Now,
let's zero out the actual log and restart the server... excellent. Now -
on to exploring the files. Given that you suspect a DoS - I do, as well -
what would you look for, Frink?" </p>
Frink scratched his head and frowned in concentration.
<p> - "I'm not sure, Woomert. I think I'd like to figure out the average
hits per IP, and then maybe look at the sorted list of the same. That would
tell us if someone is really slamming this server and from where, don't
you think?" </p>
Woomert smiled happily.
<p> - "Why, Frink, that sounds like an excellent idea! Yes, let's take a
look at the average: </p>
<p></p>
<pre><hr>perl -wlne'/^(\S+)/;$h{$1}++}{print"$h{$_}\t$_"for sort{$h{$a}<=>$h{$b}}keys%h' access.log<hr></pre>
<p> 12.30830039525692<br>
</p>
<p> - "Hmm, interesting. Taking into account that the number is going to
be higher due to the very large DoS entries - we're still assuming those,
but it's a fair bet - that's not an unreasonable number. Most people will
probably examine a few models before making their decision to buy; after
all, it is a once-in-a-lifetime purchase. In fact, this company led the rest
of the pack in offering lifetime warranties... All right - now let's look
at that sorted list: </p>
<pre><hr>perl -wlne'/^(\S+)/;$h{$1}++}{print"$h{$}\t$"for sort{$h{$a}&lt;=&gt;$h{$b}}keys%h' access.log<hr></pre>
<p> </p>
<pre>...<br>22 users.osceola.k12.fl.us <br>26 152.31.2.221 <br>26 modem-140.nyc-tc01a.fcc.net<br>28 62.84.228.7 <br>31 209.106.1.124 <br>103 bdsl.66.13.44.110.gte.net <br>112 24-164-141-122.si.rr.com <br>611 nyny01hsiapat.everestbroadband.com <br>1085 162.66.50.6 <br>2817 web-05.segfl.ifl.net <br>55055 wsip66-210-242-2.ph.ph.cox.net <br>71031 205.213.111.53 <br>85120 pc-80-193-117-84-cw.blueyonder.co.uk <br>97000 151.138.254.21 <br>111092 168.11.225.251<br>122101 syr-24-92-242-3.twcny.rr.com<br>155017 212.85.1.1 <br>175990 pool-68-161-90-99.ny325.east.verizon.net<br>181222 1cust185.tnt15.nyc9.da.uu.net<br>315078 pool-141-155-115-168.ny5030.east.verizon.net<br></pre>
- "Well, well; would you look at that! What's your estimate, Frink?"
<p> Frink stared at the screen for a moment, then nodded. When he spoke,
there was a confident note in his voice. </p>
- "It's a DoS. I'm willing to believe that someone would spend a day
or so browsing this site, so the 103 and the 112 are border cases, but - 315
<i>thousand</i> hits? I don't know that I'd call it a DDoS (a distributed
DoS, where many machines at ones are attempting to flood a given network
or host) because the number of machines is fairly small, but it should definitely
be an issue for further investigation - perhaps contacting the ISPs for
those domains - and a temporary block at the firewall. Woomert, could we
look at a sample entry for the different hits? I have a theory about this.
If it's a long `GET' string, then... I wonder."
<p> Woomert looked thoughtful, then nodded. </p>
- "I see where you're going, Frink, and it's a reasonable possibility.
Here, this will show the longest entry for a given IP:
<p></p>
<pre><hr>perl -lne'/^(\S+).*?"(.*?)"/;length$h{$1}&gt;length$2or$h{$1}=$2}{print"@a"while@a=each%h' access.log<hr></pre>
<p> </p>
<pre>... <br>pool-68-161-90-99.ny325.east.verizon.net GET /default.ida?XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%u7801%u9090%u685 <br>8%ucbd3%u7801%u9090%u9090%u8190%u00c3%u0003%u8b00%u531b%u53ff%u0078%u0000%u00=a<br>HTTP/1.0 <br>syr-24-92-242-3.twcny.rr.com GET /default.ida?XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%u7801%u9090%u6858% <br>ucbd3%u7801%u9090%u9090%u8190%u00c3%u0003%u8b00%u531b%u53ff%u0078%u0000%u00=a<br>HTTP/1.0 <br>1cust185.tnt15.nyc9.da.uu.net GET /default.ida?XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%u7801%u9090%u6 <br>858%ucbd3%u7801%u9090%u9090%u8190%u00c3%u0003%u8b00%u531b%u53ff%u0078%u0000%u00=a<br>HTTP/1.0 <br>212.85.1.1 GET /default.ida?XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%u7801%u9090%u90 <br>90%u8190%u00c3%u0003%u8b00%u531b%u53ff%u0078%u0000%u00=a HTTP/1.0 <br>...<br></pre>
<p> Woomert and Frink looked at the screen, at each other, and exchanged
a high-five salute, with Frink adding his "double twist with finger snaps"
variation. </p>
- "Woo-hoo! I called it right, Woomert. What do you think?"
<p> - "You did indeed, Frink, It looks like a modified version of a common
worm, Code Red. The good news is that we're not dealing with a particularly
sophisticated attacker, though: a Code Red <i>infection attempt</i>, which
is what this is, is not the same thing as a Code Red <i>DoS</i>, which is
just a network slam of a specific IP - <b>and</b> it only works against
legacy operating systems, certainly nothing as modern as Linux - which is
what this site runs. All these guys have going for them is bandwidth, and
that's not particularly bad - and once the client blocks those IPs and notifies
the relevant ISPs, it won't be an issue at all. In fact, there are analysis
and response utilities that can track this sort of thing and do it automatically,
and I'll recommend them to the client. Here - " </p>
Woomert quickly fired off the results and his comments to the client
by piping them into the "mail" program, and turned to Frink.
<p> - "...shall we? I have a <i>Paglia e Fieno con Pollo e Funghi</i> that
should only take a few minutes to finish preparing, a <i>tiramisu</i> made
to my own recipe for desert, and a really great '97<i> Rosso di Cerbaiona</i>
wine that should go well with it all. My girlfriend, the lovely Priority
Interrupt, is going to join us." </p>
- "Well, if you're sure that I won't be in the way..."
<p> - "Nonsense, Frink; we'd love your company."<br>
<br>
</p>
<hr width="100%" size="2">
<p> After dinner, Frink lounged in the big armchair and Priority curled up
in Woomert's lap and lit a huge <i>Toscano</i> cigar, which she used to produce
beautuful double and sometimes triple rings of smoke. At Woomert's inquiring
glance, she reached up and placed the cigar between his lips.</p>
- "Aaah - luxury." Woomert leaned back and blew several rings that interlaced
with Priority's. They smiled at each other. "So, Frink - questions? Answers?
Guesses? Lay it on, my friend."
<p> Frink grinned at the two of them across the room.</p>
- "Sure. I'm getting pretty good at reading those one-liners, though
- I might need a little help, but I think I'm getting there. What was it
you typed, now... ah, here it is - I copied it into my <a
href="http://www.sharp-usa.com/products/ModelLanding/0,1058,698,00.html">Zaurus</a>:
<p> </p>
<pre><hr>perl -wlne'/^(\S+)/;$h{$1}++}{$a=@a=values%h;map{$b+=$_}@a;print$b/$a' access.log<hr></pre>
OK, so - the `-wlne' switches enable warnings; read and print everything
in `line mode', which strips EOL characters before and adds them back after;
loops over the entire file one line at a time; and executes the code that
follows. That's the easy part - I've been studying ``perldoc perlrun'' lately.
Now, the code -
<p><tt> /^(\S+)/</tt> </p>
is a regex that captures all non-space characters starting from the beginning
of the line. If we look at some typical lines from `access.log' -
<p> <tt>127.0.0.1 - - [09/Mar/2003:22:14:46 -0500] "GET / HTTP/1.0" 200 50000
"http://localhost/" "Lynx/2.8.4rel.1 libwww-FM/2.14" webcache-01.segfl.ifl.net
- - [01/Apr/2003:05:45:27 -0500] "GET / HTTP/1.0" "-" 200 5238 </tt></p>
we'll see that it's going to catch the IP or the hostname, either of which
is terminated by a space. Next, I see something you've done before:
<p><tt> $h{$1}++</tt> </p>
That's a frequency count, isn't it?"
<p> At Woomert's encouraging nod and smile, Frink went on. </p>
- "OK. '$1' is a variable created by Perl which holds the first capture
- that is, the contents of the first pair of parentheses in a regex. In this
case, that's the IP. So, you use the IP as a key in the `<tt>%h</tt>' hash
- and increment the value associated with that IP every time you see it. If
it's a new IP, you get a new key.
<p> Next... um. Next, there's a <i>closing</i> brace all by itself... and
I don't understandand what it does - or even why the code works. Shouldn't
that fail with a syntax error?"</p>
Woomert grinned.
<p> "Normally, it would. However - go ahead and pull up ``<tt>perldoc perlrun</tt>''
again, and take a look at the entry for `-p': </p>
<tt> # From ``perldoc perlrun''</tt>
<pre> while (&lt;&gt;) {<br> ... # your program goes here<br> } continue {<br> print or die "-p destination: $!\n";<br> }<br></pre>
Note the ``your program goes here'' comment. What happens if you insert
a closing brace there?"
<p> Frink concentrated on the code. Suddenly, his face lit up. </p>
- "Oh! I see it, I see it! A closing brace would terminate the `while'
statement... and an opening brace after it would create a block just past
it. What you've done is get out of the `while' loop; everything after the
curly brace only gets executed once. This is almost the same as using an
`<tt>END{}</tt>' block. Wonderful! <a href="#2">[2]</a>
<p> All right, since we have that, the rest isn't too tough. Let's see: </p>
<tt> $a=@a=values%h;</tt>
<p> All right, you extract the list of values - all the counts - from the
hash and set `$a' to the number of values returned; that's what you get when
you look at a list in a scalar context (it's a bit more complex than that,
but that's the part that's important right now.) Next, you sum up all those
values - </p>
<p><tt> map{$b+=$_}@a;</tt> </p>
The `map' function iterates over `@a' and increments `$b' by the value
of each of the elements. Last but not least -
<p></p>
<tt> print$b/$a</tt>
<p> you print out the ratio of that sum over the count of the elements - thus
dividing the total hits by the number of IPs. How's that?" </p>
Woomert and Priority clapped and cheered as Frink turned pink and bowed,
smiling.
<p> - "Thank you, thank you... I guess spending all that time studying under
Woomert's direction is starting to pay off - thanks, Woomert! The rest of
them are somewhat similar: </p>
<pre><hr>
perl -wlne'/^(\S+)/;$h{$1}++}{print"$h{$_}\t$_"for sort{$h{$a}&lt;=&gt;$h{$b}}keys%h' access.log<hr></pre>
<p> The first part we already know - do a frequency count of the IPs. In the
end block, however, you do something different; we'll parse it right to left,
just as Woomert taught me: </p>
<p> <tt>sort{$h{$a}&lt;=&gt;$h{$b}}keys%h</tt> </p>
OK - this time, you extract the keys, and... oh, I see. You want to sort
the hash by value, but plain old ``<tt>for ( values %h ){ ... }</tt>'' won't
work - there's no way to retrieve a key given a value, since values aren't
necessarily unique. So, you change the `<tt>sort</tt>' routine - just as
``<tt>perldoc -f sort</tt>'' explains - to sort the keys based on the value.
This is done by using `<tt>$a</tt>' and `<tt>$b</tt>' which are the variables
that Perl uses to hold the elements that `<tt>sort</tt>' is currently comparing.
In return, you get a list that's sorted by value and still allows you to look
at keys - slick! Next, you take that list and print it with a bit of formatting:
<p><tt> print"$h{$_}\t$"for ...</tt> </p>
You loop over the list of returned keys with the "<tt>for</tt>" operator.
The default variable in the loop, `<tt>$_</tt>', contains each key in turn,
and `<tt>$h{$_}</tt>' return its associated value. You then print a tab and
the key - which is the IP or the hostname. This gives us our list of IPs -
and the associated number of hits.
<p> Last but not least, we have this: </p>
<p> </p>
<pre><hr>
perl -lne'/^(\S+).*?"(.*?)"/;length$h{$1}&gt;length$2or$h{$1}=$2}{print"@a"while@a=each%h' access.log
<hr><pre><br></pre></pre>
Whew. It's a tough one. Let's see: the regex isn't too bad -<br>
<br>
<pre>/^(\S+).*?"(.*?)"/<br></pre>
<br>
It captures the IP as before, but now it also matches any character up
to the first double-quote - the '?' modifier following the '*' quantifier
makes the expression non-greedy so that it <i>is</i> the first one - and
captures everything until the next double-quote, with the same non-greedy
method. The first double-quotes... oh, that would be the HTTP request string,
just what we wanted to see. Next... ooops. Woomert - help?"<br>
<br>
<p> Woomert lazily extracted a laser pointer from his shirt pocket and pointed.
</p>
- "I assume you mean this?
<p><tt> length$h{$1}&gt;length$2or$h{$1}=$2</tt> </p>
What I needed to do here is save the longest string as the value. In order
to do that, I had to compare the current value for a given IP with the next
value for that IP that came along. However, the initial value for a new key
is undefined - and Perl would give us an error message if we compared something
to an `undef'. That, as well as the interpolation of "<tt>@a</tt>" at the
end are both things that would cause Perl to generate a non-fatal warning
- so I turned off the warnings by skipping the `-w' switch, something you
should <b>not</b> do unless you understand all the effects of doing so (read
``<tt>perldoc perllexwarn</tt>'' for more.) The method itself is fairly simple:
I compare the length of the value currently assigned to the key; if it is
greater, I replace the old value with the current one (contained in `<tt>$2</tt>').
Note that I'm using the soft `<tt>or</tt>' operator: a logical `<tt>or</tt>'
(<tt>||</tt>) would not work here, since it would bind too tightly to the
surrounding elements.
<p> Can you do the rest?" </p>
Frink nodded.
<p> - "Yes; it looks fairly easy. </p>
<tt> print"@a"while@a=each%h</tt>
<p> I've seen you do this before... oh yes. It's a ``<tt>while each</tt>''
loop that retrieves a key-value pair from a hash; you're assigning them to
an array and printing the array. Since you've interpolated it by using double
quotes around the array name, you'll get a space between the elements - which
makes it nicely readable. All together, this prints out our hash - in more-or-less
random order, but we don't really care since we just want to see what's in
it. Right?" </p>
- "Very good, Frink; you've done very well. I'll be relying on you to provide
some backup in our further adventures, then. Are you ready for it?"
<p> - "I... I hope so, Woomert." Frink looked up, proud as can be. "I believe
so. I'll certainly do my best. I'll head off for home then, and leave you
two alone. Have a great night." </p>
As the door closed behind the inordinately proud Frink, Priority smiled
at Woomert.
<p> - "You've made Frink's week, you know. That's quite a compliment." </p>
- "He deserves it; he's learned quite a lot. I'm very pleased with him,
and quite proud of him. And now, Priority," Woomert's laser pointer fired
a beam at the stereo, which softly began to play an Ella Fitzgerald/Luis Armstrong
rendition of ``<i>Can Anyone Explain</i>'', "we have far more important things
to discuss than Frink or programming..."
<p> </p>
<hr> <tt><a name="1"></a>[1] In regard to this, my mysterious correspondent
notes: "This is a case where continued secrecy is necessary to the Bank's
security arrangements. Perhaps one day, the world will be apprised of the
brilliant, decisive, and above all courageous actions of the Great Detective
and his assistant." <br>
<br>
<a name="2"></a>[2] Woomert, as my correspondent noted, does not take credit
for this particular Perl hack; it was created by Abigail in </tt><tt>comp.lang.perl.misc
and seems to have become an idiom, at least to a degree. In fact, Abigail's
brilliant one-liners have been known to stump Woomert on occasion... <br>
</tt>
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<P> Ben is a Contributing Editor for Linux Gazette and a member of
The Answer Gang.
<!-- *** BEGIN bio *** -->
<P>
<IMG ALT="picture" SRC="../gx/2002/tagbio/ben-okopnik.jpg" WIDTH="199"
HEIGHT="200" ALIGN="left" HSPACE="10" VSPACE="10">
<em>
Ben was born in Moscow, Russia in 1962. He became interested in
electricity at age six--promptly demonstrating it by sticking a fork into
a socket and starting a fire--and has been falling down technological mineshafts
ever since. He has been working with computers since the Elder Days, when
they had to be built by soldering parts onto printed circuit boards and
programs had to fit into 4k of memory. He would gladly pay good money to any
psychologist who can cure him of the resulting nightmares.
<p>Ben's subsequent experiences include creating software in nearly a dozen
languages, network and database maintenance during the approach of a hurricane,
and writing articles for publications ranging from sailing magazines to
technological journals. Having recently completed a seven-year
Atlantic/Caribbean cruise under sail, he is currently docked in Baltimore, MD,
where he works as a technical instructor for Sun Microsystems.
<p>Ben has been working with Linux since 1997, and credits it with his complete
loss of interest in waging nuclear warfare on parts of the Pacific Northwest.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Ben Okopnik.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">Book Review: Perl for System Administration</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/puryear.html">Dustin Puryear</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<TABLE><TR>
<TH ALIGN="left">Title:</TH>
<TD ALIGN="left">Perl for System Administration</TD>
</TR><TR>
<TH ALIGN="left">Author:</TH>
<TD ALIGN="left">David N Blank-Edelman</TD>
</TR><TR>
<TH ALIGN="left">Publisher:</TH>
<TD ALIGN="left">O'Reilly &amp; Associates</TD>
</TR><TR>
<TH ALIGN="left">Published:</TH>
<TD ALIGN="left">July 2000</TD>
</TR><TR>
<TH ALIGN="left">Cost:</TH>
<TD ALIGN="left">$34.95</TD>
</TR></TABLE>
<P> Perl is a great programming language. While not the most
aesthetically pleasing or the most rigorously structured,
the language is powerful, flexible, and very close to being
ubiquitous in the networking world. And for system
administrators Perl fulfills a very important need as a tool
language: The ability to work, and to work well, under both
Windows and UNIX.
<P> There are a lot of useful things that you can do with Perl,
including managing users, adjusting quotas, and monitoring
log files and the Event Log. In Windows you can do much of
this in Windows Scripting Host (WSH), and UNIX users have
long had other tools to do these jobs. However, Perl is a
major player these days in managing mid-size to large
systems, and with Perl there comes a higher level of
integration in managing disparate systems.
<P> In 2000 O'Reilly &amp; Associates published "Perl for System
Administration," by David N Blank-Edelman. This book,
despite having been published two years ago, is still an
excellent resource for Windows and UNIX system
administrators alike. Better yet, if you are managing a
mixed environment, Blank-Edelman's book is even more valuable
because of the emphasis on using Perl as a cross-platform
tool to help manage UNIX, Windows, and even the Mac.
<P> "Perl for System Administrators," weighing in at 418 pages,
includes a very wide range of topics. The ten chapters,
"Introduction," "Filesystems," "User Accounts," "User
Activity," "TCP/IP Name Services," "Directory Services,"
"SQL Database Administration," "Electronic Mail," "Log
Files," and "Security and Network Monitoring," form a solid
foundation for building solutions across systems.
<P> Now what is truly interesting about this book is the focus
on supplying either cross-platform solutions, or if that
doesn't directly apply, of ensuring that both Windows and
UNIX needs are addressed in some depth for each given topic.
For example, when discussing log monitoring in Chapter 9,
"Log Files," Blank-Edelman discusses how to filter through
both Windows Event Log and UNIX log entries. Using the
information presented in this chapter you can begin to
create a cross-platform log monitoring application for your
own network.
<P> Alas, the focus on the cross-platform aspects of Perl may be
an issue for readers that want either a Windows- or UNIX-
only focus. However, I would argue that it is this very lack
of focus on either platform that brings "Perl for System
Administration" to the next level. (If you are looking to
learn how to use Perl under Windows then "Learning Perl on
Win32 Systems," also by O'Reilly, would be a good choice.)
Essentially, by the end of the book you will have learned to
consider various administrative tasks at a higher-level so
that you can address either Windows or UNIX systems with a
cohesive solution, and in the end this kind of high-level
design gives you a more robust and scalable solution.
<P> As far as caveats, "Perl for System Administration" does
require that you are an intermediate Perl user. The book is
in no way an introduction to Perl, so be prepared to read an
introductory text if you are new to Perl before reading this
book. Also, I did find that some of the Perl modules
mentioned in the book, and that you must install on your own
systems, are difficult to find despite the pointers
presented at the end of each chapter.
<P> If you are responsible for managing more than a few servers
or workstations then I suggest you check this book out.
While you may not use all of the techniques and solutions
presented in the book-for example, not everyone will have
SQL servers to manage-there is more than enough information
presented here to keep you thinking of your own custom Perl
solutions far into the future.
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
Dustin Puryear, a respected authority on Windows
and UNIX systems, is founder and Principle Consultant of Puryear
Information Technology. In addition to consulting in the information
technology industry, Dustin is a conference speaker; has written
articles about numerous technology issues; and authored "Integrate
Linux Solutions into Your Windows Network," which focuses on
integrating Linux-based solutions in Windows environments.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Dustin Puryear.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">setjmp/longjmp Illustrated</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/raghu.html">Raghu J Menon</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<p>The setjmp/longjmp set of macros implemented in the C
programming language provide the perfect platform to perform complex
flow-control, but make sure that you have gained adequate knowledge about them,
before you actually use them, or else&nbsp; your programs could become so complex
that it would be impossible to discern them. </p>
<p>What do they do?</p>
<p>The setjmp function saves the state of a program. The state of
a program to be precise are the values of sp (stack pointer), fp (frame
pointer), pc (program counter). A program state is completely defined by these
set of registers and the contents of the memory, which includes the heap and the
stack. The next obvious question would be, why do i need to save the state for?
Well simple to restore it later through longjmp. So these functions hunt
in pairs i.e. setjmp saves the state, longjmp restores it.</p>
<H2>The syntax....</H2>
<p>The syntax is quite simple. setjmp stores the state of the
program in a variable of type jmp_buf (defined in the header file setjmp.h).
Always include the header file while working with these functions.</p>
<CODE>
<p>int setjmp (jmp_buf env);</p>
<p>int longjmp(jmp_buf env , int val);</p>
</CODE>
<p>The longjmp function restores the state of the program that is
stored in env. The purpose of the parameter val will be explained later. So what
does all this add upto? Simply that the longjmp function never returns (another
one after exec). Before encountering a longjmp there has to be a setjmp which
saves the state in env and returns a value 0. When you encounter longjmp next
the state stored in env is restored and the program execution resumes at the
instruction after setjmp. It is as though the longjmp returned through setjmp.
This return should yield a value though and that value is what is specified
through the parameter val.</p>
<CODE>
<p>i = setjmp (env);//Stores the state in env and returns 0</p>
<p>...........&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Resume execution
at this point after the longjmp call as though the setjmp call</p>
<p>.......&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//returned. </p>
<p></p>
<p></p>
<p>&nbsp;</p>
<p>longjmp(env,val)</p>
</CODE>
<p>As a last point, try printing the value of i. You would get 2
values, the first one is that obtained when setjmp saves the state and will be 0
always. The second one will be the value that you pass to longjmp through the
val parameter. So the code after setjmp seems to get executed more than once.
That calls for some exploration. We therefore have our first code and an
interesting one too. <a href="misc/raghu/if-else.c.txt">if-else.c</a></p>
<p>&nbsp;Compile and run it. I hope you noticed it, both the if
and else part of the condition are executed! Now, that is not how if-else
condition is supposed to work. Looks like fork() (parent executing the if part
and child executing the else or vice-versa). Well in fork we have two different
threads of execution, that is not the case here. The setjmp call saves the state
in env and returns 0. The if condition evaluates to true and you get the first
message. Now later in the code when longjmp is executed the state is restored
and you return to the statement following setjmp with a return value 2. </p>
<p>This
return value is specified in the longjmp call. Now you see why the if condition
failed and the else was executed. In addition the program showed disparity by
not executing the last line. Well as i said earlier longjmp never returns and so
it is quite obvious why the last line is not executed. If you take out the exit
statement the code falls into a never ending loop alternating between the else
part and the longjmp call.</p>
<H2>Some thing more useful please.....</H2>
<p>As programmers you might have written code by dividing it&nbsp;
into functions or subroutines (If not learn the art of functional programming. I
started off by writing a C program as one big main function, gradually though i
was able to split my program into functions. Why?&nbsp; It is easier to debug,
that's why.). In implementing your program as functions there are bound to be
function calls that are nested, that have pretty complex flow as well. Whenever an
error occurs you need to find the function that caused it. This way it is easier
to debug the program. The code below illustrates the use of setjmp/longjmp pair
in debugging such programs. <a href="misc/raghu/nest.c.txt">nest.c</a></p>
<p>Well the program does not do anything useful other than serve
the purpose of illustrating graceful error handling. The code defines 4
functions, each one of them apart from accepting specified number of integer
parameters, also has env as its parameter. The env holds the state of the
program saved by the setjmp call in the main function. The failure in executing
each of the function is specified in the if condition. Compile the program and
execute it. Enter the following sets of values for l, m, n.</p>
<CODE>
<p>Enter values (integer) for l m and n please</p>
<p>1 </p>
<p>4</p>
<p>7</p>
<p>The functions executed normally</p>
<p><br>
Enter values (integer) for l m and n please</p>
<p>0</p>
<p>0</p>
<p>0</p>
<p>There is an error in function 1 exiting..<br>
&nbsp;</p>
<p>Enter values (integer) for l m and n please</p>
<p>1</p>
<p>1</p>
<p>2</p>
<p>There is an error in function 2 exiting..<br>
&nbsp;</p>
<p>Enter values (integer) for l m and n please</p>
<p>0</p>
<p>1</p>
<p>2</p>
<p>There is an error in function 3 exiting..</p>
<p><br>
Enter values (integer) for l m and n please</p>
<p>1</p>
<p>2</p>
<p>3</p>
<p>There is an error in function 4 exiting..<br>
&nbsp;</p>
</CODE>
<p>&nbsp;Well that was useful i suppose. The error message could
tell you where the error occurred. Let us trace the code. The setjmp in the main
function saves the state of the program and returns 0. The if condition equates
to false and therefore is not executed. The next statement calls the function
fun1 with parameters env, l, m, n, fun1 in turn calls fun2 and so on. Whenever
an error occurs in any of these functions a longjmp is executed, the val
parameter being the function number where the longjmp was executed. The program
returns to the main function (to the statement after setjmp) whenever a longjmp
is executed. The value in s now is either 1, 2, 3, 4, depending on where the
longjmp was made from. The if condition now equates to truth value and therefore
an appropriate error message is flagged indicating the function in which the
error occurred. If no error occurred during the execution of the program the
functions return normally and the last statement of the main function is
executed. Why don't i just
use the goto statement to make a jump during an error? Try compiling the code below <a href="misc/raghu/goto.c.txt">goto.c</a>. The error flagged is
because goto can be used only for local jumps. The jumps in the previous program
made by longjmp where non-local ones, goto searches for local labels and hence
cannot make non-local jumps.</p>
<p>&nbsp;</p>
<H2>Vulnerability Of The Programmer........</H2>
<p>There is a subtle bug in setjmp/longjmp, not in its
implementation, but in the way we use it. Most of us are quite unaware and
rightly so of the stack state when we write a program. It is when there is an
error we try and trace it by inspecting the stack (through gdb). Whenever there
is a function call the stack is manipulated. First the arguments to the called
function are pushed in the reverse order. Next the JSR is called to push the
return address (pc) and then the fp, fp and sp are then emptied to make a new
stack frame for the called function. The called function immediately on entry
creates space on the stack for the local variables that might have been declared
in the function. Now that you have an idea of the stack structure, try running
the code below <a href="misc/raghu/seg.c.txt">seg.c</a>.&nbsp; It compiles fine, but alas it fails to run completely
and faults. Could you find the reason? </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Let us trace the
code. The main function calls&nbsp; me_first with 2 arguments,&nbsp; the
arguments are pushed onto the stack env followed by the string &quot;IC-Labs&quot;, the
JSR then pushes the pc and fp values on the stack. On entry&nbsp; the function
creates a local variable i on the stack. This is followed by a call to the setjmp
function which saves the current state, that of me_first function.
The local variable now contains the value 0, value returned by setjmp. After
returning from me_first the&nbsp; stack is returned to the original state, one
in which it left the main function. The i_follow function is called next with a
value 3 and the env variable. The stack is modified as above (when me_first was
called). In the function
the state stored in env is restored by longjmp. The values in the stack remain
the same i.e. as they where during the execution of function&nbsp; i_follow .
The state
though is that of function me_first. The stack frame of this state has a variable of type
(char * )&nbsp; which previously had a string &quot;IC-Labs&quot;. Now after the state has
been restored the value that variable s holds is 3 (the value that i_follow was passed
from the main). As a result of the longjmp the statement following setjmp in
me_first is executed.&nbsp; In executing the statement after setjmp (printf),
there is an illegal memory access since in trying to print out s the program
tries to find a string at memory location 0x3 which causes a memory protection
error and causes the program to fault. This bug is very subtle and often goes
unnoticed, this is because the stack frame of both the functions look almost the
same. In cases were the stack frames are the same there is no such error. Try
replacing the argument &quot;char *&quot; with one of type int, and rerun it. Did it fault?</p>
<H2>Signal Handling........</H2>
<p>One of the beauties of these functions is that you can longjmp
from a signal handler and return to your program and catch those signals again.
Check out the program below <a href="misc/raghu/sig.c.txt">sig.c</a></p>
<p>The main function installs a signal handler using the signal
system call, parameters are the signo(SIGALRM), which indicates the signal
for which you are setting up the handler and the handler routine which is
executed when the signal occurs. The alarm call sends the&nbsp;&nbsp; SIGALRM
signal to the program every second. The alarm_handler basically longjmps out
after 8 seconds have passed.&nbsp;&nbsp;&nbsp; </p>
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
I am almost through with my graduate studies in computer
science and engineering. I hail from Trichur (a small town in god's own country,
Kerala). Any constructive criticism with regards to the style and content are
welcome. Please feel free to contact me via e-mail.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Raghu J Menon.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">The CUPS printing system</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/ward.html">Alan Ward</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<p>The CUPS printing system is what its name says: a Common Unix Printing
System. It is aimed at providing a common printing interface across a local
network, masking differences between the printing system on each computer.
While I am not sure that such a system is really needed in a
purely Linux environment where the standard Berkely LPD provides this functionality,
CUPS does provide interactivity with SMB and Windows printers. CUPS also
allows dynamic printer detection and grouping.</p>
<p>CUPS is licenced under GPL by a company called Easy Software Products.
Besides providing CUPS itself as free software, it also provides commercial
addons and support.</p>
<p>You can get it from <a href="http:/www.cups.org">www.cups.org</a>, or as
a RPM package for most distributions (seen it for Mandrake, RedHat and SuSE).</p>
<p><b>How does it work?</b></p>
<p>CUPS can be seen as a replacement of the LPD printing system. It
replaces the lpr command with its own, and the LPD printer drivers
with its own versions. However, it is very similar to LPD in that it is based on
PostScript as its underlying language for page description. Linux
(and Unix) programs won't know the difference between CUPS and LPD.</p>
<p>It contains a list of printer drivers that include most printers with
parallel port, USB and even serial connections. Note serial - connecting
a printer with a null-modem serial line is slow and more difficult to
set up than a parallel line, but it is sufficient for a matrix printer
-- for bulk printing or multiple copies -- and makes an easy way to build
a print server from a pile of older hardware. A hint to schools!</p>
<p><b>Dynamic printer detection</b></p>
<p>CUPS has a characteristic of Windows systems that is not very common in
the Unix world: it broadcasts the printers available on the local
computer to all other computers on the network. In this way, every computer
on the local IP segment gets to know in real time which printers are
available and what their status is.</p>
<p>Naturally, this is -- unlike Windows :-) -- configurable. You can tell
CUPS (in the <i>cupsd.conf</i> configuration file) if and where to broadcast
to, and specify how often the information is refreshed.</p>
<p><b>Grouping printers</b></p>
<p>A printer group -- called a <b>class</b> by CUPS -- is a group of
printers that appears as a single printer to user programs. For example,
you could create a group called ColorPrinters, including all your color
printers. The user could then tell his program to print on printer ColorPrinters,
and the output would be on one of these printers. Which one would depend on
user rights or which printer is currently available.</p>
<p>The fact that a printer is a member of a group does not mean, in itself, that
users cannot use that printer directly. However at CUPS access control level,
you can make the printers reject jobs - while groups accept them. The
end result is that users can use printer groups, not printers. It depends a
bit on the policy on printer use you intend to implement.</p>
<H4>Example 1</H4>
<p>I have a workshop with five computers under Linux, all running CUPS.
When changing a printer on one of them, I:</p>
<ul><li>take the old printer off CUPS,</li>
<li>put in the new printer,</li></ul>
<p>through the CUPS web interface in under 30 secs. That is <b>all</b>
the configuration required - the other computers get their default printing
routes updated in another 30 secs. Under 1 minute for the whole change: less
time than a laser printer takes to warm up.</p>
<H4>Example 2</H4>
<p>I like to provide, in my school network:</p>
<ul><li>A laser B/W printer class, that anybody can print on.</li>
<li>A draft Color class, that anybody can print on - but with restrictions on volume.</li>
<li>A precision Color class, that is only unblocked under my supervision.</li></ul>
<p>Most of these printers hang off Windows boxes and would be directly
available for other computers under Windows. However, by providing them
through CUPS on a central bridge/router, I:</p>
<ul><li>provide a means of centralizing printers - users only have to look
for a printer in a single place;</li>
<li>provide a means of printing on another ethernet segment, <b>without</b>
allowing normal Windows broadcast traffic to get across and
clutter up network bandwidth;</li>
<li>make sure that the teacher printing from his classroom up there on
the third floor of the other building doesn't get stuck because the
departamental printer on the ground floor of this building has run
out of paper - his print job got redirected to the standby printer.</li></ul>
<p><b>Integrating with Windows</b></p>
<p>To use a Windows printer under Linux or the other way round, you will
need to have a Samba server working. Set this up and test it before
going on (as a normal user, try viewing your home directory on the Linux
computer from a Windows box). Remember to turn password encyptation on
in <i>/etc/samba/smb.conf</i> if you are using Windows 98 or a more recent
version.</p>
<p>CUPS can use printers shared from computers under Windows, and network
printers using the SMB protocol. You configure a "Windows printer using
Samba". Basically, all you have to tell CUPS is the address of the printer,
as in: <i>smb://server/printer</i>.</p>
<p>Windows can use a CUPS printer shared by Samba. Proceed in the normal
way to share your printers with Samba: i.e. do not do anything. Your
printers are generally shared by defect. If this is not the case, edit
<i>smb.conf</i> to create the necessary share. All the Samba share options
are appliable. This is because Samba treats a CUPS printer in the same way
as a LPD printer.</p>
<p><b>Network printers</b></p>
<p>Network printers -- i.e. a printer with a network interface, that doesn't
need a host computer to be made available to the network -- can use
any of a variety of protocols:</p>
<ul><li>SMB protocol - you can see it in your Windows network environment
browsing screen.</li>
<li>LPD protocol - several models of Epson printers integrate a TPC/IP
stack and the LPD protocol. You can then access them on port 515 just
like a Linux box. Try using default queue <i>lp</i></li>
<li>A proprietary protocol (not good!).</li></ul>
<p>In the first two cases, proceed as with a printer hosted by a computer.
In the third, you are probably at a dead end. This happened to me with
a Lexmark: I ended up sharing it from a Windows box.</p>
<p><b>Configuration</b></p>
<p>There are two ways of configurating CUPS. One is editing the configuration
file <i>/etc/cups/cupsd.conf</i>. The other is a classical web-based interface
you can access at port 631. This is very similar to the web-based configuration
of many network-capable printers, and should be intuitive for all.</p>
<p align=center><img src="misc/ward/initial_screen.jpg"></p>
<p>Generally, you can access the web interface only from the localhost interface,
not from other computers. However, you can change this by changing the following
lines in the configuration file <i>cupsd.conf</i>, and restarting CUPS:</p>
<pre>
&lt;Location /&gt; # this location is the main screen
Order Deny, Allow
Deny From All
Allow From 127.0.0.1 # allow configuration from local host
Allow From 192.168.1.* # allow configuration from any machine
# on the 192.168.1.0/24 subnet
Allow From mybox.mydomain # this is my desktop on another segment
&lt;/Location&gt;
</pre>
<p>You can also specify one by one which menu items (called <i>Locations</i> in
CUPS terms) are accessible from any particular IP address. This doesn't mean
that other computers will not be able to connect to the server - just that
they won't be able to access contents.</p>
<p>If your Linux box is acting both as a print server and a bridge between
two or more IP segments, you can also specify on which network interfaces it
will listen for requests:</p>
<pre>
Listen 127.0.0.1:631 # Should already be there
Listen servename:631 # Add your server name here
Listen 192.168.1.1:631 # You can also use your IP address
</pre>
<p>In the above example, the web interface will be visible through my eth0 interface
with IP address 192.168.1.1, but not through the eth1 interface with IP
address 172.16.0.1 .</p>
<p>Though user identification is required through basic login/password authentication,
note that you can use SSL to connect to the web interface through
the https secure protocol. This is also relatively easy to configure in
the <i>cupsd.conf</i> file.</p>
<p align=center><img src="misc/ward/help_screen.jpg"></p>
<p>The web interface has a comprehensive help system with plenty of documentation
about what CUPS is and how to configure it.</p>
<p>PS. Should anybody want to translate this article: I wrote it in
the spirit of the GPL software licence. i.e. you are free (and
indeed encouraged) to copy, post and translate it -- but please,
PLEASE, send me notice by email! I like to keep track of translations --
it's good for the curriculum :-)</p>
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
Alan teaches CS in Andorra at high-school and university levels. His hobbies
include science photography (both digital and traditional), trekking, rock and
processor collecting.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Alan Ward.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">Programming with User Mode Linux</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/weber.html">Nick Weber</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
Introduction<br>
Installation<br>
Running<br>
Example 1: Networking<br>
Example 2: System Calls<br>
Example 3: Device Drivers<br>
Example 4: SysV IPC<br>
Code<br>
References<br>
<p>
<h3 align="center">Introduction</h3>
User Mode Linux (UML) is a port of Linux to Linux. It creates a virtual
Linux machine that runs on top of a current Linux installation. This virtual
machine can be run in usermode, which allows you to complete access the linux
kernel of the virtual machine as a normal user. This type of power and flexibility
allows you to try things out on the kernel of the virtual machine without
having to be root on the host machine or rebooting the host machine. Testing
is one of many applications of UML. In this article we will explore some
common things you would do in an operating systems class and see how these
things can be done with UML. The UML project can be found at user-mode-linux.sourceforge.net
and is maintained by Jeff Dike. There is also two mailing lists for the
UML project: the user and development lists.
<p>
<h3 align="center">Installation</h3>
Before beginning note that these instructions will not work on a 2G/2G
host. UML installation is straight forward and easy enough to accomplish
in a short period of time. Three things are required to successfully install
UML:
<ul>
<li>Linux kernel
<li>UML patch that is the same version as the kernel
<li>A root file system
</ul>
You can obtain the Linux kernel from a mirror or go to www.kernel.org to
obtain a Linux kernel. The kernel version must be the same as the UML patch
version. At the time of this writing I used the Linux 2.4.19 kernel with
the uml-patch-2.4.19-45.bz2 patch. The UML patch and root file system can
be acquired from the UML sourceforge site at user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-2.html.
Recommendation: apply the latest skas patch from the UML website to the
host (your machine) kernel. SKAS stands for separate kernel address space.
Without this patch, UML will use tt mode by default. This mode creates
quite a few threads for the UML that is running. The main advantage of
skas mode is that the UML instance will run noticeably faster. From here
there are 4 steps to complete the installation:
<ol>
<li>Unpack the Linux kernel into a directory. It is recommended that you
set up a separate directory other than the one where the source for your
main kernel is stored (Russell). After all, the whole point is to get this
running in user mode and you shouldn't be able to create a Linux kernel in
/usr/src/linux unless you are root.
<li>Apply the UML patch (Russell). cat uml-patch-2.4.19-45.bz2 | bunzip2
- | patch -p1 (Russell)
<li>Create a Linux config file from the source that was unpacked in step
one. make xconfig ARCH=um (Russell, p.2). The defaults are good enough
for the first try.
<li>Compile the kernel with 'make linux ARCH=um' (Russell).
</ol>
<p>
<h3 align="center">Running UML</h3>
Once you have a compiled kernel all you have to do now is run it with the
command 'linux' (Russell). This assumes that you have a root filesystem
in the current directory called root_fs. If you don't then use this command
'linux ubd0=name-of-root-filesystem' (Russell). You should now see a Linux
machine booting up like normal, but in you terminal that you are working
with. The root filesystems that are on the UML website all have a login/password
of root/root and guest/guest for the root and guest account respectively.
<p>
<h3 align="center">Example 1: Networking</h3>
Now that we can run multiple UMLs it's time to make them talk to each other.
There are six ways to get the UMLs to communicate: a switch daemon, ethertap,
TUN/TAP, multicast, slip, slirp, and pcap. The instructions to set up each
of the methods is described at user-mode-linux.sourceforge.net/networking.html.
The method that I found the easiest to set up was TUN/TAP.
<p>
The first step to get TUN/TAP is to install uml_utilities. This
can be obtained from the UML website. To install the utilities untar the
file, cd into the created directory and type 'make install'. This will install
five programs into /usr/bin with uml_net being the one that we are interested
in. uml_net will help do the setup so that the host and UML can communicate.
The only drawback of this method is that uml_net is a setuid program and
can be a possible security vulnerability. The setup that the uml_net program
does can also be done on the host machine as the root user. This will be
covered in a later addition.
<p>
For this example we will setup the host with an ip of 10.0.0.1 and
the UML with 10.0.0.2. On the host machine assign the ip address to the
eth0 interface with 'ifconfig eth0 10.0.0.1'. Now we boot the the UML machine
with the following command './linux eth0=tuntap,,,10.0.0.1'. There are four
paramaters that can be specified for eth0, but we are interested in the first
and last one for now. The first one tells UML which transport to use and
the last paramter specifies the ip of the host machine. A point of confusion
for many is the last paramter. This is the ip of the host machine and not
what you want the ip of the UML to be. After booting login and run 'ifconfig
eth0 10.0.0.2' on the UML machine. Now you should be able to ping, ssh,
ftp, etc to the host machine from UML and vice versa.
<p>
<h3 align="center">Example 2: System Calls</h3>
A fun thing to do with a kernel is to add to it with our own system calls.
This normaly requires root access to the machine and a reboot to use the
system call. Since UML is easy to reboot and we have root access to it we
have everything we need to implement our new system call without rebooting
the host machine or needing root access to it.
<p>
You will need to make changes to three files in the UML kernel directory.
Starting from the UMLkernel directory they are include/asm/arch/unistd.h,
arch/um/kernel/sys_call_table.c, arch/um/kernel/Makefile. The code for the
system call will go in the arch/um/kernel directory. Using the code from
code section as an example do the following:
<ol>
<li>To unistd.h add:<br>
#define __NR_my_new_call 243<br>
The number after __NR_my_new_call may be different in your case but is the
last number of the #define section plus 1.
<li>In sys_call table.c the following changes are required (Karypidis):<br>
extern syscall_handler_t sys_my_new_call;<br>
#define LAST_GENERIC_SYSCALL __NR_my_new_call<br>
[ __NR_my_new_call ] = sys_my_new_call,
<li>In the Make file add:<br>
my_new_call.o to the list of build targets.
<li>Now add the source code for the system call to the arch/um/kernel directory
<li>Compile the UML kernel
</ol>
<br>
To use the system call within UML do the following:
<ol>
<li>Boot and login to UML
<li>Create a user program to make use of the new call. This will also contain the library wrapper for the system call.
<li>Mount the host by 'mount none /mnt -t hostfs'
<li>Compile the test program with 'gcc -I/mnt/path-to-uml-code/include testprogram.c'
<li>Run the test program
</ol>
The reason we have to mount the host machine into UML is that the code for
the system call is located outside of the UML filesystem. This is the only
comparable difference between using a system call in UML and one on the host
machine.
<p>
<h3 align="center">Example 3: Device Drivers</h3>
Another Useful thing to do with UML is to test code for device drivers.
Adding a driver to the UML kerenel is the same process as adding one the
host kernel. First thing is to boot up UML and login. Using the file pp.c
from the code section compile pp.c with 'gcc -Wall -c -O2 pp.c'. This will
produce pp.o, which we will load into the running UML kerenel. More than
likely you will get an error message when trying to insmod the driver about
different kerenel versions between the kernel used to compile the driver
and that of the one used to create the filesystem for the UML root_fs. You
can force the driver to be loaded with the -f switch like so 'insmod -f pp.o'.
Before you can use the driver you will probably need to check /var/log/messages
for the command to add proper device in /dev. To test the driver compile
the test program with 'gcc testprogram.c' and then run the executable. Check
/var/log/messages to be sure the program ran correctly. If it did you should
see a message telling you that the device was opened and then one for the
device being closed. The code and information in this section relies on
Alessandro Rubini's book Linux Device Drivers.
<p>
<h3 align="center">Example 4: SysV IPC</h3>
These examples are taken from the book Beginning Linux Programming.
<p>
<b>Shared Memory</b><br>
Shared memory allows you to map unused memory to be used by multiple processes.
There are four functions that are used to set up and use a shared memory
segment. They are: shmget(), shmat(), shmdt(), shmctl(). Since these functions
are implemented through system calls we can expect to find the underlying
system call of: sys_shmget(), sys_shmat(), sys_shmdt(), sys_shmctl() for
each of the functions respectively. Shared memory in UML is done the same
as you would for the host kernel. Check out shrmem1_sysV.c and shrmem2_sysV.c
for the source code of two programs using a segment of shared memory. Compile
each program with gcc, start shrmem2_sysV in the background then run shrmem1_sysV.
<p>
<b>Message Passing</b><br>
Another way to share data between programs is throught the use of the message
passing API. Like shared memory, the message passing API also has four functions
with underlying system calls. The user functions are msgget(), msgsnd(),
msgrcv(), and msgctl(), while the system calls are sys_msgget(), sys_msgsnd(),
sys_msgrcv(), and sys_msgctl. For an example of message passing compile
the two source files recvmsg_sysV.c and sendmsg_sysV.c. Start recvmsg_sysV
in the background then run sendmsg_sysV to see message passing in action.
<p>
<h3 align="center">Example of Code</h3>
<h4 align="center">Example 2: System Call Code</h4>
<a href="misc/weber/sys_call.c.txt">my_new_call.c</a><p>
#include &lt;linux/kernel.h&gt;<p>
asmlinkage int sys_my_new_call(void) {<br>
printk(KERN_ALERT "sys_my_new_call at your service\n");<br>
return 0;<br>
}
<p>
<a href="misc/weber/test_sys_call.c.txt">testprogram.c</a><p>
#include &lt;sys/types.h&gt;<br>
#include &lt;linux/unistd.h&gt;<p>
static inline _syscall0(int, my_new_call);<br>
int main() {<br>
int result;<br>
result = my_new_call();<br>
}<p>
<h4 align=center>Example 3: Device Driver Code</h4>
<a href="misc/weber/pp.c.txt">pp.c</a><br>
#define __KERNEL__<br>
#define MODULE<br>
#include &lt;linux/module.h&gt;<br>
#include &lt;linux/version.h&gt;<br>
#include &lt;linux/wrapper.h&gt;<br>
#include &lt;linux/fs.h&gt;<br>
#include &lt;linux/sched.h&gt;<br>
#include &lt;linux/ioport.h&gt;<br>
#include &lt;linux/delay.h&gt;<br>
#include &lt;linux/param.h&gt;<br>
#include &lt;linux/interrupt.h&gt;<br>
#include &lt;linux/time.h&gt;<br>
#include &lt;linux/timer.h&gt;<br>
#include &lt;asm/uaccess.h&gt; <br>
#include &lt;asm/io.h&gt;<p>
#define true 1<br>
#define false 0<p>
/* This will be the name we choose for our device. We will also
use this as a prefix on functions such as the entry points
appearing in the file_operations struct.
*/<br>
#define DEV_NAME "pp"<br>
static int Major;<p>
/* These are prototypes for residents of the file_operations struct
*/<br>
static ssize_t pp_read(struct file *, char *, size_t, loff_t *);<br>
static ssize_t pp_write(struct file *, const char *, size_t, loff_t *);<br>
static int pp_open(struct inode *, struct file *);<br>
static int pp_close(struct inode *, struct file *);<p>
/* This is the file_operations struct. The init_module function
will register this with the kernel so the kernel will know all
the entry points it contains.
*/<br>
struct file_operations Fops = {<br>
owner: THIS_MODULE,<br>
read: pp_read,<br>
write: pp_write,<br>
open: pp_open,<br>
release: pp_close,<br>
};<p>
/* The pp_probe function does nothing here, but reminds us that a
'real' driver may need to probe for hardware resources. These
resources might later be allocated in init_module.
*/<br>
static int pp_probe(void){<br>
return 0;<br>
}<p>
/* The pp_read function is a stub, but at least does a printk,
for tracing purposes, when it is called.
*/<br>
static ssize_t pp_read(struct file *file, char *buff, size_t ctr, loff_t *woof) {<br>
printk(KERN_ALERT "\npp_read active.\n");<br>
return 0; <br>
}<p>
/* The pp_write function is a stub, but at least does a printk,
for tracing purposes, when it is called.
*/<br>
static ssize_t pp_write(struct file *file, const char *buff, size_t ctr, loff_t *woof) {<br>
printk(KERN_ALERT "\npp_write active.\n");<br>
return 0; <br>
}<p>
/* The pp_open function does a printk for tracing purposes.
*/<br>
static int pp_open(struct inode *inode, struct file *file) {<br>
printk(KERN_ALERT "\nAn instance of %s has been opened.\n", DEV_NAME);<br>
return 0;<br>
}<p>
/* The pp_close function does a printk for tracing purposes.
*/<br>
static int pp_close(struct inode *inode, struct file *file) {<br>
printk(KERN_ALERT "\nOne instance of %s has been closed.\n", DEV_NAME);<br>
return 0;<br>
}<p>
/* Next we'll see that that init_module<br>
* registers the file_operations struct so the kernel will know
about the entry points therein<br>
* gets back a major number<br>
* calls pp_probe, to look for hardware resources<br>
Had hardware resources been found, they would need to be allocated
for use by this driver, probably within the scope of init_module.
*/<br>
int init_module(void) {<br>
Major = register_chrdev( 0, DEV_NAME, &Fops);<br>
if (Major < 0) {<br>
printk("Registration Failure!\n");<br>
return Major; <br>
}<br>
if (pp_probe() < 0) {<br>
unregister_chrdev(Major, DEV_NAME);<br>
printk(KERN_ALERT "pp_probe() failure!\n");<br>
return -1;<br>
}<br>
printk(KERN_ALERT "\nRegistered %s, at major number = %d.\n\n", DEV_NAME, Major);<br>
printk("To use %s, you must create a device file.\n", DEV_NAME);<br>
printk("If this has not already been done, then enter:\n");<br>
printk(" mknod /dev/%s c %d 0\n\n", DEV_NAME, Major);<br>
printk("Also set appropriate permissions for /dev/%s.\n\n", DEV_NAME); <br>
return 0;<br>
}<p>
/* The cleanup_module function unregisters the driver and, in a
'real' driver would free up any resources allocated by
init_module.
*/<br>
void cleanup_module(void) { <br>
int ret;<br>
ret = unregister_chrdev(Major, DEV_NAME);<br>
if (ret < 0)<br>
printk(KERN_ALERT "\nUnregistration problem where ret = %d\n\n", ret);<br>
else <br>
printk(KERN_ALERT "\nUnregistered %s, at major number = %d\n\n", DEV_NAME, Major); <br>
}<p>
<a href="misc/weber/test_driver.c.txt">testprogram.c</a><p>
#include &lt;stdio.h&gt;<br>
#include &lt;stdlib.h&gt;<br>
#include &lt;fcntl.h&gt;<br>
#include &lt;unistd.h&gt;<p>
#define DEVICE "/dev/pp"<p>
int main() {<br>
int ddfd = 0;<br>
int ret = 0;<br>
ddfd = open(DEVICE, O_RDWR);<br>
if (ddfd < 0) {<br>
printf("\nOpen of %s failed.\n", DEVICE);<br>
exit(-1);<br>
}<br>
printf("\nOpen of %s succeeded.\n", DEVICE);<br>
ret = close(ddfd);<br>
if (ret < 0) {<br>
printf("\nClosing %s failed.\n", DEVICE);<br>
exit(-1);<br>
}<br>
printf("\n Close of %s succeeded.\n", DEVICE);<br>
exit(0);<br>
} <p>
<h4 align=center>Example 4: Shared Memory</h4>
<a href="misc/weber/shrmem1_sysV.c.txt">shrmem1_sysV.c</a><br>
/* sysV IPC shared memory - write to shared memory<br>
shrmem1_sysV.c<br>
meant to be used with shrmem2_sysV:<br>
start shrmem2_sysV in background,<br>
then start shrmem1_sysV
*/<p>
#include &lt;unistd.h&gt;<br>
#include &lt;stdlib.h&gt;<br>
#include &lt;stdio.h&gt;<br>
#include &lt;string.h&gt;<br>
#include &lt;sys/types.h&gt;<br>
#include &lt;sys/ipc.h&gt;<br>
#include &lt;sys/shm.h&gt;<br>
#define MEM_SZ 4096<p>
struct shared_use_st {<br>
int writ_by_you;<br>
char some_text[BUFSIZ];<br>
};<p>
int main() {<br>
int run = 1;<br>
void *shared_mem = (void *) 0;<br>
struct shared_use_st *shared_stuff;<br>
char buffer[BUFSIZ];<br>
int shmid;<p>
shmid = shmget( (key_t)1234, MEM_SZ, 0666 | IPC_CREAT);<br>
if (shmid == -1) {<br>
perror("shmget in shrmem1_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
shared_mem = shmat(shmid, (void *)0, 0);<br>
if (shared_mem == (void *)-1) {<br>
perror("shmat in shrmem1_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
printf("memory attached at %X\n", (int)shared_mem);<br>
shared_stuff = (struct shared_use_st *)shared_mem;<br>
while (run) {<br>
while (shared_stuff->writ_by_you == 1) {<br>
sleep(3);<br>
printf("Waiting for client ...\n");<br>
}<br>
printf("Enter some text: ");<br>
fgets(buffer, BUFSIZ, stdin);<br>
strcpy(shared_stuff->some_text, buffer);<br>
shared_stuff->writ_by_you = 1;<br>
if (strncmp(buffer, "end", 3) == 0) {<br>
run = 0;<br>
}<br>
}<br>
if (shmdt(shared_mem) == -1) {<br>
perror("shmdt in shrmem1_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
exit(EXIT_SUCCESS);<br>
}<p>
<a href="misc/weber/shrmem2_sysV.c.txt">shrmem2_sysV.c</a><br>
/* sysV IPC shared memory - read from shared memory<br>
shrmem2_sysV.c<br>
meant to be used with shrmem1_sysV:<br>
start shrmem2_sysV in background,<br>
then start shrmem1_sysV<br>
*/<p>
#include &lt;unistd.h&gt;<br>
#include &lt;stdlib.h&gt;<br>
#include &lt;stdio.h&gt;<br>
#include &lt;string.h&gt;<br>
#include &lt;sys/types.h&gt;<br>
#include &lt;sys/ipc.h&gt;<br>
#include &lt;sys/shm.h&gt;<br>
#define MEM_SZ 4096<p>
struct shared_use_st {<br>
int writ_by_you;<br>
char some_text[BUFSIZ];<br>
};<p>
int main() {<br>
int run = 1;<br>
void *shared_mem = (void *) 0;<br>
struct shared_use_st *shared_stuff;<br>
int shmid;<p>
shmid = shmget( (key_t)1234, MEM_SZ, 0666 | IPC_CREAT);<br>
if (shmid == -1) {<br>
perror("shmget in shrmem2_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
shared_mem = shmat(shmid, (void *)0, 0);<br>
if (shared_mem == (void *)-1) {<br>
perror("shmat in shrmem2_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
printf("memory attached at %X\n", (int)shared_mem);<br>
shared_stuff = (struct shared_use_st *)shared_mem;<br>
shared_stuff->writ_by_you == 0;<br>
while (run) {<br>
if (shared_stuff->writ_by_you == 1) {<br>
printf("You_wrote: %s", shared_stuff->some_text);<br>
sleep(rand() % 4);<br>
shared_stuff->writ_by_you = 0;<br>
if (strncmp(shared_stuff->some_text, "end", 3) == 0) {<br>
run = 0;<br>
}<br>
}<br>
}<br>
if (shmdt(shared_mem) == -1) {<br>
perror("shmdt in shrmem2_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
if (shmctl(shmid, IPC_RMID, 0) == -1) {<br>
perror("shmctl in shrmem2_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
exit(EXIT_SUCCESS);<br>
}<br>
<h4 align=center>Example 4(cont): Message Passing</h4>
<a href="misc/weber/sendmsg_sysV.c.txt">sendmsg_sysV.c</a><br>
/* sysV IPC message passing - sender<br>
sendmsg_sysV.c<br>
meant to work with recvmsg_sysV:<br>
start rcvmesg_sysV in background,<br>
then start sendmsg_sysV<br>
*/<p>
#include &lt;stdlib.h&gt;<br>
#include &lt;stdio.h&gt;<br>
#include &lt;string.h&gt;<br>
#include &lt;sys/types.h&gt;<br>
#include &lt;sys/ipc.h&gt;<br>
#include &lt;sys/msg.h&gt;<br>
#define BUF 1024<p>
struct my_msg_st {<br>
long int my_msg_type;<br>
char some_text[BUFSIZ];<br>
};<br>
int main() {<br>
int run = 1;<br>
struct my_msg_st some_data;<br>
int msqid;<br>
char buffer[BUF];<br>
msqid = msgget( (key_t)1234, 0666 | IPC_CREAT);<br>
if (msqid == -1) {<br>
perror("msgget in sendmsg_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
while (run) {<br>
printf("Enter some text:");<br>
fgets(buffer, BUF, stdin);<br>
some_data.my_msg_type = 1;<br>
strcpy(some_data.some_text, buffer);<br>
if (msgsnd(msqid, &some_data, BUF, 0) == -1) {<br>
perror("msgsnd in sendmsg_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
if (strncmp(buffer, "end", 3) == 0) {<br>
run = 0;<br>
}<br>
}<br>
exit(EXIT_SUCCESS);<br>
}<p>
<a href="misc/weber/recvmsg_sysV.c.txt">recmsg_sysV.c</a><br>
/* sysV IPC message passing - receiver
recvmsg_sysV.c
meant to work with sendmsg_sysV:
start recvmsg_sysV in background,
then start sendmsg_sysV
*/<p>
#include &lt;stdlib.h&gt;<br>
#include &lt;stdio.h&gt;<br>
#include &lt;string.h&gt;<br>
#include &lt;sys/types.h&gt;<br>
#include &lt;sys/ipc.h&gt;<br>
#include &lt;sys/msg.h&gt;<p>
struct my_msg_st {<br>
long int my_msg_type;<br>
char some_text[BUFSIZ];<br>
};<p>
int main() {<br>
int run = 1;<br>
struct my_msg_st some_data;<br>
int msqid;<br>
long int msg_to_recv = 1;<br>
msqid = msgget( (key_t)1234, 0666 | IPC_CREAT);<br>
if (msqid == -1) {<br>
perror("msgget in recvmsg_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
while (run) {<br>
if (msgrcv(msqid, &some_data, BUFSIZ, msg_to_recv, 0) == -1) {<br>
perror("msgrcv in recvmsg_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
printf("You wrote: %s", some_data.some_text); <br>
if (strncmp(some_data.some_text, "end", 3) == 0) {<br>
run = 0;<br>
} <br>
}<br>
if (msgctl(msqid, IPC_RMID, 0) == -1) {<br>
perror("msgctl in recvmsg_sysV failed");<br>
exit(EXIT_FAILURE);<br>
}<br>
exit(EXIT_SUCCESS);<br>
}<p>
<p>
<h3 align="center">References</h3>
Karypidis, Alexandros. "Adding a System Call" Online. Internet. 25, March 2002 Available: user-mode-linux.sourceforge.net/lksct.
<p> Mathew, Neil, Richard Stones <u>Beginning Linux Programming.</u> 2nd ed. Wrox Press, Inc., September 1999.
<p> Rubini, Alessandro, Jonathan Corbert. <u>Linux Device Drivers.</u> 2nd ed. O'Reilly Associates, Incorporated, July 2001.
<p> Russell, Rusty. "User Mode Linux HOWTO". Online. Internet. 18, June 2002. Available: user-mode-linux.sourceforge.net/UserModeLinux-HOWTO.html.
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
I am currently pursuing a graduate degree in Computer Science from Eastern
Washington University in Cheney, Washington, USA.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, Nick Weber.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
</BODY></HTML>