learning unix programming by studying unix source code ?

learning unix programming by studying unix source code ?

Post by Ognen Duzlevs » Mon, 02 Mar 1998 04:00:00



Hi,
would it be a good way to learn unix programming to the bottom if
one would work thru source codes of some of the freely available
unixes (like linux for example) ? This assumes one knows assembler
and C.

Thanx,
OggieD.
=========================================================================

Cmpt.Sci major - 1st year      
University of Saskatchewan      
Saskatoon, Canada
========================================================================

 
 
 

learning unix programming by studying unix source code ?

Post by Prince of Darkne » Mon, 02 Mar 1998 04:00:00




Quote:>would it be a good way to learn unix programming to the bottom if
>one would work thru source codes of some of the freely available
>unixes (like linux for example) ? This assumes one knows assembler
>and C.

------- I am sure that there are differing opinions on this, but my
view is that this is not a good idea. If you want to learn coding,
you don't look at the most convoluted, optimized and sick code
out there, written and patched up by a dozen people who never saw
each other. In kernel code (linux is a good example, as is most
gnu stuff), you will see lines that just don't make sense, and you
may even feel they are not needed, but in some module, 10 calls
later, what those lines do will affect how this module behaves, or
even if it works. This is now way to learn anything. you'll just
get frustrated.

Try looking up some simple programs if you're just beginning. But if
you want to know unix really well, then by all means check out the
kernel.

--
 Mariusz Zydyk                       http://www.ucalgary.ca/~mszydyk/

         How do you make holy water? Boil the hell out of it.

 
 
 

learning unix programming by studying unix source code ?

Post by Mouse Bousfiel » Mon, 02 Mar 1998 04:00:00



Quote:> Hi,
> would it be a good way to learn unix programming to the bottom if
> one would work thru source codes of some of the freely available
> unixes (like linux for example) ? This assumes one knows assembler
> and C.

Depends on what stage of learning you are currently in:  if you aren't
thoroghly familiar with concepts like, say, fork, go to the Linux
Documentation Project and grab yourself a copy of the Linux Programmer's
Guide.  Once you're well-informed on that stuff, go grab yourself a copy
of the Kernel Hacker's Guide and use that as your tour guide through the
source.  This is, of course, if you decide to do this with Linux.  
Regardless of which free *nix you pick, you'll learn a lot more if you
play as you read... just don't go messing with a machine you depend on
without backing stuff up :-)  Have fun.

--------------------------------------------------------------------
Melissa "Mighty Mouse" Bousfield, Friendly YUCC System Administrator
http://www.yucc.yorku.ca/~mouse/                     _--/)     .--.
"On the side of the software box, it said           / o  `\   /    \
 'Requires Windows95 or Better.'                  -*-      \  \__, |
 So I installed Linux..."                           `       `-____/      
--------------------------------------------------------------------

 
 
 

learning unix programming by studying unix source code ?

Post by R!ch » Tue, 03 Mar 1998 04:00:00



> Try looking up some simple programs if you're just beginning. But if
> you want to know unix really well, then by all means check out the
> kernel.

This is good advice, but the canonical reference is surely the Lions
Book.  It has a complete listing of the Version 6 source, and it's
full of commentry and annotations - excellant stuff!

--

If it ain't analogue, it ain't music.
#include <disclaimer.h>                          \\|// - ?
                                                 (o o)
          /==================================oOOo=(_)=oOOo========\

          |                                                       |
          |                                                       |
          |                          WWW: www.rkdltd.demon.co.uk  |
          |                                 .oooO                 |
          |                                  (  )  Oooo.          |
          \===================================\ (==(   )==========/
                                               \_)  ) /
                                                   (_/

 
 
 

learning unix programming by studying unix source code ?

Post by David Ste » Thu, 05 Mar 1998 04:00:00




Quote:

>would it be a good way to learn unix programming to the bottom if
>one would work thru source codes of some of the freely available
>unixes (like linux for example) ? This assumes one knows assembler
>and C.

You can learn a lot by reading source, but you have to _somehow_ know
that it's written by someone who knows what he's doing.

A delicate question is, how to know this, because it's not because
someone's famous, that he's also good.  Anyhow, I've read public domain
source code from Bill Joy and Brian Kernighan, for instance.  Just out
of curiosity.

Actually in the Kernighan case, it was also to compile his "nawk" on my
machine.  An interesting thing was that there was a name clash between a
function called isnumber() in his program and a nonstandard ctype.h
function or macro of the same name.

I sent email to bwk and proposed to use the name "nawk_isnumber()"
instead of "isnumber()" upon which I got immediately a furious reply
("they have to fix their header, *I* am not going to change the name of
my function. isnumber() is a perfectly good identifier").

So apparently he doesn't like that you prepend prefixes to identifiers.
This sort of thing makes sense if you think of it.

But well, it's just stylistic after all.  Important, yes, but I would
not like to draw too far-reaching conclusions out of this ("all
programmers that use prefixes make mistakes" or something like that,
would be wrong, right?).

David.

 
 
 

learning unix programming by studying unix source code ?

Post by Venu » Sun, 08 Mar 1998 04:00:00


you're ambitious and mastering by rummaging thru source code will tell you
something about the
core OS. UNIX is made of hundreds of other utilities, libraries which won't
be a part of kernel code.

the better way would be to first understand the OS, the usual usage of UNIX
(maurice bach's bible, the UNIX OS) , simple programs-so that once u have a
suffieciently good understanding of the
system, you can move over to the kernel code.

and my experience as a programmer tells me that reading thru source code of
1000's of lines is a bad way to learn things. that is if u learn anything at
all.


> Hi,
> would it be a good way to learn unix programming to the bottom if
> one would work thru source codes of some of the freely available
> unixes (like linux for example) ? This assumes one knows assembler
> and C.

> Thanx,
> OggieD.
> =========================================================================

> Cmpt.Sci major - 1st year
> University of Saskatchewan
> Saskatoon, Canada
> ========================================================================

--

motorola israel's excellent online learning site on :
"http://libra.miel.mot.com/~mvenu/tools.html" under "online learning"

 
 
 

1. Unix network programming; compiling source code problem

Hi! I am new to unix network programming. I am currently learning
from the book "Unix Network Programming; networking APIs: Sockets and XTI"
I followed the instruction on README. After I've compiled by command
"./configure", then try to compile the subdirectories, it gives an error
like follows:

for example,


gcc -g -02 -D_REENTRANT -Wall -c -o daytimetcpcli.o daytimetcpcli.c
In file included from daytimetcpcli.c:1:
unp.h:144:redefinition of 'struct in_pktinfo'
make: *** [daytimetcpcli.0] Error 1

I don't know why there's error and couldn't find any clue. I compiled it on
linux redhat 6.2 and the source code was downloaded from
http://www.kahola.com/start
source file: unpv12e.tar.gz

Anyone can help, thank you!

2. LinuxPPC on blue-G3?

3. W: Source Code for "UNIX System V Network Programming, Stephen A. Rago

4. Setting up serial port

5. Advanced UNIX Programming source code

6. how to hang up ppp

7. Unix network programming; compiling source code problem

8. Linux dialup server

9. source code from Unix networking programming Networking APIs:Sockets and XTI

10. Source code for "Programming with Unix Threads" Charles Northrup

11. where can I find source code for Unix System Programming Using C++ by Terrance Chan

12. problems with config source code of unix network programming volume2..