Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Oct 2005 16:21:07 +0200
From:      Niki Denev <nike_d@cytexbg.com>
To:        freebsd-stable@freebsd.org
Subject:   Re: sendfile + non local filesystem + lighttpd = EOPNOTSUPP
Message-ID:  <4364D6D3.6010508@cytexbg.com>
In-Reply-To: <4363E333.5000803@cytexbg.com>
References:  <436311C2.6090708@cytexbg.com>	<20051029061513.GG36235@tnn.dglawrence.com>	<43631721.50504@cytexbg.com> <4363E333.5000803@cytexbg.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Niki Denev wrote:
> 
> 
> I get the same behaviour also with 6.0-RC1 (cvsupped an hour ago)
> 

Ok,
In this awful piece of code created for testing purposes
if i set FILETOSEND to local file it works ok,
but if the file is located on smbfs sendfile returns "Operation
not supported".
If this is not a bug, maybe it should be documented? (also the
error code that sendfile returns)

(again, the machine is 6.0-RC1 cvsupped yesterday, with SMP kernel)

---[sendfile_test.c]---
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#define FILETOSEND "/var/log/messages"
//#define FILETOSEND "/mnt/smb/somefile.dat"

int main() {
        int fd;
        int sock;
        int result;
        struct sockaddr_in sa;

        fd = open(FILETOSEND, O_RDONLY);
        sock = socket(PF_INET, SOCK_STREAM, 0);
        memset(&sa, 0, sizeof(sa));
        sa.sin_family = AF_INET;
        sa.sin_port = htons(9); /* discard enabled in inetd */
        inet_aton("127.0.0.1", &sa.sin_addr);

        printf("connecting socket ... ");
        errno = 0;
        result = connect(sock, (struct sockaddr *)&sa, sizeof(sa));
        printf("%s\n", errno?strerror(errno):"ok");

        printf("calling sendfile ... ");
        errno = 0;
        result = sendfile(fd, sock, 0, 0, NULL, NULL, 0);
        printf("%s\n", errno?strerror(errno):"ok");

        close(fd);
        close(sock);
        return(0);
}
---[end of sendfile_test.c]---



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