On Fri, May 27, 2016 at 5:16 AM, Flix <[email protected]> wrote:
>
>
> <https://rawgit.com/Flix01/imgui/2015-10-Addons/examples/addons_examples/html/main.html>
>
>> Looks like our filesystem does create /proc/self/fd.
>>
> Why ?
>
>
I don't remember the details, but the code in library_fs.js has this
comment:
// create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the
name of the stream for fd 6 (see test_unistd_ttyname)
We do create it in a special way. Perhaps that causes only accessing files
under it to work, but reading it directly fails. Not sure offhand how easy
that is to fix.
> Please look at this code:
>
> // File: testrealpath.c
>> #include <stdlib.h>
>> #include <stdio.h>
>> #include <errno.h>
>>
>> int testrealpath(const char* path) {
>> errno = 0;
>> char *t_realpath_buf = realpath(path, NULL);
>> if (NULL == t_realpath_buf) {
>> printf("Resolved failed: \"%s\"\n",path);fflush(stdout);
>> perror("Resolve failed");
>> return 1;
>> } else {
>> printf("Resolved: \"%s\"\n", t_realpath_buf);fflush(stdout);
>> free(t_realpath_buf);
>> return 0;
>> }
>> }
>
>
>>
> int main(int argc, char **argv)
>> {
>> // folders
>> testrealpath("/");
>> testrealpath("/proc");
>> testrealpath("/proc/self");
>> testrealpath("/proc/self/non-existent");
>> testrealpath("/proc/self/fd"); // TypeError: node is
>> undefined. Why ?
>>
>> return 0;
>> }
>>
>
>>
> emcc -o testrealpath.html testrealpath.c
>>
> firefox testrealpath.html
>>
> Output:
>>
> Resolved: "/"
>> Resolved: "/proc"
>> Resolved: "/proc/self"
>> Resolved failed: "/proc/self/non-existent"
>> TypeError: node is undefined
>>
>
> So I get a TypeError instead of a "Resolved failed".
> Beside that if that folder appears in my dialogs, it means that is
> "somehow" returned by the "scandir" call with de->d_type==DT_DIR, where de
> is a pointer to a dirent struct (I'm using the dirent.h header file).
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.