Adding system calls to "SEND" and "RECIEVE" messages between user and server process

616 views
Skip to first unread message

Vijay

unread,
Mar 24, 2011, 4:07:05 AM3/24/11
to minix3
Hi All,
I am trying to implement a mailbox which requires me to define
a new "Send" and "Recieve" system calls.
Can someone please tell me if I need to modify any other file before
I recompile my o.s for it to take effect?
and also why are there are no table.c and proto.h files in the IPC
server folder?


All I could gather was the following

/usr/src/include/minix/ipconst.h -> has the system call number
/usr/src/include/minix/ipc.h -> strcuture of the messages, the
_PROTOTYPE are defined here.
/usr/src//kernel/proc.c -> has the system call handler

not sure if this is required but just in case :
/usr/src/lib/libc/arch/i386/rts/_ipc.S - > as the assembly level code


Thanks for the help.

Regards,
Vijay

Erik van der Kouwe

unread,
Mar 24, 2011, 5:29:38 AM3/24/11
to minix3
Hi,

>         I am trying to implement a mailbox which requires me to define
> a new "Send" and "Recieve" system calls.
> Can someone please tell me if  I need to modify any other file before
> I recompile my o.s for it to take effect?
> and also why are there are no table.c and proto.h files in the IPC
> server folder?

The IPC server is simpler than the other ones, so it also has been
structured in a simpler way. The table is in main.c and is called
ipc_calls.

> All I could gather was the following
>
> /usr/src/include/minix/ipconst.h -> has the system call number
> /usr/src/include/minix/ipc.h -> strcuture of the messages, the
> _PROTOTYPE are defined here.
> /usr/src//kernel/proc.c  -> has the system call handler
>
> not sure if this is required but just in case :
> /usr/src/lib/libc/arch/i386/rts/_ipc.S - > as the assembly level code

Please take note that the SEND and RECEIVE calls provided by the
kernel cannot be used by normal user-mode processes. Only system
processes can use them. User processes may only use SENDREC, which
sends a message and then waits for the reply. This is essential for
the system's integrity, so you cannot use the existing SEND and
RECEIVE kernel calls to implement your IPC mechanism.

With kind regards,
Erik

Tomas Hruby

unread,
Mar 24, 2011, 5:47:15 AM3/24/11
to min...@googlegroups.com
> > All I could gather was the following
> >
> > /usr/src/include/minix/ipconst.h -> has the system call number
> > /usr/src/include/minix/ipc.h -> strcuture of the messages, the
> > _PROTOTYPE are defined here.
> > /usr/src//kernel/proc.c �-> has the system call handler
> >
> > not sure if this is required but just in case :
> > /usr/src/lib/libc/arch/i386/rts/_ipc.S - > as the assembly level code
>
> Please take note that the SEND and RECEIVE calls provided by the
> kernel cannot be used by normal user-mode processes. Only system
> processes can use them. User processes may only use SENDREC, which
> sends a message and then waits for the reply. This is essential for
> the system's integrity, so you cannot use the existing SEND and
> RECEIVE kernel calls to implement your IPC mechanism.

You must implement your userspace send/recv as calls to some 3rd
party, e.g. the ipc server. These calls must use sendrec() since a
normal process cannot use any other kernel IPC.

T.

Vijay

unread,
Mar 24, 2011, 10:46:18 AM3/24/11
to minix3
Thank you Thomas and Eric for the response.
So I understand that with the system calls that we have by default I
can use only SENDREC() from the user space.
I wanted to implement a new system call that does the work of
SENDREC() which is in someway different and hopefully better than
SENDREC()
in that case can you please help me what files has to be modified /
added?
and where do write the system call handler and from the user program
how I use the this new system call?as a lib function?
Thanks and sorry if I am asking very basic questions.

Regards,
Vijay

Tomas Hruby

unread,
Mar 24, 2011, 12:53:01 PM3/24/11
to min...@googlegroups.com
> Thank you Thomas and Eric for the response.
> So I understand that with the system calls that we have by default I
> can use only SENDREC() from the user space.

from a normal unix/posix process

> I wanted to implement a new system call that does the work of
> SENDREC() which is in someway different and hopefully better than
> SENDREC()

in what sense different/better?

> in that case can you please help me what files has to be modified /
> added?
> and where do write the system call handler and from the user program
> how I use the this new system call?as a lib function?
> Thanks and sorry if I am asking very basic questions.

I sense here a homework assignment which you have no clue how to solve
and you want us to do your job. We are happy to tell help you with
details, however, we are not going to tell you what line of which file
to change. I advice you go through the code of some simple utility to
see how SENDREC is used and have a look at the kernel sources how the
IPC is implemented.

T.

Antoine LECA

unread,
Mar 24, 2011, 1:26:05 PM3/24/11
to min...@googlegroups.com
Vijay wrote:
> I wanted to implement a new system call that does the work of
> SENDREC() which is in someway different and hopefully better than
> SENDREC()

Define "system call" above.

If you mean, one of the basic IPC primitive of MINIX, SENDREC is really
the only one as Erik and Tomas explained. And Pr Tannenbaum's book
spends a significant part of its text to explain its in great details, I
am sure a deeper reading of that part will answer all your questions.

> in that case can you please help me what files has to be modified /
> added?

No need to "s", there is only one file. Cf. above.

> and where do write the system call handler and from the user program
> how I use the this new system call?as a lib function?

Yes, it ends being a library function (this I know is not as clear as
the above.) The hint to its name lies above.


Antoine

Reply all
Reply to author
Forward
0 new messages