All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Corrupted files when using fwrite() or fprintf()
@ 2015-01-22 11:30 Krause, Holger
  2015-01-22 11:35 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 3+ messages in thread
From: Krause, Holger @ 2015-01-22 11:30 UTC (permalink / raw)
  To: xenomai@xenomai.org

Hello all Xenomai developers.

We run Xenomai 2.6.3 with posix skin activated.
In one thread with priority 0 - so it runs in secondary mode - 
we use file io with fopen, fwrite, fclose instructions.

When writing a file via fwrite or fprintf we get a problem :
Just one part (the first) of the file has been written. The rest of the 
file is missing although the fwrites/fprintfs have been executed.

The sequence is like this:

// Open file
fopen();

// Write the first part 
fwrite();

// Switch the state machine to the next state to prepare the next part
// to be written to the file.
// So the system can do other things - other threads come up and so on

// Write the second part
fwrite()

// Switch the state machine to the next state to prepare the next part
// to be written to the file.
// So the system can do other things - other threads come up and so on

...

// Finally close the file
fclose();

In this situation we get some kind of a timing issue:
Only the first part of the file has been written - but the file is 
closed correctly.
The statemachine works correctly so all the fwrites haben been executed
but ony the first fwrite works on the filesytem.

In another thread we use the same mechanism but everythings works there.

When I debug the code everythings works.

When I switch all the threads to linux everything works
(of course without realtime) - the file is OK.

When I insert a rt_task_sleep() after the fwrites everythings works if 
the delay time is big enough (>100ms).

Switching all threads in our system to priority 0 (so that an RT thread 
cannot catch the hole CPU time and the system cannot write data to 
disk) does not change anything.

Does anybody have similar problems?

Best regards,
Holger Krause.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai] Corrupted files when using fwrite() or fprintf()
  2015-01-22 11:30 [Xenomai] Corrupted files when using fwrite() or fprintf() Krause, Holger
@ 2015-01-22 11:35 ` Gilles Chanteperdrix
       [not found]   ` <2DC6992080CF3541B10F42EBF0B5C30342F644D7@SMExchange01.siebmeyer.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2015-01-22 11:35 UTC (permalink / raw)
  To: Krause, Holger; +Cc: xenomai@xenomai.org

On Thu, Jan 22, 2015 at 11:30:08AM +0000, Krause, Holger wrote:
> Hello all Xenomai developers.
> 
> We run Xenomai 2.6.3 with posix skin activated.

Do you have the same problem with Xenomai 2.6.4 ?

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai] Corrupted files when using fwrite() or fprintf()
       [not found]   ` <2DC6992080CF3541B10F42EBF0B5C30342F644D7@SMExchange01.siebmeyer.org>
@ 2015-01-26 11:54     ` Gilles Chanteperdrix
  0 siblings, 0 replies; 3+ messages in thread
From: Gilles Chanteperdrix @ 2015-01-26 11:54 UTC (permalink / raw)
  To: Krause, Holger

On Mon, Jan 26, 2015 at 09:46:55AM +0000, Krause, Holger wrote:
> Hello,
> 
> in version 2.6.4. the error is still present but there is a small change:
> The file is now bigger, there are more lines in the file not just the 
> first one.

Ok. Could you post a reduced self-contained test case allowing us to
reproduce the issue ?

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-26 11:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-22 11:30 [Xenomai] Corrupted files when using fwrite() or fprintf() Krause, Holger
2015-01-22 11:35 ` Gilles Chanteperdrix
     [not found]   ` <2DC6992080CF3541B10F42EBF0B5C30342F644D7@SMExchange01.siebmeyer.org>
2015-01-26 11:54     ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.