Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - stat() timestamps for directories: (5 Items)
   
stat() timestamps for directories  
Hi,

The online manual doesn't say how file timestamps are updated for directories. http://www.qnx.com/developers/docs/7.0.0/
index.html#com.qnx.doc.neutrino.lib_ref/topic/s/stat_struct.html

So my question is, when does QNX update st_mtime for directories? I was hoping that stat("/dev/shmem/") would tell if 
some process has created a new shared memory object. However, I'm observing that mtime is constantly updating, even if 
no shm objects seem to be created/removed. Also /dev/shmem/slogger2/ timestamp seems to be constantly updating, even the
 mtime of each file in that direcory is not changed.

Thanks,
Lauri
Re: stat() timestamps for directories  
Please note that /dev/shmem is not a directory. It is a mount point for the resource manager that provides the path for 
shared memory objects.
The distributed nature of the QNX path space management means that every resource manager is free to implement this 
functionality in whatever way it wants, which can lead to inconsistencies. I'm not saying that your expectation of /dev/
shmem is wrong, but the implementation for this particular resource manager just returns the current time if you ask 
about the mount point.

--Elad
________________________________________
From: Lauri Kaila <community-noreply@qnx.com>
Sent: 22 January 2020 06:25:44
To: ostech-core_os
Subject: stat() timestamps for directories

Hi,

The online manual doesn't say how file timestamps are updated for directories. http://www.qnx.com/developers/docs/7.0.0/
index.html#com.qnx.doc.neutrino.lib_ref/topic/s/stat_struct.html

So my question is, when does QNX update st_mtime for directories? I was hoping that stat("/dev/shmem/") would tell if 
some process has created a new shared memory object. However, I'm observing that mtime is constantly updating, even if 
no shm objects seem to be created/removed. Also /dev/shmem/slogger2/ timestamp seems to be constantly updating, even the
 mtime of each file in that direcory is not changed.

Thanks,
Lauri



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post120171
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com
Re: stat() timestamps for directories  
Thanks, Elad!

There's then explanation, I can't use st_mtime for this purpose. I need to fall back to scanning the whole directory 
(unless some other way exists).

Lauri
Re: stat() timestamps for directories  
Hi Lauri,
maybe writing a resource manager that monitors the creation of files under /dev/shmem could be Your the solution.
There exists a programming example for something like that: http://www.qnx.com/support/knowledgebase.html?id=
50130000000nK2t

Regards,
Michael.
Re: stat() timestamps for directories  
Hi Michael,

Thanks for the link! Looks like it's a possible solution.

However, I've tried simply glob("/dev/shmem/*") periodically and so far it looks like good enough solution. Feels a 
little wasteful though.

Lauri