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]---
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to