kern/90063: procfs: access("/proc/123", F_OK) doesn't work on >= 6.x
Johan van Selst
johans at stack.nl
Wed Dec 7 03:00:13 PST 2005
>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 at 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:
More information about the freebsd-bugs
mailing list