* POSIX.Memory_Mapping.Map_Memory
@ 2005-01-29 15:58 Adrian Hoe
2005-01-29 16:20 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
0 siblings, 1 reply; 15+ messages in thread
From: Adrian Hoe @ 2005-01-29 15:58 UTC (permalink / raw)
Hi,
I am working on video_device with Video_4_Linux based on the work of
Anders Gidenstam. According to latest V4L documentation, capturing with
Read has been deprecated and the only method now is by the use of mmap.
I open a device and read the device with the following procedures, Open
and Map_Image as below. In Procedure Map_Image, I make a call to
Map_Memory (POSIX.Memory_Mapping) and raise an exception:
POSIX.POSIX_ERROR : PERMISSION_DENIED
-----------------------------------------------------------------------
...
type Intensity is new Natural range 0..255;
for Intensity'Size use 8;
type Bitmap is array (Positive range <>) of Intensity;
type Bitmap_Access is access Bitmap;
...
private
type Image_Type is new Ada.Finalization.Controlled with
record
Class : Image_Class;
Width : Natural := 0;
Height : Natural := 0;
BM : Bitmap_Access := null;
end record;
------------------------------------------------------------------------
procedure Open (Device : out Video_Device;
File_Name : in String) is
Win : Video_Window;
begin
if Is_Character_Special_File (To_POSIX_String (File_Name)) then
Device.Fd := Open (To_POSIX_String (File_Name),
Read_Only);
Get_Capture_Window (Device, Win);
Device.Width := Win.Width;
Device.Height := Win.Height;
else
raise IO_Error;
end if;
end Open;
-- Close video device.
procedure Close (Device : in Video_Device) is
begin
POSIX.IO.Close (Device.Fd);
Put_Line ("Device closed");
end Close;
-- Map image
procedure Map_Image (Device : in Video_Device;
Image : in out Image_Type) is
package Convert is new System.Address_To_Access_Conversions
(Bitmap_Access);
use Convert;
Buf_Size : Natural;
begin
if Get_Width (Image) /= Device.Width or
Get_Height (Image) /= Device.Height then
case Get_Class (Image) is
when Grey =>
Buf_Size := Device.Width * Device.Height;
when Color =>
Buf_Size := Device.Width * Device.Height * 3;
end case;
declare
Map : System.Address;
begin
-- Permission Denied exception was raised here at the line below!!!
Map := Map_Memory (System.Storage_Elements.Storage_Offset
(Buf_Size),
POSIX.Memory_Mapping.Allow_Read +
POSIX.Memory_Mapping.Allow_Write,
POSIX.Memory_Mapping.Map_Shared,
Device.Fd,
0);
Set_Bitmap (Image,
Device.Width,
Device.Height,
Bitmap_Access (Convert.To_Pointer (Map).all));
end;
end if;
end Map_Image;
--------------------------------------------------------------------------
What could I have missed? Any pointer please?
Best regards,
--
Adrian Hoe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-29 15:58 POSIX.Memory_Mapping.Map_Memory Adrian Hoe
@ 2005-01-29 16:20 ` Mark Lorenzen
2005-01-29 16:31 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
0 siblings, 1 reply; 15+ messages in thread
From: Mark Lorenzen @ 2005-01-29 16:20 UTC (permalink / raw)
"Adrian Hoe" <byhoe@greenlime.com> writes:
> Hi,
>
> I am working on video_device with Video_4_Linux based on the work of
> Anders Gidenstam. According to latest V4L documentation, capturing with
> Read has been deprecated and the only method now is by the use of mmap.
>
> I open a device and read the device with the following procedures, Open
> and Map_Image as below. In Procedure Map_Image, I make a call to
> Map_Memory (POSIX.Memory_Mapping) and raise an exception:
>
> POSIX.POSIX_ERROR : PERMISSION_DENIED
>
> -----------------------------------------------------------------------
[cut]
> Device.Fd := Open (To_POSIX_String (File_Name),
> Read_Only);
You open the device in read-only.
[cut]
>
> -- Permission Denied exception was raised here at the line below!!!
> Map := Map_Memory (System.Storage_Elements.Storage_Offset
> (Buf_Size),
> POSIX.Memory_Mapping.Allow_Read +
> POSIX.Memory_Mapping.Allow_Write,
> POSIX.Memory_Mapping.Map_Shared,
> Device.Fd,
> 0);
But you try to map it in read/write mode.
Maybe thats the case of the exception. Do you have to be root in order
to open the device at all?
[cut]
> Adrian Hoe
- Mark Lorenzen
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-29 16:20 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
@ 2005-01-29 16:31 ` Adrian Hoe
2005-01-29 18:44 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
0 siblings, 1 reply; 15+ messages in thread
From: Adrian Hoe @ 2005-01-29 16:31 UTC (permalink / raw)
Mark Lorenzen wrote:
> "Adrian Hoe" <byhoe@greenlime.com> writes:
>
> > Hi,
> >
> > I am working on video_device with Video_4_Linux based on the work
of
> > Anders Gidenstam. According to latest V4L documentation, capturing
with
> > Read has been deprecated and the only method now is by the use of
mmap.
>
>>>> snip <<<<
> > Device.Fd := Open (To_POSIX_String (File_Name),
> > Read_Only);
>
> You open the device in read-only.
>
> [cut]
>
> >
> > -- Permission Denied exception was raised here at the line below!!!
> > Map := Map_Memory (System.Storage_Elements.Storage_Offset
> > (Buf_Size),
> > POSIX.Memory_Mapping.Allow_Read +
> > POSIX.Memory_Mapping.Allow_Write,
> > POSIX.Memory_Mapping.Map_Shared,
> > Device.Fd,
> > 0);
>
> But you try to map it in read/write mode.
I open with Read_Write option and raised POSIX.POSIX_ERROR :
INVALID_ARGUMENT at the same line.
> Maybe thats the case of the exception. Do you have to be root in
order
> to open the device at all?
No, I don't have to be root to open the device. Some applications are
able to open it and the camera and video card work.
--
Adrian Hoe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-29 16:31 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
@ 2005-01-29 18:44 ` Mark Lorenzen
2005-01-30 2:45 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
0 siblings, 1 reply; 15+ messages in thread
From: Mark Lorenzen @ 2005-01-29 18:44 UTC (permalink / raw)
"Adrian Hoe" <byhoe@greenlime.com> writes:
> Mark Lorenzen wrote:
> > "Adrian Hoe" <byhoe@greenlime.com> writes:
> >
> > > Hi,
> > >
> > > I am working on video_device with Video_4_Linux based on the work
> of
> > > Anders Gidenstam. According to latest V4L documentation, capturing
> with
> > > Read has been deprecated and the only method now is by the use of
> mmap.
> >
>
> >>>> snip <<<<
>
>
> > > Device.Fd := Open (To_POSIX_String (File_Name),
> > > Read_Only);
> >
> > You open the device in read-only.
> >
> > [cut]
> >
> > >
> > > -- Permission Denied exception was raised here at the line below!!!
> > > Map := Map_Memory (System.Storage_Elements.Storage_Offset
> > > (Buf_Size),
> > > POSIX.Memory_Mapping.Allow_Read +
> > > POSIX.Memory_Mapping.Allow_Write,
> > > POSIX.Memory_Mapping.Map_Shared,
> > > Device.Fd,
> > > 0);
> >
> > But you try to map it in read/write mode.
>
> I open with Read_Write option and raised POSIX.POSIX_ERROR :
> INVALID_ARGUMENT at the same line.
In the way you are using Map_Memeory, it is probably because the value
of Offset (i.e. 0) is not page aligned.
On many implementations, you can only map a multiple of the page size
and the memory has to be page aligned.
>
> > Maybe thats the case of the exception. Do you have to be root in
> order
> > to open the device at all?
>
>
> No, I don't have to be root to open the device. Some applications are
> able to open it and the camera and video card work.
>
>
>
> --
> Adrian Hoe
- Mark Lorenzen
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-29 18:44 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
@ 2005-01-30 2:45 ` Adrian Hoe
2005-01-30 2:48 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-30 15:39 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
0 siblings, 2 replies; 15+ messages in thread
From: Adrian Hoe @ 2005-01-30 2:45 UTC (permalink / raw)
Mark Lorenzen wrote:
>
> In the way you are using Map_Memeory, it is probably because the
value
> of Offset (i.e. 0) is not page aligned.
>
> On many implementations, you can only map a multiple of the page size
> and the memory has to be page aligned.
>
I wrote a short C program to test mmap. It works and seems like no
problem doing mmap. The C code is as below:
---------------------------------------------------------------------
#include <stdio.h>
#include <fcntl.h>
#include "linux/ioctl.h"
#include "sys/ioctl.h"
#include "sys/mman.h"
int main ()
{
int fd;
int bufsize;
int result;
char *buf;
fd = open ("/dev/video0", O_RDWR);
if (fd < 0) {
printf ("Error open device.\n");
exit (1);
}
bufsize = 320 * 240 * 3;
buf=mmap(0, bufsize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (!buf) {
printf ("mmap error.\n");
exit (1);
}
else {
printf ("mmap successful.\n");
}
result = munmap (buf, bufsize);
printf ("unmap successful.\n");
close (fd);
printf ("device closed.\n");
return (0);
}
---------------------------------------------------------------------
Is this gnat/florist error or just as what you mentioned about page
alignment?
I am using gcc/gnat 3.3.3 and florist 3.15p on SuSE Linux 9.1 Pro on
AMD Athlon. I have no problem with both gcc/gnat and florist. My other
programs using both for RS-232 interface have no problems at all.
Now, I'm in despair with curiosity! :-)
--
Adrian Hoe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 2:45 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
@ 2005-01-30 2:48 ` Adrian Hoe
2005-01-30 15:39 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
1 sibling, 0 replies; 15+ messages in thread
From: Adrian Hoe @ 2005-01-30 2:48 UTC (permalink / raw)
Adrian Hoe wrote:
> Mark Lorenzen wrote:
> >
> > In the way you are using Map_Memeory, it is probably because the
> value
> > of Offset (i.e. 0) is not page aligned.
> >
> > On many implementations, you can only map a multiple of the page
size
> > and the memory has to be page aligned.
> >
>
>
>
> I wrote a short C program to test mmap. It works and seems like no
> problem doing mmap. The C code is as below:
>
> ---------------------------------------------------------------------
> #include <stdio.h>
> #include <fcntl.h>
> #include "linux/ioctl.h"
> #include "sys/ioctl.h"
> #include "sys/mman.h"
>
> int main ()
> {
> int fd;
> int bufsize;
> int result;
> char *buf;
>
> fd = open ("/dev/video0", O_RDWR);
>
> if (fd < 0) {
> printf ("Error open device.\n");
> exit (1);
> }
>
> bufsize = 320 * 240 * 3;
> buf=mmap(0, bufsize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
>
> if (!buf) {
> printf ("mmap error.\n");
> exit (1);
> }
> else {
> printf ("mmap successful.\n");
> }
>
> result = munmap (buf, bufsize);
> printf ("unmap successful.\n");
> close (fd);
> printf ("device closed.\n");
>
> return (0);
> }
> ---------------------------------------------------------------------
>
> Is this gnat/florist error or just as what you mentioned about page
> alignment?
>
> I am using gcc/gnat 3.3.3 and florist 3.15p on SuSE Linux 9.1 Pro on
> AMD Athlon. I have no problem with both gcc/gnat and florist. My
other
> programs using both for RS-232 interface have no problems at all.
> Now, I'm in despair with curiosity! :-)
> --
> Adrian Hoe
I noticed the identation of my code is gone. I hope this is the error
of the Beta Google Groups. Sorry for the mess.
--
Adrian Hoe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 2:45 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-30 2:48 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
@ 2005-01-30 15:39 ` Mark Lorenzen
2005-01-30 16:02 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-30 16:05 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
1 sibling, 2 replies; 15+ messages in thread
From: Mark Lorenzen @ 2005-01-30 15:39 UTC (permalink / raw)
"Adrian Hoe" <byhoe@greenlime.com> writes:
> Mark Lorenzen wrote:
> >
> > In the way you are using Map_Memeory, it is probably because the
> value
> > of Offset (i.e. 0) is not page aligned.
> >
> > On many implementations, you can only map a multiple of the page size
> > and the memory has to be page aligned.
> >
>
>
>
> I wrote a short C program to test mmap. It works and seems like no
> problem doing mmap. The C code is as below:
>
> ---------------------------------------------------------------------
> #include <stdio.h>
> #include <fcntl.h>
> #include "linux/ioctl.h"
> #include "sys/ioctl.h"
> #include "sys/mman.h"
>
> int main ()
> {
> int fd;
> int bufsize;
> int result;
> char *buf;
>
> fd = open ("/dev/video0", O_RDWR);
>
> if (fd < 0) {
> printf ("Error open device.\n");
> exit (1);
> }
>
> bufsize = 320 * 240 * 3;
> buf=mmap(0, bufsize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
>
> if (!buf) {
Note that mmap wil NEVER return 0, so the check should be "if (buf ==
MAP_FAILED)".
> printf ("mmap error.\n");
> exit (1);
> }
> else {
> printf ("mmap successful.\n");
> }
>
> result = munmap (buf, bufsize);
> printf ("unmap successful.\n");
> close (fd);
> printf ("device closed.\n");
>
> return (0);
> }
> ---------------------------------------------------------------------
>
> Is this gnat/florist error or just as what you mentioned about page
> alignment?
I corrected the above mentioned problem and successfully opened and
mapped a file. Strange.
>
> I am using gcc/gnat 3.3.3 and florist 3.15p on SuSE Linux 9.1 Pro on
> AMD Athlon. I have no problem with both gcc/gnat and florist. My other
> programs using both for RS-232 interface have no problems at all.
> Now, I'm in despair with curiosity! :-)
Please try to run the program using strace and see how mmap is
actually called.
> --
> Adrian Hoe
- Mark Lorenzen
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 15:39 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
@ 2005-01-30 16:02 ` Adrian Hoe
2005-01-30 16:19 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
2005-01-30 16:05 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
1 sibling, 1 reply; 15+ messages in thread
From: Adrian Hoe @ 2005-01-30 16:02 UTC (permalink / raw)
Mark Lorenzen wrote:
>
> I corrected the above mentioned problem and successfully opened and
> mapped a file. Strange.
Yes. I made a mistake. It should be:
if (buf == MAP_FAILED)
and it gave me error as well. And the strace says:
open("/dev/video0", O_RDWR) = 3
mmap2(NULL, 230400, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = -1 EINVAL
(Invalid argument)
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
m
mmap gives EINVAL in my C and Ada programs.
--
Adrian Hoe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 15:39 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
2005-01-30 16:02 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
@ 2005-01-30 16:05 ` Adrian Hoe
2005-01-30 16:22 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
1 sibling, 1 reply; 15+ messages in thread
From: Adrian Hoe @ 2005-01-30 16:05 UTC (permalink / raw)
Mark Lorenzen wrote:
>
> Note that mmap wil NEVER return 0, so the check should be "if (buf ==
> MAP_FAILED)".
>
>
> I corrected the above mentioned problem and successfully opened and
> mapped a file. Strange.
>
Did you managed to open and map /dev/video0 after you change the line
to if (buf == MAP_FAILED)?
Or could it be a problem with distro? Which Linux distro are you using?
--
Adrian Hoe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 16:02 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
@ 2005-01-30 16:19 ` Mark Lorenzen
2005-01-30 16:36 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
0 siblings, 1 reply; 15+ messages in thread
From: Mark Lorenzen @ 2005-01-30 16:19 UTC (permalink / raw)
"Adrian Hoe" <byhoe@greenlime.com> writes:
> Mark Lorenzen wrote:
> >
> > I corrected the above mentioned problem and successfully opened and
> > mapped a file. Strange.
>
> Yes. I made a mistake. It should be:
>
> if (buf == MAP_FAILED)
>
> and it gave me error as well. And the strace says:
>
> open("/dev/video0", O_RDWR) = 3
> mmap2(NULL, 230400, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = -1 EINVAL
I was just wondering: Is it allowed to map a device file as shared
memory? Try to use MAP_PRIVATE instead of MAP_SHARED.
> (Invalid argument)
> fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
> m
>
> mmap gives EINVAL in my C and Ada programs.
> --
> Adrian Hoe
- Mark Lorenzen
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 16:05 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
@ 2005-01-30 16:22 ` Mark Lorenzen
0 siblings, 0 replies; 15+ messages in thread
From: Mark Lorenzen @ 2005-01-30 16:22 UTC (permalink / raw)
"Adrian Hoe" <byhoe@greenlime.com> writes:
> Mark Lorenzen wrote:
>
> >
> > Note that mmap wil NEVER return 0, so the check should be "if (buf ==
> > MAP_FAILED)".
> >
> >
> > I corrected the above mentioned problem and successfully opened and
> > mapped a file. Strange.
> >
>
> Did you managed to open and map /dev/video0 after you change the line
> to if (buf == MAP_FAILED)?
I do not have that device special file. I opened and mapped a regular
file that i have read/write access to.
>
> Or could it be a problem with distro? Which Linux distro are you using?
> --
> Adrian Hoe
- Mark Lorenzen
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 16:19 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
@ 2005-01-30 16:36 ` Mark Lorenzen
2005-01-30 18:51 ` POSIX.Memory_Mapping.Map_Memory Florian Weimer
0 siblings, 1 reply; 15+ messages in thread
From: Mark Lorenzen @ 2005-01-30 16:36 UTC (permalink / raw)
Mark Lorenzen <mark.lorenzen@ofir.dk> writes:
> "Adrian Hoe" <byhoe@greenlime.com> writes:
>
> > Mark Lorenzen wrote:
> > >
> > > I corrected the above mentioned problem and successfully opened and
> > > mapped a file. Strange.
> >
> > Yes. I made a mistake. It should be:
> >
> > if (buf == MAP_FAILED)
> >
> > and it gave me error as well. And the strace says:
> >
> > open("/dev/video0", O_RDWR) = 3
> > mmap2(NULL, 230400, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = -1 EINVAL
>
> I was just wondering: Is it allowed to map a device file as shared
> memory? Try to use MAP_PRIVATE instead of MAP_SHARED.
Furthermore: I do not think that it is possible to map character
special files, since it only allows sequential access. You can
probably only map block special files.
>
> > (Invalid argument)
> > fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
> > m
> >
> > mmap gives EINVAL in my C and Ada programs.
> > --
> > Adrian Hoe
>
> - Mark Lorenzen
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 16:36 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
@ 2005-01-30 18:51 ` Florian Weimer
2005-02-27 6:59 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
0 siblings, 1 reply; 15+ messages in thread
From: Florian Weimer @ 2005-01-30 18:51 UTC (permalink / raw)
* Mark Lorenzen:
>> I was just wondering: Is it allowed to map a device file as shared
>> memory? Try to use MAP_PRIVATE instead of MAP_SHARED.
>
> Furthermore: I do not think that it is possible to map character
> special files, since it only allows sequential access. You can
> probably only map block special files.
It's possible to map /dev/zero. In fact, there is little difference
between character and block devices these days.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-01-30 18:51 ` POSIX.Memory_Mapping.Map_Memory Florian Weimer
@ 2005-02-27 6:59 ` Adrian Hoe
2005-02-27 13:03 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
0 siblings, 1 reply; 15+ messages in thread
From: Adrian Hoe @ 2005-02-27 6:59 UTC (permalink / raw)
Florian Weimer wrote:
> * Mark Lorenzen:
>
> >> I was just wondering: Is it allowed to map a device file as shared
> >> memory? Try to use MAP_PRIVATE instead of MAP_SHARED.
> >
> > Furthermore: I do not think that it is possible to map character
> > special files, since it only allows sequential access. You can
> > probably only map block special files.
>
> It's possible to map /dev/zero. In fact, there is little difference
> between character and block devices these days.
Just for the purpose of recording for people who may need this in the
future:
I've successfully mapped the memory with
POSIX.Memory_Mapping.Map_Memory.
The VIDIOCGMBUF ioctl has to be issued before Map_Memory. This ioctl
reports the size of buffer to Memory_Map and the offset within the
buffer for each frame.
My application is far from completion but I have resolved this
Memory_Map issue. I believe the wheel has just started rolling again.
:-)
Regards,
--
Adrian Hoe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: POSIX.Memory_Mapping.Map_Memory
2005-02-27 6:59 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
@ 2005-02-27 13:03 ` Mark Lorenzen
0 siblings, 0 replies; 15+ messages in thread
From: Mark Lorenzen @ 2005-02-27 13:03 UTC (permalink / raw)
"Adrian Hoe" <byhoe@greenlime.com> writes:
> Florian Weimer wrote:
> > * Mark Lorenzen:
> >
> > >> I was just wondering: Is it allowed to map a device file as shared
> > >> memory? Try to use MAP_PRIVATE instead of MAP_SHARED.
> > >
> > > Furthermore: I do not think that it is possible to map character
> > > special files, since it only allows sequential access. You can
> > > probably only map block special files.
> >
> > It's possible to map /dev/zero. In fact, there is little difference
> > between character and block devices these days.
>
>
>
> Just for the purpose of recording for people who may need this in the
> future:
>
> I've successfully mapped the memory with
> POSIX.Memory_Mapping.Map_Memory.
>
> The VIDIOCGMBUF ioctl has to be issued before Map_Memory. This ioctl
> reports the size of buffer to Memory_Map and the offset within the
> buffer for each frame.
>
> My application is far from completion but I have resolved this
> Memory_Map issue. I believe the wheel has just started rolling again.
> :-)
>
> Regards,
>
> --
> Adrian Hoe
Thanks for the info. So we can fortunately conclude that the problem
is neither Ada nor Florist related, but is simply a special issue with
this type of device.
- Mark Lorenzen
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2005-02-27 13:03 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-29 15:58 POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-29 16:20 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
2005-01-29 16:31 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-29 18:44 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
2005-01-30 2:45 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-30 2:48 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-30 15:39 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
2005-01-30 16:02 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-30 16:19 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
2005-01-30 16:36 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
2005-01-30 18:51 ` POSIX.Memory_Mapping.Map_Memory Florian Weimer
2005-02-27 6:59 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-02-27 13:03 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
2005-01-30 16:05 ` POSIX.Memory_Mapping.Map_Memory Adrian Hoe
2005-01-30 16:22 ` POSIX.Memory_Mapping.Map_Memory Mark Lorenzen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox