mannemel@handel.cs.colostate.edu (devakumar mannemela) (11/24/90)
Hi !
I am working on a project on MINIX ( for my OS course).I am
implementing memory compaction.( don't tell me it is not very useful
in PC environment. 8-) . the purpose of the project is to get ourself
thoroughly familiar with one of the main parts of the OS , in which
i think we are succeeding).
I wrote a routine 'do_comp' which does the actual compaction
and included it as a part of alloc.c in the mm.My original idea
is to create a system call "compact" which actually calls ' do_comp'
and write a user program which runs 'compact' every x seconds , in the
back ground. ( and start this user program in /etc/rc like /etc/update)
Coming to my problem , I created a system call which
calls the do-compaction routine (present in my memory manager). So i
added relevant definitions to h/callnr.h and the tables of fs and
memory manager.I wrote a library routine compact and tried to append it
to libc.a. The actual routine is
compact.c------
main()
{
return callm1(MM,CMPACT,0,0,0,NIL_PTR,NIL_PTR,NIL_PTR);
}
and i compiled it to get compact.s
( cc -c -Di8088 -LIB compact.c )
now i tried to add it to libc.a , in the following manner.
ar rb uniqport.s libc.a compact.s
( puts libc.a before uniqport.s , which is
the first thing in the archived lib)
Now compact.s is the first thing in libc.a .
I verified that compact.s is actually added to libc.a byb typing
ar t libc.a.
Now i wrote a small program comp.c and tried compiling it.
----------------------comp.c---------------------
main()
{
sleep(120);
while(1)
{
compact();
sleep(10);
}
}
--------------------------------------------------------
cc comp.c
------------------
unresolved references
-compact
--------------------
That was the result. Isn't it supposed to recognise compact by checking in
libc.a ?
Are there any other places i have to indicate the addition of the new system
call "compact" ?
Are there any other ways of running my 'do_comp' routine in the background
every x seconds , other than by creating a system call ? ( i tried using
fork in the main of mm. Doesn't seem to work. )
BTW , I am working on a 80286 based PC-AT , with minix itself as the
development system.
I am completely struck up here. No idea how to procede.
Any help would be very much appreciated.
Thanks
Bye,
Deva Kumar M.
P.S. : Does the whole thing makes sense ?
E-mail preferred.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dev Kumar M. E-mail :mannemel@handel.cs.colostate.edu
Colorado State University Tel : 303 - 484 - 7970
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++jms@cs.vu.nl (Jan-Mark) (11/30/90)
In article <11362@ccncsu.ColoState.EDU>, mannemel@handel.cs.colostate.edu (devakumar mannemela) writes: > > now i tried to add it to libc.a , in the following manner. > > ar rb uniqport.s libc.a compact.s ... > Now compact.s is the first thing in libc.a . ... > unresolved references > -compact ... > That was the result. Isn't it supposed to recognise compact by checking in > libc.a ? > Try compiling compact with the -LIB option, this will add a ``.define _compact'' to compact.s. The normal ``.glob _compact'' isn't innough for a function in a lib. You can check if you have got the define there, by looking at the output of ``libupack < compact.s.'' Jan-Mark. -- (:> jms (_) ========""======