Topic: [filesystem] Add fs::current_thread_path()
Author: Egor Pugin <egor.pugin@gmail.com>
Date: Tue, 20 Feb 2018 14:11:35 -0800 (PST)
Raw View
------=_Part_8881_50869155.1519164695758
Content-Type: multipart/alternative;
boundary="----=_Part_8882_632005228.1519164695758"
------=_Part_8882_632005228.1519164695758
Content-Type: text/plain; charset="UTF-8"
Hi!
When building multithreaded apps that use filesystem, it is often needed to
move to different dirs in different threads.
std::filesystem::current_thread_path() can be useful in such cases.
Users' implementation of such function can be more or less common in many
cases, so it might be useful to include it into fs.
What do you think?
Dummy proposal:
https://github.com/egorpugin/wg21/blob/master/D0000R0.pdf
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f4d0ff4-3123-4ca3-8721-4521c435efba%40isocpp.org.
------=_Part_8882_632005228.1519164695758
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi!<div><br></div><div>When building multithreaded apps th=
at use filesystem, it is often needed to move to different dirs in differen=
t threads.</div><div>std::filesystem::current_thread_path() can be useful i=
n such cases.</div><div>Users' implementation of such function can be m=
ore or less common in many cases, so it might be useful to include it into =
fs.</div><div><br></div><div>What do you think?</div><div><br></div><div>Du=
mmy proposal:</div><div>https://github.com/egorpugin/wg21/blob/master/D0000=
R0.pdf<br></div><div><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0f4d0ff4-3123-4ca3-8721-4521c435efba%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0f4d0ff4-3123-4ca3-8721-4521c435efba=
%40isocpp.org</a>.<br />
------=_Part_8882_632005228.1519164695758--
------=_Part_8881_50869155.1519164695758--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Tue, 20 Feb 2018 14:28:32 -0800
Raw View
On Tuesday, 20 February 2018 14:11:35 PST Egor Pugin wrote:
> Hi!
>
> When building multithreaded apps that use filesystem, it is often needed to
> move to different dirs in different threads.
> std::filesystem::current_thread_path() can be useful in such cases.
> Users' implementation of such function can be more or less common in many
> cases, so it might be useful to include it into fs.
fs::current_path() represents something that all operating systems have. Yours
does not. In most cases, the system-provided current path is nothing more than
a starting point for finding files specified by the user. Almost everything
else will use absolute paths or relative to a specific directory, which you
cannot assume to be the current for any thread or process.
But like you said, yours is trivial to implement (a single line). So why is it
needed? Can you show a concrete example where you would want two unrelated
functions to share the same path, but only if they run in the same thread?
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1817899.Xahq1S8phV%40tjmaciei-mobl1.
.
Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Tue, 20 Feb 2018 14:32:00 -0800 (PST)
Raw View
------=_Part_17009_1442010997.1519165920647
Content-Type: multipart/alternative;
boundary="----=_Part_17010_174115465.1519165920647"
------=_Part_17010_174115465.1519165920647
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Tuesday, February 20, 2018 at 2:11:35 PM UTC-8, Egor Pugin wrote:
>
> Hi!
>
> When building multithreaded apps that use filesystem, it is often needed=
=20
> to move to different dirs in different threads.
> std::filesystem::current_thread_path() can be useful in such cases.
>
Yes, but unfortunately that's not how the notion of "current working=20
directory" works, on any existing platform AFAIK.
https://blogs.msdn.microsoft.com/oldnewthing/20101109-00/?p=3D12323
So that explains why it wasn't standardized; the point of std::filesystem=
=20
is more to expose *existing* OS functionality than to make up new (and=20
potentially more expensive) functionality on top of it.
=20
> Users' implementation of such function can be more or less common in many=
=20
> cases, so it might be useful to include it into fs.
>
You can simulate a thread-local cwd on newer Linux kernels that support=20
openat() and so on... but would it just be completely unimplementable on=20
older systems without the equivalent of openat(), statat(), etc etc?
Or would you propose to say "It is *implementation-defined* whether=20
modifications to current_thread_path() are visible in other threads" and=20
leave it at that?
Plus, rather than standardize this one special-case use of openat(), I'd=20
prefer to see a proposal to standardize openat() itself, so that people can=
=20
build whatever they want (including but not limited to=20
current_thread_path()) on top of that primitive. I shouldn't have to muck=
=20
around with global variables, *thread-local or otherwise*, in order to=20
write useful programs.
=E2=80=93Arthur
--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/23745b89-db37-4f7b-8dc2-0db58ebc8fff%40isocpp.or=
g.
------=_Part_17010_174115465.1519165920647
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Tuesday, February 20, 2018 at 2:11:35 PM UTC-8, Egor Pu=
gin wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Hi!=
<div><br></div><div>When building multithreaded apps that use filesystem, i=
t is often needed to move to different dirs in different threads.</div><div=
>std::filesystem::current_<wbr>thread_path() can be useful in such cases.</=
div></div></blockquote><div><br></div><div>Yes, but unfortunately that'=
s not how the notion of "current working directory" works, on any=
existing platform AFAIK.</div><div><a href=3D"https://blogs.msdn.microsoft=
..com/oldnewthing/20101109-00/?p=3D12323">https://blogs.msdn.microsoft.com/o=
ldnewthing/20101109-00/?p=3D12323</a><br></div><div>So that explains why it=
wasn't standardized; the point of std::filesystem is more to expose <i=
>existing</i> OS functionality than to make up new (and potentially more ex=
pensive) functionality on top of it.</div><div>=C2=A0</div><blockquote clas=
s=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #c=
cc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>Users' implementatio=
n of such function can be more or less common in many cases, so it might be=
useful to include it into fs.</div></div></blockquote><div><br></div><div>=
You can simulate a thread-local cwd on newer Linux kernels that support ope=
nat() and so on... but would it just be completely unimplementable on older=
systems without the equivalent of openat(), statat(), etc etc?</div><div>O=
r would you propose to say "It is <i><b>implementation-defined</b></i>=
whether modifications to current_thread_path() are visible in other thread=
s" and leave it at that?</div><div><br></div><div>Plus, rather than st=
andardize this one special-case use of openat(), I'd prefer to see a pr=
oposal to standardize openat() itself, so that people can build whatever th=
ey want (including but not limited to current_thread_path()) on top of that=
primitive. I shouldn't have to muck around with global variables, <i>t=
hread-local or otherwise</i>, in order to write useful programs.</div><div>=
<br></div><div>=E2=80=93Arthur</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/23745b89-db37-4f7b-8dc2-0db58ebc8fff%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/23745b89-db37-4f7b-8dc2-0db58ebc8fff=
%40isocpp.org</a>.<br />
------=_Part_17010_174115465.1519165920647--
------=_Part_17009_1442010997.1519165920647--
.
Author: Niall Douglas <nialldouglas14@gmail.com>
Date: Wed, 21 Feb 2018 15:35:11 -0800 (PST)
Raw View
------=_Part_599_714372038.1519256111283
Content-Type: multipart/alternative;
boundary="----=_Part_600_465565792.1519256111283"
------=_Part_600_465565792.1519256111283
Content-Type: text/plain; charset="UTF-8"
>
>
> Plus, rather than standardize this one special-case use of openat(), I'd
> prefer to see a proposal to standardize openat() itself, so that people can
> build whatever they want (including but not limited to
> current_thread_path()) on top of that primitive. I shouldn't have to muck
> around with global variables, *thread-local or otherwise*, in order to
> write useful programs.
>
And with a bit of luck, C++ wrappers for openat() et al will start
standardisation later this
year. https://ned14.github.io/afio/classafio__v2__xxx_1_1path__handle.html
Niall
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/35c731f8-b07a-4b9b-92f5-9b3bdf3dc9d3%40isocpp.org.
------=_Part_600_465565792.1519256111283
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div><br></div><div>Plus, rather than standardize this one special-case=
use of openat(), I'd prefer to see a proposal to standardize openat() =
itself, so that people can build whatever they want (including but not limi=
ted to current_thread_path()) on top of that primitive. I shouldn't hav=
e to muck around with global variables, <i>thread-local or otherwise</i>, i=
n order to write useful programs.</div></div></blockquote><div><br></div><d=
iv>And with a bit of luck, C++ wrappers for openat() et al will start stand=
ardisation later this year.=C2=A0https://ned14.github.io/afio/classafio__v2=
__xxx_1_1path__handle.html</div><div><br></div><div>Niall</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/35c731f8-b07a-4b9b-92f5-9b3bdf3dc9d3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/35c731f8-b07a-4b9b-92f5-9b3bdf3dc9d3=
%40isocpp.org</a>.<br />
------=_Part_600_465565792.1519256111283--
------=_Part_599_714372038.1519256111283--
.
Author: =?UTF-8?B?SsOpcsO0bWUgU2FpbnQtTWFydGlu?= <jsaintmartin356@gmail.com>
Date: Thu, 22 Feb 2018 21:41:16 +0100
Raw View
--f4030438387cc17dae0565d310ad
Content-Type: text/plain; charset="UTF-8"
What is openat ?
On Thu, Feb 22, 2018 at 12:35 AM, Niall Douglas <nialldouglas14@gmail.com>
wrote:
>
>> Plus, rather than standardize this one special-case use of openat(), I'd
>> prefer to see a proposal to standardize openat() itself, so that people can
>> build whatever they want (including but not limited to
>> current_thread_path()) on top of that primitive. I shouldn't have to muck
>> around with global variables, *thread-local or otherwise*, in order to
>> write useful programs.
>>
>
> And with a bit of luck, C++ wrappers for openat() et al will start
> standardisation later this year. https://ned14.github.io/
> afio/classafio__v2__xxx_1_1path__handle.html
>
> Niall
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/35c731f8-b07a-4b9b-
> 92f5-9b3bdf3dc9d3%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/35c731f8-b07a-4b9b-92f5-9b3bdf3dc9d3%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC4OUEYqZoymdXxGKrsPmUhbRcm9h1u-FehkLcho1NTU8XOe8Q%40mail.gmail.com.
--f4030438387cc17dae0565d310ad
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">What is openat ?<br></div><div class=3D"gmail_extra"><br><=
div class=3D"gmail_quote">On Thu, Feb 22, 2018 at 12:35 AM, Niall Douglas <=
span dir=3D"ltr"><<a href=3D"mailto:nialldouglas14@gmail.com" target=3D"=
_blank">nialldouglas14@gmail.com</a>></span> wrote:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"m=
argin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div=
dir=3D"ltr"><div><br></div><div>Plus, rather than standardize this one spe=
cial-case use of openat(), I'd prefer to see a proposal to standardize =
openat() itself, so that people can build whatever they want (including but=
not limited to current_thread_path()) on top of that primitive. I shouldn&=
#39;t have to muck around with global variables, <i>thread-local or otherwi=
se</i>, in order to write useful programs.</div></div></blockquote><div><br=
></div><div>And with a bit of luck, C++ wrappers for openat() et al will st=
art standardisation later this year.=C2=A0<a href=3D"https://ned14.github.i=
o/afio/classafio__v2__xxx_1_1path__handle.html" target=3D"_blank">https://n=
ed14.github.io/<wbr>afio/classafio__v2__xxx_1_<wbr>1path__handle.html</a></=
div><span class=3D"HOEnZb"><font color=3D"#888888"><div><br></div><div>Nial=
l</div></font></span></div><span class=3D"HOEnZb"><font color=3D"#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/35c731f8-b07a-4b9b-92f5-9b3bdf3dc9d3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/35c7=
31f8-b07a-4b9b-<wbr>92f5-9b3bdf3dc9d3%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAC4OUEYqZoymdXxGKrsPmUhbRcm9h1u-Fehk=
Lcho1NTU8XOe8Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC4OUEYqZoymdXxG=
KrsPmUhbRcm9h1u-FehkLcho1NTU8XOe8Q%40mail.gmail.com</a>.<br />
--f4030438387cc17dae0565d310ad--
.
Author: Niall Douglas <nialldouglas14@gmail.com>
Date: Thu, 22 Feb 2018 13:29:28 -0800 (PST)
Raw View
------=_Part_3443_683030761.1519334968959
Content-Type: multipart/alternative;
boundary="----=_Part_3444_708048472.1519334968959"
------=_Part_3444_708048472.1519334968959
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Thursday, February 22, 2018 at 8:41:19 PM UTC, J=C3=A9r=C3=B4me Saint-Ma=
rtin wrote:
>
> What is openat ?
>
> https://linux.die.net/man/2/openat=20
--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/c092bdf0-76e0-4c13-b03c-938ad1211d06%40isocpp.or=
g.
------=_Part_3444_708048472.1519334968959
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, February 22, 2018 at 8:41:19 PM UTC, J=C3=A9r=
=C3=B4me Saint-Martin wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv dir=3D"ltr">What is openat ?<br></div><div><div class=3D"gmail_quote"><b=
r></div></div></blockquote><div>https://linux.die.net/man/2/openat=C2=A0</d=
iv></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/c092bdf0-76e0-4c13-b03c-938ad1211d06%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c092bdf0-76e0-4c13-b03c-938ad1211d06=
%40isocpp.org</a>.<br />
------=_Part_3444_708048472.1519334968959--
------=_Part_3443_683030761.1519334968959--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Thu, 22 Feb 2018 13:34:24 -0800
Raw View
On Thursday, 22 February 2018 13:29:28 PST Niall Douglas wrote:
> On Thursday, February 22, 2018 at 8:41:19 PM UTC, J=C3=A9r=C3=B4me Saint-=
Martin wrote:
> > What is openat ?
> >=20
> > https://linux.die.net/man/2/openat
http://pubs.opengroup.org/onlinepubs/9699919799/functions/openat.html
--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/2060368.JWRE5TX1oG%40tjmaciei-mobl1.
.