On Mon, Aug 10, 2020 at 5:17 PM Waldek Kozaczuk <[email protected]>
wrote:
> Any reason why we use __syscall(SYS_close, ...) vs close()?
>
> struct if_nameindex *if_nameindex()
> {
> size_t n;
> void *p = 0;
> int s = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
> if (s>=0) {
> for (n=0; (p=do_nameindex(s, n)) == (void *)-1; n++);
> __syscall(SYS_close, s);
> }
> errno = ENOBUFS;
> return p;
> }
>
> Nadav,
>
> It looks like you imported this file from musl with this commit -
> c4df1043285b7597709f5199d619658909a22794?
>
Yes, I guess I copied it, and it worked, so I didn't even notice it, and
didn't bother to change it.
In retrospect, the __syscall() thing does work and maybe we shouldn't have
tried so hard to avoid it and remove it from every place.
Yes, calling syscall() wastes a small amount of time (function call,
switch, saving FPU - which isn't necessary for a
function call and could have been eliminated) - but it's completely
negligible for most if not all cases in musl.
It's not even a syscall instruction - it's a function call.
> Waldek
>
> --
> You received this message because you are subscribed to the Google Groups
> "OSv Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osv-dev/f7f26e7f-9b5b-4a53-83ee-543d4b726112n%40googlegroups.com
> <https://groups.google.com/d/msgid/osv-dev/f7f26e7f-9b5b-4a53-83ee-543d4b726112n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/osv-dev/CANEVyjusFQBRqxM2GTahAVNYbH-NFHCLZZrY3g_ipdVunj27xg%40mail.gmail.com.