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

Re:   where can find S_fsys_startup?

At 23 Apr 2004 09:14:56 +0800,
funfire@eyou.com wrote:
> Yes,it makes easier to write,but makes harder to read.
> For example , I can see _Xfsys_startup which in fsysServer.c in
> hurd\obj\libtrivfs\ ,but never see where it is called. Only see fsys_startup 
> called in trivfs_startup.Are these two functions really the same one? Is there
> a macro defination just like --"#define _Xfsys_startup fsys_startup" or
> "#define fsys_startup _Xfsys_startup"?

The flow of execution is like this for any RPC:

In the client:

Invoke RPC client stub -> This generates a Mach message and invokes the Mach
system call mach_msg, which delivers the message to the port.

In the server:

Invoke the Mach system call mach_msg to receive the next message in
the queue.  -> The message is then dispatched (demuxed) using its
message ID.  The corresponding server stub is then invoked.

So, function "fsys_startup" is provided in the client stub library,
which is libhurd-user in the Hurd, and part of the glibc sources (but
don't look for it, you won't find it: All the client stubs are
automatically generated at build time.  So if you build glibc, you
will see all the RPC functions in generated files in
build_dir/hurd/RPC_*.c or so).

The function name in the server is usually PREFIX_rpc_name.  The
function is invoked by the demuxer, which is also automatically
generated at build time.  So, in hurd/obj/libtrivfs, you should find a
demuxer somewhere.  The chain of demuxers used in libtrivfs you can
find in libtrivfs/demuxer.c.  So, look for a function
trivfs_fsys_server, which should be in a generated file
hurd/obj/libtrivfs/fsysServer.c, and this file will invoke
trivfs_S_fsys_startup or whatever, based on the message ID.

Actually, you mention a function _Xfsys_startup, which is likely a
wrapper function.  You are really looking at MiG generated code, and
if you want to understand it at that level, you will have to look at
all the gory details.  It's not all that hard to follow MiG generated
stubs, but if you are doing it the first time, your eyes will bleed ;)

Anyway, you should be able to find _Xfsys_startup being called
somewhere in fsysServer.c somewhere, I think via a function table.


Reply to: