The file can be found quickly here 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?
Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 09, 2021 Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
July 10, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rempas | On 10/07/2021 2: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? This is easily explained. open is not declared to be defined in unist.h[0] You may be wanting fopen from stdio.h[1] Or open from fcntl.h[2] [0] https://man7.org/linux/man-pages/man0/unistd.h.0p.html [1] https://man7.org/linux/man-pages/man0/stdio.h.0p.html [2] https://man7.org/linux/man-pages/man0/fcntl.h.0p.html |
July 09, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rempas | On 7/9/21 10:51 AM, rempas wrote: >The file can be found quickly here 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, But opening a socket is done via the They don't take the same arguments (nor should they). But reading/writing, closing these file descriptors is always the same. -Steve |
July 09, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | On Friday, 9 July 2021 at 15:04:32 UTC, rikki cattermole wrote:
>
> On 10/07/2021 2: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?
>
> This is easily explained.
>
> open is not declared to be defined in unist.h[0]
>
> You may be wanting fopen from stdio.h[1]
>
> Or open from fcntl.h[2]
>
> [0] https://man7.org/linux/man-pages/man0/unistd.h.0p.html
> [1] https://man7.org/linux/man-pages/man0/stdio.h.0p.html
> [2] https://man7.org/linux/man-pages/man0/fcntl.h.0p.html
Thanks man, have a nice day
|
July 09, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer wrote: >But reading/writing, closing these file descriptors is always the same. For sockets you'd typically use |
July 09, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | 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 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, But opening a socket is done via the 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! |
July 09, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dennis | On Friday, 9 July 2021 at 15:31:50 UTC, Dennis wrote: >On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer wrote: >But reading/writing, closing these file descriptors is always the same. For sockets you'd typically use That's very important! Thanks a lot for the info! |
July 09, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rempas | On 7/9/21 8:31 AM, rempas wrote: > I searched "fnctl" in the repo [...] Probably made a typo Yes, the typo should be obvious to the non-dyslexic among us. :) fnctl <-- wrong fcntl <-- correct Ali |
July 09, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dennis | On 7/9/21 11:31 AM, Dennis wrote: >On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer wrote: >But reading/writing, closing these file descriptors is always the same. For sockets you'd typically use I typically only use Windows is a different story, they have different i/o routines for system calls (yes, there's the shims for Posix file descriptors, but I wouldn't use those anyway). The larger point is that the reason -Steve |
July 09, 2021 Re: Where is "open" in "core.sys.linux.unistd"? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Friday, 9 July 2021 at 15:37:41 UTC, Ali Çehreli wrote:
> On 7/9/21 8:31 AM, rempas wrote:
>
> > I searched "fnctl" in the repo [...] Probably made a typo
>
> Yes, the typo should be obvious to the non-dyslexic among us. :)
>
> fnctl <-- wrong
> fcntl <-- correct
>
> Ali
Lol, I'm not dyslexic (or at least I haven't find out) but still some times I just miss those small details. Its probably that in my mind, I never really noticed how it's typed in the first place. I thought "fn" then "ctl" for "control" so "function control" or something idk.... Anyway yeah nice catch ;)
|