help with stream pipes needed

help with stream pipes needed

Post by Johannes Re » Fri, 01 Jul 1994 16:30:39



Hello!

as the subject line says, i need help with stream pipes under linux.
in the include files (libc4.21) there is no definition of the
struct msghdr structure. as linux seems to follow the bsd ipc syntax,
i do not know where to find the definition of this structure. can anybody
tell my the definition?

--
Johannes Rest
Institute of Nuclear Physics
University of Cologne
Zuelpicher Str. 77
D-50937 Koeln

Germany


Tel.:     0221/470-3617
Priv.     02202/71485

 
 
 

1. Need help with a STREAMS named pipe.

The following modele is failing in me and I badly need help
understanding why and how to fix it.

I'm running on

259 > uname -a
OSF1 dec1 V4.0 1229 alpha

and I have FFM_FS turned on via sysconfig -s.

The failure is happening on the call to fattach. The spipe call is a
simple pipe call under SVR4 and is not failing.

The name being passed in is a fully qualified pathname and the file
gets successfully created.

The failure yields an errno of EINVAL which according to the man page

  [EINVAL]  The fd parameter refers to a socket.

            [Digital]  The superblock for the file system had an incorrect
            magic number or an out of range block size.

            [Digital]  The pathname is incorrect.

Well, fd is not a socket. There is no filesystem and no superblock,
and the pathname seems to be fine. I am *not* running as root.

Could someone *please* tell me what's happening here? If possible,
does someone have an ns_pipe they could send or know where one is?

Many thanks in adbvance.

/*
 * Create a named stream pipe.
 */

#include        <sys/types.h>
#include <unistd.h>
#include <errno.h>

/* return 0 if OK, -1 on error */
int ns_pipe ( char *name,/* user-specified name to assign to the stream pipe */
             int fd[2]   /* two file descriptors returned through here */
             )
{
    unlink ( name );

    close ( creat ( name, 0666 ) );

    /*
     * First create an unnamed stream pipe.
     */

    if ( s_pipe(fd) <  0)
    {
        perror ( "spipe" );
        return(-1);
    }

    if ( fattach ( fd[1], name ) < 0 )
    {
        perror ( "fatttach" );
        printf ( "Errno = %d\n", errno );
        close ( fd[0] );
        close ( fd[1] );
        return -1;
    }
    close ( fd[1] );
    return fd[0];

--

-Stranger things have happened but none stranger than this. Steven W. Orr-
Does your driver's license say Organ Donor?Black holes are where God \
-------divided by zero. Listen to me! We are all individuals!---------

2. LRP vs squid socks ipchains

3. Need STREAMS pipe help.

4. [No Subject]

5. Need help with STREAMS pipe code. (PLEASE!!!)

6. Is free software idealistic?

7. how do i divide/copy one stream into two streams through a named pipe???

8. Mac-emulation on Linux?

9. Full-duplex pipes (STREAMS pipes)

10. pipes vs stream pipes

11. Help needed pipes and named pipes

12. Stream pipes, help

13. Need source for SVR3 Streams -> SVR4 Streams changes