Where is "open" in "core.sys.linux.unistd"?

rempas rempas at tutanota.com
Fri Jul 9 15:31:51 UTC 2021


On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer 
wrote:
> On 7/9/21 10:51 AM, rempas wrote:
>> The file can be found quickly 
>> [here](https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d) or in your system if you want. Now the question is, why isn't there an "open" function for the equivalent system call? "close", "write", "read" etc. all exist. Anyone knows what's going on with open?
>
> Because file descriptors are created in different ways.
>
> For example, `open` exists for files 
> [here](https://github.com/dlang/druntime/blob/master/src/core/sys/posix/fcntl.d)
>
> But opening a socket is done via the `socket` system call 
> [here](https://github.com/dlang/druntime/blob/master/src/core/sys/posix/sys/socket.d)
>
> They don't take the same arguments (nor should they).
>
> But reading/writing, closing these file descriptors is always 
> the same.
>
> -Steve

If I tell you that I searched "fnctl" in the repo and didn't find 
anything will you believe me? Probably made a typo idk... Anyway 
thanks a lot your help and I wish you to have an amazing day!


More information about the Digitalmars-d-learn mailing list