Where is "open" in "core.sys.linux.unistd"?
Steven Schveighoffer
schveiguy at gmail.com
Fri Jul 9 15:11:38 UTC 2021
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
More information about the Digitalmars-d-learn
mailing list