Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

New System Calls

7 views
Skip to first unread message

rot...@sis.bms.com

unread,
Nov 11, 1993, 8:49:19 AM11/11/93
to
Greetings Minix Users,

I am in the middle of a project to implement quotas for minix. I have
introduced a new structure in fs which holds and entry for each uid,
quota, and current usage of every uid being tracked in the system.

I have also implemented 2 new system calls, getquota() and setquota()
in fs. I wrote 2 interface routines in /usr/src/lib/other which
map the user level system call to the fs level system call

(i.e. #include <lib.h>
setquota(uid, quota, usage)
int uid;
int quota;
int usage;
{
return (callm1(....*parameters*) );
}

My question is this:

How do I link my user level programs which make the system calls to the
actual system calls? I know that they are not in the standard library,
but I am running up against linker messages that say:

"unresolved references:
_setquota
_getquota
"
Has anybody implemented new system calls in Minix?? If so, how did
you link your user level programs to the new system calls?

Thanks for any advice,

Joe Rotella
rot...@synapse.bms.com

Will Rose

unread,
Nov 12, 1993, 12:58:08 AM11/12/93
to
rot...@sis.bms.com wrote:
: Greetings Minix Users,

:
: I am in the middle of a project to implement quotas for minix. I have
: introduced a new structure in fs which holds and entry for each uid,
: quota, and current usage of every uid being tracked in the system.
:
[...]
:
: How do I link my user level programs which make the system calls to the

: actual system calls? I know that they are not in the standard library,
: but I am running up against linker messages that say:
:
: "unresolved references:
: _setquota
: _getquota
: "
: Has anybody implemented new system calls in Minix?? If so, how did
: you link your user level programs to the new system calls?

Why didn't you add the calls to libc.a? Or are they in an
additional project library?

There are a good few examples in the stdlib code - basically
you send a message to the filesystem, like any other call.
Try looking up open(), and seeing how that connects up.
Or possibly sync() - does that go via the kernel? Most of
the call interfaces are quite clear, and they are usually
in tabular form which makes adding new entries pretty
straightforward. The fun starts when you try actually calling
the wretched thing.

Will
c...@crash.cts.com

John Raley

unread,
Nov 12, 1993, 10:57:26 AM11/12/93
to

In article <1993Nov11....@synapse.bms.com>, rot...@sis.bms.com writes:
|>
|> I have also implemented 2 new system calls, getquota() and setquota()
|> in fs. I wrote 2 interface routines in /usr/src/lib/other which
|> map the user level system call to the fs level system call
|>
|> (i.e. #include <lib.h>
|> setquota(uid, quota, usage)
|> int uid;
|> int quota;
|> int usage;
|> {
|> return (callm1(....*parameters*) );
|> }
|>
|> How do I link my user level programs which make the system calls to the
|> actual system calls? I know that they are not in the standard library,
|> but I am running up against linker messages that say:
|>
|> "unresolved references:
|> _setquota
|> _getquota
|> "

First, compile the file(s) containing your new calls to object code, using
the -c switch on the command line. This should produce a .o file for each
C file you use.

Now, for each .o file, type "ar r /usr/lib/libc.a (filename).o". You must
be a super-user to do this.

Here's what's happening: libc.a contains object code for certain.
convenient routines, like system calls. This is why they magically show
up, without your doing anything. So, by putting a routine in libc.a, you
make it available to your programs. The "ar" (archiver?) command does
this for you.

This is most likely incomplete and inaccurate, but it should get you started.
Consult Tanenbaum for details. Good luck!

"An instance of this universal type may be created by universal quantification
of a record instance whose fields are initialized to operations parameterized
by the generic universally quantified parameter." - Cardelli, Wegner

Peter Holzer

unread,
Nov 15, 1993, 9:10:26 AM11/15/93
to
jra...@csgrad.cs.vt.edu (John Raley) writes:

>Now, for each .o file, type "ar r /usr/lib/libc.a (filename).o". You must
>be a super-user to do this.

Or, better, modify the Makefile to do it. Depending on which compiler
you are using you may also have to postprocess the library:

ACK cc reads library files sequentially, so you have to use tsort and
lorder to resort the library after adding new files.

Bcc handles unsorted libraries well, no postprocessing is necessary.

Gcc expects a `table-of-contents'-File in the archive (.__SYMDEF).
After every update to the library you have to run ranlib (== gar s) to
make it up-to-date.

hp
--
_ | h...@vmars.tuwien.ac.at | Peter Holzer | TU Vienna | CS/Real-Time Systems
|_|_) |------------------------------------------------------------------------
| | | ...and it's finished! It only has to be written.
__/ | -- Karl Lehenbauer

0 new messages