open(),write() calls not working inside system call handler

13 views
Skip to first unread message

Prasenjit Karmakar

unread,
Nov 21, 2009, 7:38:37 AM11/21/09
to minix3
hi,
I am implementing a system call xyz(int,int) which will save the two
integer arguments in a file.So,in the handler do_xyz() I need to call
open() , read(),close() system calls.But when I am calling them it is
going into infinite loop.
From do_xyz() ,I am able to call printf() ,but why not open(),close()
etc ? Please someone reply

Erik van der Kouwe

unread,
Nov 21, 2009, 3:15:54 PM11/21/09
to minix3
Hi,

Using those calls from a system call is difficult, since you are
likely to deadlock when calling one server from another without
thinking it through properly (and even worse, calling the same
server). However, it sounds like there is no need for a call like this
to be implemented in a server. Why not do it as a library routine?

With kind regards,
Erik

Prasenjit Karmakar

unread,
Nov 22, 2009, 3:59:51 AM11/22/09
to minix3
I have to implement a system call xyz(int,int)which takes two arguments
(integer) and saves the calling user process id and these two integer
arguments in a file.If I directly call do_open(),do_write() from
do_setkey() then it is opening the file ,but problem is with do_write
(),it is writing some invalid data to my file(It is writing CCCCC to
my file,these are NULL,they are visible through "vi" editor but not in
"mined" editor).I have to implement it as a system call.I can not
change that.How to do ?

Ben Gras

unread,
Nov 25, 2009, 6:12:05 AM11/25/09
to minix3
Your question is a little too general for help with homework.

http://wiki.minix3.org/en/MinixFaq#homework
Reply all
Reply to author
Forward
0 new messages