Zig: "std.os.Dir.open()" does not compile on macosx platform.

Created on 25 Feb 2018  路  9Comments  路  Source: ziglang/zig

Failure message:

/Users/<user>/proj/zig-src/build/lib/zig/std/os/index.zig:1135:75: error: no member named 'O_DIRECTORY' in '/Users/cailei/proj/zig-src/build/lib/zig/std/os/darwin.zig'
        const fd = try posixOpen(allocator, dir_path, posix.O_RDONLY|posix.O_DIRECTORY|posix.O_CLOEXEC, 0);

zig version: 0.1.1.884b5fb (master branch)

I've checked the docs of 'open()' on MacOS X, looks like it does not conform to posix 'open()', there is no O_DIRECTORY support.

bug os-macos

Most helpful comment

I have a WIP on my mac for this. I'll try to get it finished up this week.

All 9 comments

I did find #define O_DIRECTORY 0x100000 on line 153 of my /usr/include/sys/fcntl.h on osx 10.13.2, I wonder if the following diff would fix this?

https://gist.github.com/jfo/402fae36c414b9fb53fd4be149431201

posix.getdents() isn't implemented either. That one is a linux-ism but can be approximated with getdirentries(). I'll see if I can make it work.

I have a WIP on my mac for this. I'll try to get it finished up this week.

@andrewrk Did you make progress on this? I can take a stab at it this week if you want.

Ah, thanks for the reminder. I did not make progress, and I could use a hand. I pushed what I had to wip-macos-dirent. Feel free to use it, or not, however you see fit.

Is this issue up for grabs still or are you working on it, @bnoordhuis?

Last month consisted mostly of nursing duty so definitely up for grabs. :-)

To be clear here: I will try and work on this, but I don鈥檛 have a lot of time at the moment and I鈥檝e never programmed Zig, so I cannot commit. If anyone wants to take this up and do it themselves, no hard feelings!

Fixed with 7e951e504302dc2a7b0efa3e2ea0dcde5524ac60

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrewrk picture andrewrk  路  3Comments

andrewrk picture andrewrk  路  3Comments

S0urc3C0de picture S0urc3C0de  路  3Comments

andrewrk picture andrewrk  路  3Comments

fengb picture fengb  路  3Comments