Nп/п : 21 из 60
 От   : Grant Edwards                       2:5075/128        08 авг 23 14:31:02
 К    : pozz                                                  08 авг 23 17:36:16
 Тема : Re: Linux Embedded: how to get info from a running service
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 1@reader2.panix.com> 8489c7e8
@REPLY: 1@dont-email.me> 9287c923
@REPLYADDR Grant Edwards
<invalid@invalid.invalid>
@REPLYTO 2:5075/128 Grant Edwards
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: 1@reader2.panix.com>
@RFC-References: 1@dont-email.me>
1@dont-email.me> 1@dont-email.me>
@TZUTC: -0000
@PID: slrn/1.0.3 (Linux)
@TID: FIDOGATE-5.12-ge4e8b94
On 2023-08-08, pozz <pozzugno@gmail.com> wrote:

> Sincerely I don`t like your solution. First of all, you are writing 
> regularly on a normal file in the filesystem. Ok, maybe I can use a 
> tmpfs filesystem in RAM.
>
> Another issue I see is synchronization. Without a sync mechanism, the 
> reader could read bad data, because the writer is writing to it.

There is a trivial way to deal with that which has been used since
time immemorial on Unix:

Write to a temporary file, then close and reanme it.  The open() and
rename() system calls are atomic with respect to each other. The task
calling open() will get either the old file or the new file, never
something "in between".
  
--- slrn/1.0.3 (Linux)
 * Origin: PANIX Public Access Internet and UNIX, NYC (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх