Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Sep 2012 21:46:17 -0400
From:      Sam Varshavchik <mrsam@courier-mta.com>
To:        freebsd-hackers@freebsd.org
Subject:   What happened to my /proc/curproc/file?
Message-ID:  <cone.1346723177.448775.23058.1000@monster.email-scan.com>

next in thread | raw e-mail | index | archive | help
This is a MIME GnuPG-signed message.  If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.

--=_monster.email-scan.com-23058-1346723177-0001
Content-Type: text/plain; format=flowed; delsp=yes; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Am I the only one who's seeing this weirdness with procfs on 9.0-RELEASE-p3.  
Unless I'm overlooking something stupid, a process that rmdir(2)s a  
subdirectory of its current directory ends up with a broken  
/proc/curproc/file symlink:

[mrsam@freebsd ~/stasher/stasher]$ cat t.c
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>

void dump(int n)
{
	char buf[2048];

	printf("Line %d, rc=%s\n", n,
	       (readlink("/proc/curproc/file", buf, 2048) < 0 ? "err":"ok"));
}

int main(int argc, char **argv)
{
	dump(__LINE__);
	mkdir("conftestdir.tst", 0777);
	rmdir("conftestdir.tst");
	dump(__LINE__);
}
[mrsam@freebsd ~/stasher/stasher]$ cc -o t t.c
[mrsam@freebsd ~/stasher/stasher]$ ./t
Line 15, rc=ok
Line 18, rc=err

???????


--=_monster.email-scan.com-23058-1346723177-0001
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEABECAAYFAlBFXWkACgkQx9p3GYHlUOIdiwCfTA/gJcjma05KVAyGYIyRNT9R
UI8AniF646pssQnIJW6qyIm6G4JcQWhg
=bY6o
-----END PGP SIGNATURE-----

--=_monster.email-scan.com-23058-1346723177-0001--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cone.1346723177.448775.23058.1000>