Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - File System Resource Manager question: (7 Items)
   
File System Resource Manager question  
I'm not sure if this is the right place to ask this, but as part of our project we're creating a special purpose file 
system resource manager.  We're creating a "FIFO"-like set of files which support blocking and non-blocking access.  We 
have a process that opens a file and spawns a thread that does a blocking read on the file descriptor.  At some future 
time, another thread closes the file descriptor.  Our file system resource manager does not get an "io_close_ocb()" call
.  Should it?  Since file descriptors are shared across threads of a process we would have expected the io_close_ocb() 
call to happen.

Thanks,

Gordon Molek
Zebra Technologies Corp.
RE: File System Resource Manager question  
I guess the first question to ask is: Do you ever dup that file
descriptor?  The io_ocb_close() is only called once all open handles
(fds) to the OCB are closed.  You can register a "close_dup" function
and see if that handler gets called when the thread closes the file
descriptor.

David Sarrazin

> -----Original Message-----
> From: Gordon Molek [mailto:community-noreply@qnx.com] 
> Sent: July 30, 2008 12:11 PM
> To: ostech-core_os
> Subject: File System Resource Manager question
> 
> I'm not sure if this is the right place to ask this, but as 
> part of our project we're creating a special purpose file 
> system resource manager.  We're creating a "FIFO"-like set of 
> files which support blocking and non-blocking access.  We 
> have a process that opens a file and spawns a thread that 
> does a blocking read on the file descriptor.  At some future 
> time, another thread closes the file descriptor.  Our file 
> system resource manager does not get an "io_close_ocb()" 
> call.  Should it?  Since file descriptors are shared across 
> threads of a process we would have expected the 
> io_close_ocb() call to happen.
> 
> Thanks,
> 
> Gordon Molek
> Zebra Technologies Corp.
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post11249
> 
> 
Re: RE: File System Resource Manager question  
AFAIK, we never dup that file descriptor, but I will try to verify that.

Thanks,

Gordon
Re: RE: File System Resource Manager question  
Ok, close_dup is being called, but not close_ocb.
Re: RE: File System Resource Manager question  
So I guess my main question boils down to this:

What is the proper way to implement blocking reads within a File System Resource Manager?

I've read the online documentation for (File System)  Resource Managers and  Krten's "Recipes for Programmers" Ram Disk 
File System chapter, but I haven't found a clear discussion on how to handle blocking reads.
Re: File System Resource Manager question  
Gordon Molek wrote:
> So I guess my main question boils down to this:
>
> What is the proper way to implement blocking reads within a File System Resource Manager?
>
> I've read the online documentation for (File System)  Resource Managers and  Krten's "Recipes for Programmers" Ram 
Disk File System chapter, but I haven't found a clear discussion on how to handle blocking reads.
>   
You mean how to achieve a blocking read on the server side?  Well all
you have to do is to reply with an _RESMGR_NOREPLY message and then as long as
you are holding on to the relevant information (ie rcvid) then you can
form a reply later on to the client when the data is available and just call
MsgReply at that time.  What is important is to make sure the data you are
returning is the properly message (ie the return structure for io_read).

Does this help to answer your question?

Thomas

-- 
Thomas Fletcher
Crank Software Inc.
www.cranksoftware.com

Re: File System Resource Manager question  
Yes, I stumbled onto that approach shortly after I posted my question (of course).  For some reason I thought more was 
needed than that.

Thanks,

Gordon Molek