[Mono-dev] Syscall.mmap problem

Mauricio Henriquez mhenriquezs at terra.cl
Sun Oct 28 17:20:33 EDT 2007


ok, sorry but I don't recive the previous mail I check my trash and spam 
forlder but nothing...
anyway, here is the situation:
in my mmap test the "/pr.txt" file exist so the "error handling" is only 
for test porpuses and to watch if any of the mmap paremeter is wronge 
(this is a test of the mmap not the final working with the mmap on the 
video4linus.net), in my case the file descriptor is correct (not < 0), 
in any case thak you Jonathan for your test code, if I run your code I 
get the same Console.WriteLine(start.ToString()) = -1 and this message 
with the error handling:

mmap: Value too large for defined data type //I don't know what means

the lenght returned by "len = statbuf.st_size" is 6 and this is correct 
becouse is the same value as the C code and offcourse is the lenght of 
the file.

In other mail Jonathan ask me about the len and offset values, the len 
is 6 and offset 0, is the same code of a C working mmap program.

I don't know what else can I check...

thank you.

Mauricio

Robert Jordan wrote:
> Mauricio Henriquez wrote:
>   
>> Please guys help me a little with this!!!, I realy need to solve this 
>> weird thing to help in the Video4Linux.Net proyect....
>> ..or at least tell me what kind of test do you need to help you to find 
>> the source problem.
>>     
>
> You've got an answers, so please check your SPAM folder or
> look at:
>
> http://lists.ximian.com/pipermail/mono-devel-list/2007-October/thread.html
>
> Robert
>
>
>   
>> In advance, thank you very much
>>
>> Mauricio
>>
>> Mauricio Henriquez wrote:
>>     
>>> about the Syscall.mmap function call, if I ask for the 
>>> Mono.Unix.Native.Stdlib.GetLastError(), I get a
>>> EOVERFLOW error message.
>>> what can I do to solve this or give you a better bug report?
>>>
>>> thanks
>>>
>>> Mauricio
>>>
>>> Mauricio Henriquez wrote:
>>>   
>>>       
>>>> Hi to all:
>>>>
>>>> I trying to help to Tim Taubert in they implementation of 
>>>> Video4Linux.Net and now I have problems with the Syscall.mmap function, 
>>>> so I traslate a C mmap working example  code and allways crash, here is 
>>>> my code:
>>>>
>>>>     int fdin;
>>>>             IntPtr start;
>>>>             Mono.Unix.Native.Stat statbuf;
>>>>             long len;
>>>>             if((fdin = Syscall.open("/pr.txt",  OpenFlags.O_RDONLY)) < 0)
>>>>                 Console.WriteLine("open crash");
>>>>             else
>>>>                 Console.WriteLine("open fine");
>>>>            
>>>>             if((Syscall.fstat(fdin, out statbuf)) < 0)
>>>>                 Console.WriteLine("fstat crash");
>>>>             else
>>>>                 Console.WriteLine("fstat ok");
>>>>            
>>>>             len = statbuf.st_size;
>>>>             //file lenght is 6, I test this with a mmap C code
>>>>             Console.WriteLine("length = {0}", len); //OK
>>>>            
>>>>             start = Syscall.mmap
>>>>                 (IntPtr.Zero,
>>>>                  (ulong)len,
>>>>                  MmapProts.PROT_READ,
>>>>                  MmapFlags.MAP_PRIVATE,
>>>>                  fdin,
>>>>                  0);
>>>>             Console.WriteLine(start.ToString());
>>>>             if (start == Syscall.MAP_FAILED)
>>>>                 throw new Exception("mmap crash.");
>>>>
>>>> do you see some mistake?, I use Fedora 5 with mono-1.2.5.1, may be you 
>>>> can send me a workin Mono.Posix or Mono.Unix dll, becouse I prefer don't 
>>>> compile all mono stuff only for this dll, becouse all other stuff work 
>>>> perfectly.
>>>>
>>>> In advance, thank you very much.
>>>>
>>>> Mauricio Henriquez
>>>>
>>>> _______________________________________________
>>>> Mono-devel-list mailing list
>>>> Mono-devel-list at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>>
>>>>   
>>>>     
>>>>         
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>
>>>   
>>>       
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>   




More information about the Mono-devel-list mailing list