Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2005 15:29:03 +0900
From:      takawata@jp.freebsd.org
To:        freebsd-current@freebsd.org
Subject:   Cannot cp(1) file from smbfs.(MMAP problem)
Message-ID:  <200501280629.PAA20868@axe-inc.co.jp>

next in thread | raw e-mail | index | archive | help
Hi, I have problem when try to copy file by cp(1).

When /mnt is smbfs, 
% cp /mnt/foo.txt /tmp
will produce
cp: /mnt/foo.txt: Invalid argument

And tracing syscall shows that the error is produced by
mmap(2).

Is it known problem? 

FreeBSD tmp.init-main.com 6.0-CURRENT FreeBSD 6.0-CURRENT #59: Wed Jan 26 02:29:16 JST 2005     takawata@sana.init-main.com:/usr/obj/usr/src/sys/LIEUTENANT  i386

=========-
> cat /mnt/foo.txt
fugafuga
> cp /mnt/foo.txt .
cp: /mnt/foo.txt: Invalid argument
> cat foo.txt
> ls -l foo.txt
-rwxr-xr-x  1 takawata  wheel  0  1 28 15:24 foo.txt
> gcc -o mm mm.c
> ./mm foo.txt 
3
0x28158000
> ./mm /mnt/foo.txt
3
0xffffffff
MMAP: Invalid argument
mm: MMAP
> cat mm.c
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/mman.h>

main(int argc, char * argv[])
{
  int fd;
  void *ptr;
  if(argc <= 1){
    exit(-1);
  }
  if((fd = open(argv[1], O_RDONLY))== -1){
    errx(-1, "OPEN");
  }
  printf("%d\n", fd);
  ptr = mmap(NULL, 4096, PROT_READ, MAP_PRIVATE, fd, 0);
  printf("%p\n", ptr);
  if(ptr == MAP_FAILED){
    perror("MMAP");
    errx(-1, "MMAP");
  }
}
======





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