lkml.org 
[lkml]   [1999]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: msync problem in 2.3.x
On Fri, 6 Aug 1999, =?ISO-8859-1?Q? =BD=C9=B8=B6=B7=CE ?= wrote:

> my problem is that after running a small test program,
> the program will not terminate. and every program like
> ps, top, w print nothing, and don't terminate...
>
I can't replicate this.

> what is the reason of this ? please, let me know it.
>
> #include <unistd.h>
> #include <sys/mman.h>
>
> main()
> {
> int fd;
> char *mem;
> int i = 0;
> char c = 0;
>
> fd = open("file", 0666);
> lseek(fd, 1000000, 0);
> mem = mmap(0, 1000000, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
> if (mem <= 0)
^^^^^^^^^^
Erm? Do you really mean that?

> exit(1);
> printf("%p\n", mem);
>
> for (c = 0; c < 100; c++)
> for (i = 0; i < 1000000; i++)
> mem[i] = c;
> msync(mem, 1000000, MS_SYNC);
> close(fd);
> }

I consistently get:
$ ./foo
0xffffffff
Segmentation fault (core dumped)
$

--
Mike <rickettm@ox.compsoc.net>

You teach best what you most need to learn.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.143 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site