/proc/self is not portable

Christopher O Cowan Christopher.O.Cowan at ibm.com
Tue Aug 7 14:24:21 UTC 2018


Andrew,

AIX does have the fd link under the pid, /proc/{pid}/fd.   Just no "self"
symlink.    I don't have access to other platforms like Solaris (?)
with /proc, but I seem to recall that the Linux /proc is a superset of the
other platforms.

AIX 7 also has a filem, /proc/version and a directory, /proc/sys/ that
contains sub-directories: adapter, aio, disk, fs, iodone, lvm, pcibux, and
posix_aio.
I also found some references to /proc/sys/kernel in Samba source, that
seems to be Linux specific.

In another post, I will ask about flock() and AIX, because this opens a
whole new can of worms.  There is one instance of /proc/locks usage in
lib/tdb/common/lock.c.   I believe /proc/locks is unique to Linux (but I'm
not sure about other platforms with a procfs.





From:	Andrew Bartlett <abartlet at samba.org>
To:	Christopher O Cowan <Christopher.O.Cowan at ibm.com>, samba tech
            <samba-technical at lists.samba.org>
Date:	08/06/2018 08:40 PM
Subject:	Re: /proc/self is not portable



On Mon, 2018-08-06 at 16:48 -0500, Christopher O Cowan via samba-
technical wrote:
> I'm compiling on AIX, and while it does have a /proc fs, it does not have
> the self symlink.   Should this be refactored to do the explicit getpid()
> instead?

Does it have the file descriptor links?

> I found 3 instances of this:
>
> $ git grep -n  '/proc/self'
> lib/replace/closefrom.c:56:     dirp = opendir("/proc/self/fd");

I take it AIX doesn't have closefrom()?

> source4/ntvfs/cifs_posix_cli/svfs_util.c:169:   ret = asprintf(&fd_path,
> "/proc/self/%d", fd);
> source4/ntvfs/simple/svfs_util.c:162:   ret = asprintf(&fd_path,
> "/proc/self/%d", fd);

Don't worry about any code under source4/ntvfs.  That is not the main
smbd file server and is not built in production builds by default.

Thanks,

Andrew Bartlett





-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180807/bba07090/graycol.gif>


More information about the samba-technical mailing list