Date: Wed, 7 Dec 2005 11:57:17 +0100 (CET)
From: Johan van Selst <johans@stack.nl>
To: FreeBSD-gnats-submit@FreeBSD.org
Subject: kern/90063: procfs: access("/proc/123", F_OK) doesn't work on >= 6.x
Message-ID: <20051207105717.3A44417035@mud.stack.nl>
Resent-Message-ID: <200512071100.jB7B0CNS072728@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 90063
>Category: kern
>Synopsis: procfs: access("/proc/123", F_OK) doesn't work on >= 6.x
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Dec 07 11:00:11 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Johan van Selst
>Release: FreeBSD 6.0-STABLE i386
>Organization:
>Environment:
System: FreeBSD mud.stack.nl 6.0-STABLE FreeBSD 6.0-STABLE #8: Mon Dec 5 13:04:53 CET 2005 johans@mud.stack.nl:/usr/obj/usr/src/sys/mud i386
>Description:
A quick and dirty check for a running pid does
if (access("/proc/123", F_OK))
However on a -CURRENT system, this will always return OK status (0) -
regardless of whether the directory/process is present or not. Only when
checking for permissions (R_OK, X_OK) a real check seems to be performed.
This is not compatible with the behaviour on FreeBSD 5.x and older.
>How-To-Repeat:
Compare the result of this code on a 5.x and 6.x system for any
non-existing /proc/1234 entry
if (access(argv[1], F_OK) < 0)
return EX_UNAVAILABLE;
if (access(argv[1], X_OK) < 0)
return EX_NOPERM;
return EX_OK;
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051207105717.3A44417035>
