On Sat, Aug 29, 2020 at 08:17:51PM +0100, Matthew Wilcox wrote: > I probably have the wrong nomenclature for what I'm proposing. > > So here's a concrete API. What questions need to be answered? > > fd = open("real", O_RDWR); > > // fetch stream names > sfd = open_stream(fd, NULL); > read(sfd, names, length); 1) what does fstat() on sfd return? 2) what does keeping it open do to underlying file? 3) what happens to it if that underlying file is unlinked? 4) what does it do to underlying filesystem? Can it be unmounted? > close(sfd); > > // open the first one > sfd = open_stream(fd, names); > read(sfd, buffer, buflen); > close(sfd); > > // create a new anonymous stream > sfd = open_stream(fd, ""); > write(sfd, buffer, buflen); > // name it > linkat(sfd, NULL, fd, "newstream", AT_EMPTY_PATH); Oh, lovely - so linkat() *CAN* get that for dirfd and must somehow tell it from the normal case. With the semantics entirely unrelated to the normal one. And on top of everything else, we have 5) what are the permissions involved? When are they determined, BTW? > close(sfd); > > - Stream names are NUL terminated and may contain any other character. > If you want to put a '/' in a stream name, that's fine, but there's > no hierarchy. Ditto "//../././../../..//./." It's just a really > oddly named stream. Er... Whatever for? > - linkat() will fail if 'fd' does not match where 'sfd' was created. 6) "match" in the above being what, exactly? Incidentally, how do you remove those?