This is what you get on Linux if you do that?

$ ./zpipe

RDFD=3  WRFD=4
pipe write to fd[0] (should fail): Bad file descriptor

POSIX leaves as "unspecified" doing the contrary:

http://pubs.opengroup.org/onlinepubs/009695399/functions/pipe.html



[zpipe.c]

#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>

int main(int ac, char **av)
{
    int fd[2];

    if (pipe(fd)) {
        perror("pipe");
        return 1;
    }
    printf("RDFD=%d  WRFD=%d\n", fd[0], fd[1]);

    if (write(fd[0], "w", 1) != 1) {
        perror("pipe write to fd[0] (should fail)");
        return 1;
    }

    return 0;
}


On Tue, Jan 26, 2016 at 5:30 PM, Davide Libenzi <[email protected]> wrote:

> Does that work (pipe read side is supposed to be fd[0] and write side
> fd[1])?
>
>
>
> On Tue, Jan 26, 2016 at 5:20 PM, ron minnich <[email protected]> wrote:
>
>> Oh, just for fun, I included a simple strace program in tests.
>>
>>
>> https://github.com/rminnich/akaros/commit/d2d2b0c09b44d2d2df8966a12d257bd857430bae
>>
>> On Tue, Jan 26, 2016 at 4:12 PM ron minnich <[email protected]> wrote:
>>
>>> It's now dumping data correctly, PTAL
>>>
>>> https://github.com/rminnich/akaros/commit/97832e05ba2524579d1bbef4ef71299208030dc2
>>>
>>> On Tue, Jan 26, 2016 at 9:48 AM ron minnich <[email protected]> wrote:
>>>
>>>> updated to dump data from read and write system calls, just to show how
>>>> it's done.
>>>>
>>>> If this looks ok it's not a big deal to add symbolic dumps of stuff
>>>> like open modes, etc.
>>>>
>>>> in the limit we can drive the trace overhead per target system call to
>>>> below one. The plan 9 work I did got it down to about 4, lower than the
>>>> strace ratio of about 25.
>>>>
>>>> It also means, now that we can export file systems from akaros, that on
>>>> a linux system, stracing an akaros process works like this:
>>>> import akaros /proc akproc
>>>> cat akproc/pid/strace
>>>>
>>>> All done. Distributed systems are nice. Unix, come to think of it, is a
>>>> nice model.
>>>>
>>>> The following changes since commit
>>>> 915eac00a7e0f578f9e921af2b205b6efa3739b5:
>>>>
>>>>   Slices: A growable list of pointers. (2016-01-25 11:02:20 -0500)
>>>>
>>>> are available in the git repository at:
>>>>
>>>>   [email protected]:rminnich/akaros strace
>>>>
>>>> for you to fetch changes up to 070b569c2962e98c2a645837fb5a332c31ac2f32:
>>>>
>>>>   New and easy strace framework. (2016-01-25 17:39:24 -0800)
>>>>
>>>> ----------------------------------------------------------------
>>>> Ronald G. Minnich (1):
>>>>       New and easy strace framework.
>>>>
>>>>  kern/drivers/dev/proc.c |  25 +++++++++++
>>>>  kern/include/env.h      |   5 +++
>>>>  kern/src/process.c      |   5 +++
>>>>  kern/src/syscall.c      | 112
>>>> ++++++++++++++++++++++++++++++++++++++++--------
>>>>  4 files changed, 128 insertions(+), 19 deletions(-)
>>>>
>>>> https://github.com/rminnich/akaros/compare/rminnich:master...strace
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Akaros" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to