where does the initialization of the proc structure happen?

110 views
Skip to first unread message

anush2...@gmail.com

unread,
Aug 16, 2016, 5:39:07 AM8/16/16
to minix3
i just want to know where does the initialization of the proc structure as defined in /usr/src/kernel/proc.h happens? i tried searching for almost 2 hours using ctags but still i couldnt find 

Antoine LECA

unread,
Aug 16, 2016, 7:35:03 AM8/16/16
to min...@googlegroups.com
I'll assume you know about proc_init() in file proc.c, and that is *not*
what you are asking for.

The _declaration_ of the proc[] array is in proc.h, unlike most of the
variables of the kernel which are in file glo.h (standard practice in
MINIX code.)

Usually, that declaration is just that, a declaration, since it carries
EXTERN at the beginning which #define'd as extern in minix/const.h

But when you compile the file named table.c, as explained at the
beginning of glo.h, the declarations are turned into _definitions_ for
the global variables; they do not carry explicit initializations, so
they are initialized to { 0 }, i.e. all zeroes.
Except for its location, the proc[] array is no exception.

The same mechanism is in use in most of the inherited services of MINIX
(like PM, VFS.)
It is possible that more recent code does not adhere to the same style.


Antoine
Reply all
Reply to author
Forward
0 new messages