how to use RAM file

Hi everyone,
Following is the detail about what I met in my work and I hope to get
more help from someone. My platform is X86,and OS is QNX OS 6.2.My program
is OK while runinng in the harddisk , but when it is written to EPROM,it
can’t run properly.I think,for my program use message queue and share
memory which follow the standard of POSIX API,when my program is running
,it will generate two temporary files.But for the special charater of
EPROM,Ican’t write to EPROM when it running.So I want to know if I 'll
select RAM rather than EPROM,and save the two files generated in RAM.Now
I have no more information about RAM files,so I hope that anyone can give
me more advice. thanks a lot .

faithfully

Are these 2 files have to survive power cycle ?
If not, can you put them (create/read/write/close them) in /dev/shmem ?

fd = open("/dev/shmem/file1", O_RDWR | O_CREAT);

-xtang

niuxin <niuxin@hollysys.com> wrote in message
news:b6av2v$usg$1@tiger.openqnx.com

Hi everyone,
Following is the detail about what I met in my work and I hope to get
more help from someone. My platform is X86,and OS is QNX OS 6.2.My program
is OK while runinng in the harddisk , but when it is written to EPROM,it
can’t run properly.I think,for my program use message queue and share
memory which follow the standard of POSIX API,when my program is running
,it will generate two temporary files.But for the special charater of
EPROM,Ican’t write to EPROM when it running.So I want to know if I 'll
select RAM rather than EPROM,and save the two files generated in RAM.Now
I have no more information about RAM files,so I hope that anyone can give
me more advice. thanks a lot .

faithfully

The two file are not to survive while power shutdown ,and They are
generated when my program which use message queue and share memory is
running ,I want to write my program to EPROM,so I must write the two
temperly files to RAM,my program is such:
fd = shm_open("/dev/shmem/mem", O_RDWR | O_CREAT, 0777 );
when my progran is running in EPROM,it will stop here .Is somewhere is
wrong ?
Thanks !
Xiaodan Tang wrote:

Are these 2 files have to survive power cycle ?
If not, can you put them (create/read/write/close them) in /dev/shmem ?

fd = open("/dev/shmem/file1", O_RDWR | O_CREAT);

-xtang

niuxin <> niuxin@hollysys.com> > wrote in message
news:b6av2v$usg$> 1@tiger.openqnx.com> …
Hi everyone,
Following is the detail about what I met in my work and I hope to get
more help from someone. My platform is X86,and OS is QNX OS 6.2.My program
is OK while runinng in the harddisk , but when it is written to EPROM,it
can’t run properly.I think,for my program use message queue and share
memory which follow the standard of POSIX API,when my program is running
,it will generate two temporary files.But for the special charater of
EPROM,Ican’t write to EPROM when it running.So I want to know if I 'll
select RAM rather than EPROM,and save the two files generated in RAM.Now
I have no more information about RAM files,so I hope that anyone can give
me more advice. thanks a lot .

faithfully

“niuxin” <niuxin@hollysys.com> wrote in message
news:b6b2g6$v3t$1@tiger.openqnx.com

The two file are not to survive while power shutdown ,and They are
generated when my program which use message queue and share memory is
running ,I want to write my program to EPROM,so I must write the two
temperly files to RAM,my program is such:

fd = shm_open("/dev/shmem/mem", O_RDWR | O_CREAT, 0777 );

This is not create a file in ram it’s creating share memory object that’s
very different. You are not clear on exactly want you want to acheive. The
filename you are giving in your example is wrong, you don’t need to specify
/dev/shmem. I asume the \ before the first " is a typo? The filename
should be “\mem”.

when my progran is running in EPROM,it will stop here .Is somewhere is
wrong ?

Stop? What do you mean by stop; function shm_open returns an error (if so
look at the value of errno) or it never returns?

I recommend you read the documention on shm_open.

Thanks !
Xiaodan Tang wrote:

Are these 2 files have to survive power cycle ?
If not, can you put them (create/read/write/close them) in /dev/shmem ?

fd = open("/dev/shmem/file1", O_RDWR | O_CREAT);

-xtang

niuxin <> niuxin@hollysys.com> > wrote in message
news:b6av2v$usg$> 1@tiger.openqnx.com> …
Hi everyone,
Following is the detail about what I met in my work and I hope to
get
more help from someone. My platform is X86,and OS is QNX OS 6.2.My
program
is OK while runinng in the harddisk , but when it is written to
EPROM,it
can’t run properly.I think,for my program use message queue and share
memory which follow the standard of POSIX API,when my program is
running
,it will generate two temporary files.But for the special charater of
EPROM,Ican’t write to EPROM when it running.So I want to know if I
'll
select RAM rather than EPROM,and save the two files generated in
RAM.Now
I have no more information about RAM files,so I hope that anyone can
give
me more advice. thanks a lot .

faithfully


\

Mario Charest wrote:


“niuxin” <> niuxin@hollysys.com> > wrote in message
news:b6b2g6$v3t$> 1@tiger.openqnx.com> …
The two file are not to survive while power shutdown ,and They are
generated when my program which use message queue and share memory is
running ,I want to write my program to EPROM,so I must write the two
temperly files to RAM,my program is such:

fd = shm_open("/dev/shmem/mem", O_RDWR | O_CREAT, 0777 );

This is not create a file in ram it’s creating share memory object that’s
very different. You are not clear on exactly want you want to acheive. The
filename you are giving in your example is wrong, you don’t need to specify
/dev/shmem. I asume the \ before the first " is a typo? The filename
should be “\mem”.

when my progran is running in EPROM,it will stop here .Is somewhere is
wrong ?

Stop? What do you mean by stop; function shm_open returns an error (if so
look at the value of errno) or it never returns?

Yes,when my program is running ,it will generate two temprerary file
identifying share memory and message queues in my hard disk,but they can’t
be written to EPROM,so it will stop!

I recommend you read the documention on shm_open.

Thanks !
Xiaodan Tang wrote:

Are these 2 files have to survive power cycle ?
If not, can you put them (create/read/write/close them) in /dev/shmem ?

fd = open("/dev/shmem/file1", O_RDWR | O_CREAT);

-xtang

niuxin <> niuxin@hollysys.com> > wrote in message
news:b6av2v$usg$> 1@tiger.openqnx.com> …
Hi everyone,
Following is the detail about what I met in my work and I hope to
get
more help from someone. My platform is X86,and OS is QNX OS 6.2.My
program
is OK while runinng in the harddisk , but when it is written to
EPROM,it
can’t run properly.I think,for my program use message queue and share
memory which follow the standard of POSIX API,when my program is
running
,it will generate two temporary files.But for the special charater of
EPROM,Ican’t write to EPROM when it running.So I want to know if I
'll
select RAM rather than EPROM,and save the two files generated in
RAM.Now
I have no more information about RAM files,so I hope that anyone can
give
me more advice. thanks a lot .

faithfully


\

niuxin wrote:

The two file are not to survive while power shutdown ,and They are
generated when my program which use message queue and share memory is
running ,I want to write my program to EPROM,so I must write the two
temperly files to RAM,my program is such:
fd = shm_open("/dev/shmem/mem", O_RDWR | O_CREAT, 0777 );

Xiaodan didn’t type “shm_open” he typed “open”.

/dev/shmem will accept regular open requests for plain files.

Rennie

niuxin,

I think we still don’t understand what you mean by “generate two temprerary
file
identifing share memory and message queue in hard disk” ? Can you privide a
program or explain more detail in how these files are created, and how they
are using them?

When you say “my program will stop”, do you mean a perticular function
call in your program is returning error (what function? what error code)?
Or do you mean your program just crashed ? (where? why? )

Being said that, I had a very wide guess…

Are you trying to create “/dev/shmem” and “/dev/mqueue” ? Let me point
out that these are not “FILES on HARD DISK”. These are “path names managed
by resource managers”. Namely, /dev/shmem is managed by procnto,
and /dev/mqueue is managed by “mqueue” (/sbin/mqueue).

The “/dev/shmem” and “/dev/mqueue” usually is not "ls"able. You have to
create something uder them first to “see” them appear. shm_open() usually
used to create “objects” under /dev/shmem, and mq_open() usually used
to create “queues” under /dev/mqueue.

So, is mq_open() failed on you when you run your program from EPROM?
Make sure /sbin/mqueue is also running.

-xtang

niuxin <niuxin@hollysys.com> wrote in message
news:b6dbol$r26$1@tiger.openqnx.com

Mario Charest wrote:


“niuxin” <> niuxin@hollysys.com> > wrote in message
news:b6b2g6$v3t$> 1@tiger.openqnx.com> …
The two file are not to survive while power shutdown ,and They are
generated when my program which use message queue and share memory is
running ,I want to write my program to EPROM,so I must write the two
temperly files to RAM,my program is such:

fd = shm_open("/dev/shmem/mem", O_RDWR | O_CREAT, 0777 );

This is not create a file in ram it’s creating share memory object
that’s
very different. You are not clear on exactly want you want to acheive.
The
filename you are giving in your example is wrong, you don’t need to
specify
/dev/shmem. I asume the \ before the first " is a typo? The filename
should be “\mem”.

when my progran is running in EPROM,it will stop here .Is somewhere
is
wrong ?

Stop? What do you mean by stop; function shm_open returns an error (if
so
look at the value of errno) or it never returns?

Yes,when my program is running ,it will generate two temprerary file
identifying share memory and message queues in my hard disk,but they can’t
be written to EPROM,so it will stop!

I recommend you read the documention on shm_open.

Thanks !
Xiaodan Tang wrote:

Are these 2 files have to survive power cycle ?
If not, can you put them (create/read/write/close them) in
/dev/shmem ?

fd = open("/dev/shmem/file1", O_RDWR | O_CREAT);

-xtang

niuxin <> niuxin@hollysys.com> > wrote in message
news:b6av2v$usg$> 1@tiger.openqnx.com> …
Hi everyone,
Following is the detail about what I met in my work and I hope
to
get
more help from someone. My platform is X86,and OS is QNX OS 6.2.My
program
is OK while runinng in the harddisk , but when it is written to
EPROM,it
can’t run properly.I think,for my program use message queue and
share
memory which follow the standard of POSIX API,when my program is
running
,it will generate two temporary files.But for the special
charater of
EPROM,Ican’t write to EPROM when it running.So I want to know if
I
'll
select RAM rather than EPROM,and save the two files generated in
RAM.Now
I have no more information about RAM files,so I hope that anyone
can
give
me more advice. thanks a lot .

faithfully







\