/proc/self is not portable

Andrew Bartlett abartlet at samba.org
Tue Aug 7 01:40:20 UTC 2018

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.


Andrew Bartlett
Andrew Bartlett
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   

More information about the samba-technical mailing list