Discussion:
[ast-developers] |getcwdat()| and |pathprogat()| ?
Roland Mainz
2013-07-27 23:54:49 UTC
Permalink
Hi!

----

[Mainly for Glenn...]
Is it Ok if I add |getcwdat()| (which is missing in the POSIX |*at()|
APIs... but why ?) and |pathprogat()| to libast ?

----

Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
Glenn Fowler
2013-07-28 04:53:42 UTC
Permalink
Post by Roland Mainz
[Mainly for Glenn...]
Is it Ok if I add |getcwdat()| (which is missing in the POSIX |*at()|
APIs... but why ?) and |pathprogat()| to libast ?
I can see what getcwdat() would do
but pathprogat()?
Roland Mainz
2013-07-28 04:56:45 UTC
Permalink
Post by Glenn Fowler
Post by Roland Mainz
[Mainly for Glenn...]
Is it Ok if I add |getcwdat()| (which is missing in the POSIX |*at()|
APIs... but why ?) and |pathprogat()| to libast ?
I can see what getcwdat() would do
but pathprogat()?
Erm... |pathprog()| uses |readlink()| ... right ? :-)
... on the other hand this was written when I was well beyond madness
due to lack of sleep... ;-/

----

Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
Irek Szczesniak
2013-07-29 04:26:38 UTC
Permalink
Post by Roland Mainz
Hi!
----
[Mainly for Glenn...]
Is it Ok if I add |getcwdat()| (which is missing in the POSIX |*at()|
APIs... but why ?) and |pathprogat()| to libast ?
Just don't use the libast getcwd(). It relies on chdir() and other
cruel stuff which is incompatible to threads ;-(

Irek
Glenn Fowler
2013-07-29 08:08:22 UTC
Permalink
Post by Irek Szczesniak
Post by Roland Mainz
Hi!
----
[Mainly for Glenn...]
Is it Ok if I add |getcwdat()| (which is missing in the POSIX |*at()|
APIs... but why ?) and |pathprogat()| to libast ?
Just don't use the libast getcwd(). It relies on chdir() and other
cruel stuff which is incompatible to threads ;-(
on linux is uses the getcwd syscall via syscall(2)

I'm guessing the only thread cruelty is using chdir() to get around pwd paths that
would trigger ENAMETOOLONG -- the code was written before fdopendir() and fchdir()
and *at() -- the chdir() part only kicks in on long pwd

its time to revisit that code with a fallback to the cruel code on systems
that don't have fdopendir()
ольга крыжановская
2013-07-29 08:14:48 UTC
Permalink
The discussion is not about getcwd(). That is hopefully well done. The
discussion is about fgetcwd() (or getcwdat()) to determinate the full
path for a given file descriptor, or AT_FDCWD.

The sad story is, as you have said on the chat, that some OSes have
neither /proc, libproc or fdopendir(), which is a shame. Either way, I
provide a patch for it.

Olga
Post by Glenn Fowler
Post by Irek Szczesniak
Post by Roland Mainz
Hi!
----
[Mainly for Glenn...]
Is it Ok if I add |getcwdat()| (which is missing in the POSIX |*at()|
APIs... but why ?) and |pathprogat()| to libast ?
Just don't use the libast getcwd(). It relies on chdir() and other
cruel stuff which is incompatible to threads ;-(
on linux is uses the getcwd syscall via syscall(2)
I'm guessing the only thread cruelty is using chdir() to get around pwd paths that
would trigger ENAMETOOLONG -- the code was written before fdopendir() and fchdir()
and *at() -- the chdir() part only kicks in on long pwd
its time to revisit that code with a fallback to the cruel code on systems
that don't have fdopendir()
_______________________________________________
ast-developers mailing list
ast-developers at lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers
--
, _ _ ,
{ \/`o;====- Olga Kryzhanovska -====;o`\/ }
.----'-/`-/ olga.kryzhanovska at gmail.com \-`\-'----.
`'-..-| / http://twitter.com/fleyta \ |-..-'`
/\/\ Solaris/BSD//C/C++ programmer /\/\
`--` `--`
Glenn Fowler
2013-07-29 08:20:08 UTC
Permalink
Post by ольга крыжановская
The discussion is not about getcwd(). That is hopefully well done. The
discussion is about fgetcwd() (or getcwdat()) to determinate the full
path for a given file descriptor, or AT_FDCWD.
The sad story is, as you have said on the chat, that some OSes have
neither /proc, libproc or fdopendir(), which is a shame. Either way, I
provide a patch for it.
my thought was that on modern systems the getcwd() implementation could
rely on fgetcwd() (even if only internally) to handle ENAMETOOLONG pwd paths

so fgetcwd() would be useful in that respect even if it were a static for getcwd()
but make sure its disabled on systems where *at() is emulated in ast
Post by ольга крыжановская
Olga
Post by Glenn Fowler
Post by Irek Szczesniak
Post by Roland Mainz
Hi!
----
[Mainly for Glenn...]
Is it Ok if I add |getcwdat()| (which is missing in the POSIX |*at()|
APIs... but why ?) and |pathprogat()| to libast ?
Just don't use the libast getcwd(). It relies on chdir() and other
cruel stuff which is incompatible to threads ;-(
on linux is uses the getcwd syscall via syscall(2)
I'm guessing the only thread cruelty is using chdir() to get around pwd paths that
would trigger ENAMETOOLONG -- the code was written before fdopendir() and fchdir()
and *at() -- the chdir() part only kicks in on long pwd
its time to revisit that code with a fallback to the cruel code on systems
that don't have fdopendir()
_______________________________________________
ast-developers mailing list
ast-developers at lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers
--
, _ _ ,
{ \/`o;====- Olga Kryzhanovska -====;o`\/ }
.----'-/`-/ olga.kryzhanovska at gmail.com \-`\-'----.
`'-..-| / http://twitter.com/fleyta \ |-..-'`
/\/\ Solaris/BSD//C/C++ programmer /\/\
`--` `--`
Loading...