Cannot cp(1) file from smbfs.(MMAP problem)

From: <takawata_at_jp.freebsd.org>
Date: Fri, 28 Jan 2005 15:29:03 +0900
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_at_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");
  }
}
======
Received on Fri Jan 28 2005 - 05:29:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:27 UTC