Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jul 1996 20:42:46 -0700 (PDT)
From:      Mark Diekhans <markd@Grizzly.COM>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/1397: can't send to a pipe
Message-ID:  <199607190342.UAA06069@Grizzly.COM>
Resent-Message-ID: <199607181550.IAA27886@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1397
>Category:       kern
>Synopsis:       can't send to a pipe
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 18 08:50:01 PDT 1996
>Last-Modified:
>Originator:     Mark Diekhans
>Organization:
== Mark Diekhans <markd@grizzly.com> ==
>Release:        FreeBSD 2.2-960612-SNAP i386
>Environment:

>Description:

  Pipes are implemented as sockets and this is what fstat reports. However
send returns a "Socket operation on non-socket" error.  Either socket
operations should work or fstat should report the file as a FIFO, not a socket.

This worked on 2.1.


>How-To-Repeat:

#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>

int
main ()
{
    int fds [2];
    struct stat statBuf;
    char *data;

    if (pipe (fds) < 0) {
        perror ("pipe");
        exit (1);
    }
    if (fstat (fds [1], &statBuf)) {
        perror ("fstat");
        exit (1);
    }

    printf ("pipe mode is: %o\n", statBuf.st_mode);

    data = "some data to write";
    if (send (fds [1], data, strlen (data), 0) < 0) {
        perror ("but doing a send fails");
        exit (1);
    }
    exit (0);
}


>Fix:
	
Unknown.
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607190342.UAA06069>