This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DuplicateHandle() question


Egor,

Thanks for the reply.

"egor duda" <deo@logos-m.ru> wrote:
> Hi!
>
> Conrad Scott Conrad.Scott@dsl.pipex.com wrote:
> CS> how can it close that child handle? Or can't it? If it can't, the
server
> CS> will have to arrange for the client to close it for itself, which
makes the
> CS> error handling all the more complex (i.e. send back the offending
handle
> CS> along with the error response).
>
> I don't quite understand why server would want client to discard some
> handle. Can you describe step-by-step scenario when it's needed? Do
> you have shmctl(..., IPC_RMID, ...) in mind?

Not shmctl(2) but shmget(2): when creating and accessing shm segments for a
client, the cygserver calls CreateFileMapping() to create the memory areas
and then uses DuplicateHandle() on the resulting handles to create handles
for the client (in client process) to these file mappings. The problem then
arises that the sever can fail having duplicated some but not all of the
handles for the client, i.e. it's just an error cleanup question: I'm not
looking to have the server arbitrarily close client handles.

AIUI at that point the handles are valid in the client process but the
server can't close them, i.e. the client has to close them. Is that true or
is there some way for the server to close them (i.e. a "close in other
process" function)? I assume not.

Does that all make more sense?

// Conrad

p.s. I'm also assuming that trying to get the client to do the duplication
is going to run into security issues, as that would solve the issue
otherwise.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]