[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#473430: sendfile support missing in aufs

Package: aufs-modules-2.6.24-1-amd64
Severity: important

The aufs module no longer has the sendfile capability, the function 
returns with 'Invalid argument' if I try to use it on a aufs filesystem.
The previous release (2.6.22-3-amd64) works correctly.

Tests were made with lighttpd and a small test program (attached).

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/sendfile.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>

int main(int argc, char **argv)
  int port = 1234, sock, desc, fd, addrlen;
  struct sockaddr_in addr, addr1;	  struct stat stat_buf;		  off_t offset = 0;

  if ( (sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) exit(1);
  memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET;  addr.sin_addr.s_addr = INADDR_ANY;  addr.sin_port = htons(port);
  if ( bind(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1 ) exit(1);
  if ( listen(sock, 1) == -1) exit(1);

  if ( (desc = accept(sock, (struct sockaddr *)  &addr1, &addrlen)) == -1) exit(1);
  if ( (fd = open("/tmp/aufs/test.txt", O_RDONLY)) == -1) exit(1);	  fstat(fd, &stat_buf);  offset = 0;
  if ( sendfile (desc, fd, &offset, stat_buf.st_size) == -1) { fprintf(stderr, "sendfile error: %s\n",  strerror(errno)); exit(1); }
  close(fd); close(desc); close(sock);  return 0;

Reply to: