Re: Conceptual question on writeable file descriptors



On Nov 26, 12:28 pm, fjbl...@xxxxxxxxx wrote:
On Nov 26, 11:33 am, K-mart Cashier <cdal...@xxxxxxxxx> wrote:

Say program A closes it's write half of the connection and then
Program B, which was communicating ith Program A (via a pipe), then
tries to write to the fd on Program A. Program A would generate
SIGPIPE right?

If Program A generates a SIGPIPE, how can the fd on Program A be ready
for writing? Ie, if program A closes it's write end, then how can it
be ready for writing?

I'm not entirely sure what you're getting at, but...

With respect to select(2) and the like, "ready for writing" is sort of
a misnomer. A more accurate description is that select(2) returns
when a write to the file descriptor would not block. The write could
succeed or fail, but in either case it will do so at once, without
blocking.

Does that answer your question?

Yes, that makes sense. Thanks.
.



Relevant Pages

  • Re: asynchronously writing to a file, a cheap way?
    ... your typical asynchronous route for writing to a file, ... performance when the processing server is running. ... end of the pipe doesn't need to be running. ... I you already have a thread pool or IOCP that you can use t handle the ...
    (microsoft.public.win32.programmer.kernel)
  • Re: attach to process by pid?
    ... Similarly, if the process' standard input is a terminal, writing to ... Also, if .../fd/0 is a pipe, opening it for write ... stdin (but I don't know if that's actually possible with Unix98-style ...
    (comp.lang.python)
  • Re: Running a command-line program and reading/writing its stdin/stdout/stderr
    ... > The reason it fails is that the 2 ends of the pipe are not ... one is only good for writing, the other only for reading. ... The reason why i begun writing this program (that is only at its early ...
    (comp.os.linux.development.apps)
  • Re: Writing to a named pipe imposible if there is no reading process running
    ... >out of that pipe and writing the contents to a text file. ... Standard behaviour wjhen opening a FIFO is this: ... opening the FIFO for writing blocks until another process opens the ...
    (comp.os.linux.development.apps)
  • Re: Why is my overlapped WriteFile getting blocked? (repost)
    ... now the issue is: You are using overlapped IO in named pipe programming. ... In client side, in NPClient, in ClientDlgProc function, in IDB_SEND, we revised the code as the following: ... beginning writing pipe... ... Now we are leaving ERROR_IO_PENGING... ...
    (microsoft.public.win32.programmer.networks)