All of lore.kernel.org
 help / color / mirror / Atom feed
* O_NOATIME and files in /proc
@ 2009-11-17 17:06 Bernd Petrovitsch
  2009-11-20 21:36 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Bernd Petrovitsch @ 2009-11-17 17:06 UTC (permalink / raw)
  To: linux-kernel, Alexey Dobriyan, Andrew Morton

Hi all!

Is there a specific reason that open can not open files (at
least /proc/noatime and /proc/cpuinfo) under /proc with NO_ATIME as the
following program shows:
----  snip  ----
{12}cat noatime.c

#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>

int main(void)
{
	int fd = open("/proc/uptime", O_RDONLY|O_NOATIME);
	if (fd == -1) {
		printf("fd=%d, errno=%s\n", fd, strerror(errno));
	} else {
		printf("fd=%d\n", fd);
	}
	return 0;
}
----  snip  ----
When I compile and run it, it prints
----  snip  ----
{13}./noatime 
fd=-1, errno=Operation not permitted
----  snip  ----
Removing the "NO_ATIME" makes it work (of course).

I can also set the "noatime" mount flag on a remount and it shows up
in /proc/mounts but it makes for the above no difference.

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services



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

end of thread, other threads:[~2009-11-30 10:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-17 17:06 O_NOATIME and files in /proc Bernd Petrovitsch
2009-11-20 21:36 ` Andrew Morton
2009-11-20 22:11   ` Alan Cox
2009-11-30 10:36     ` Bernd Petrovitsch

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.