[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: learning



> > If i wish to start study the source code of Hurd from where i have to start?
> > Any advice will be very useful.
> Get hurd from cvs and look at hurd-cvs-root/doc/navigating.
You'd also wish to get the glibc sources as well, and look at the
way, how Unix syscalls are implemented on top of hurd. Look at
  $(GLIBC_SRC)/sysdeps/mach/hurd
  $(GLIBC_SRC)/hurd/

Generally, I'd suggest the following path to understand the Hurd sources:

1. Learn as much as you can about Mach, e.g. from the OSF documents.
   You need to know about at least:
     * tasks, threads, ports and port rights, vm
     * using mig for generating RPC stubs
   You don't need to know anything specific on gnumach; a general
   introduction to any variant of Mach (>= 3.0) would suffice.
2. Understand the Hurd's interfaces, w.r.t. the Hurd servers.
   The mig source files are very useful:
     $(HURD_SRC)/hurd/*.defs
   Start with 'auth' and 'proc'.
3. Look at the way, how init starts the core servers. The following
   file contains good examples of both Mach usage and calls to
   often used Hurd functions.
     $(HURD_SRC)/init/init.c
4. The Hurd uses port buckets extensively. Such buckets are there
   for holding port-rights (among others). You should start by
   reading the libports section in
     $(HURD_SRC)/doc/hurd.texi
   and of course the very well commented header file:
     $(HURD_SRC)/libports/ports.h
5. Understand how simple translators are written by learning
   about libtrivfs, documented in
     $(HURD_SRC)/libtrivfs/trivfs.h
   Then look at usermux/hostmux
6. More complex translators are implemented with libnetfs or libdiskfs:
     $(HURD_SRC)/libnetfs/netfs.h
     $(HURD_SRC)/libdiskfs/diskfs.h
   Examples for using libnetfs are the nfs translator
     $(HURD_SRC)/nfs/*
   Examples for libdiskfs are (of course)
     $(HURD_SRC)/ext2fs/*
     $(HURD_SRC)/ufs/*
     $(HURD_SRC)/isofs/*
7. Read more about the Unix emulation library (the familiar Unix
   system calls) in the glibc sources (see above):
     $(GLIBC_SRC)/sysdeps/mach/hurd/
   Try to trace regular Unix syscalls. E.g. try to understand what
   happens inside an open(2), write(2), ... as well as inside
   fork(2), exec[ve](2), ... by looking at the sources of the
   corresponding sysdeps.
   [ Especially if you want to understand fork(), you'll need to
     look at the 'proc', 'auth' and 'exec' servers and their
     interfaces (*.defs), and also understand how 'proc' can be
     accessed though libps $(HURD_SRC)/libps/ps.h ]
8. If you think that you've mastered all of the previous points,
   you can try to grok the store concept by carefully examining
    $(HURD_SRC)/libstore/store.h

You may with to browse the sources of gnumach, glibc and the Hurd
with some suitable tools. Emacs with etags, vi with ctags are
your friends. Very comfortable are global(1) and friends: Just
unpack/fetch gnumach, glibc and hurd sources in the same top-level
directory, e.g.:
   $(TOP_LEVEL)/hurd
   $(TOP_LEVEL)/gnumach
   $(TOP_LEVEL)/glibc
then cd $(TOP_LEVEL), call gtags, call htags -fhvat 'a title'
and browse HTMLized sources at will.

Good luck!

-Farid.

-- 
Farid Hajji -- Unix Systems and Network Admin | Phone: +49-2131-67-555
Broicherdorfstr. 83, D-41564 Kaarst, Germany  | farid.hajji@ob.kamp.net
- - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - -
Murphy's Law fails only when you try to demonstrate it, and thus succeeds.



Reply to: