On Thu, Jan 11, 2024 at 3:00 PM Martin Wege via Cygwin <cygwin@cygwin.com> wrote: > On Mon, Jan 8, 2024 at 3:11 PM Corinna Vinschen via Cygwin > <cygwin@cygwin.com> wrote: > > On Dec 18 18:47, Martin Wege via Cygwin wrote: > > > On Fri, Dec 1, 2023 at 10:52 AM Corinna Vinschen via Cygwin > > > <cygwin@cygwin.com> wrote: [snip] > > Apart from that, this sounds like a nice idea for Cygwin 3.6, > > provided somebody implements it, https://cygwin.com/acronyms/#SHTDI > > > > Assuming we can live without actually having a subdir and just > > allowing to open and create a file with the O_XATTR flag, it might be > > pretty simple to implement. The path handling code would just have to > > drop the colon from the list of characters converted to the private-use > > Unicode area. > > > > Implementing the subdir is a bit more complicated, especially when > > taking opendir/readdir of that virtual subdir into account, but it > > would certainly be doable. > > How do other OSes implement the O_XATTR subdir?
Basically you open a random file or dir with |openat(filename, O_XATTR)| and get a fd to that (virtual) attribute directory. The "." in that dir is virtual, but the ".." refers to the underlying file, so a |open("..", ...)| will return a fd to a file/dir to which the attributes belong to. https://illumos.org/man/7/fsattr has the whole API description. A Windows implementation should be therefore quite easy, as alternate data streams show up as "foo:stream1", "foo:stream2" etc., so just the directory lookup needs to be modified to skip the files with ':' in general, and only show the streams for an O_XATTR subdir, e.g. |openat("foo", O_XATTR)| would give a dir which lists only Windows file names which match "foo:*" I can support such an effort with testing, and a cleanroom implementation of https://illumos.org/man/1/runat (see https://github.com/illumos/illumos-gate/blob/master/usr/src/cmd/runat/runat.c for the Solaris/Illumos code) ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.ma...@nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple