4 ms·
Indeed, one can reimplement those things on other systems. And other systems have already done this! But forcing the use of epoll instead of an existing abstra
by tedunangst 11y ago
Indeed, one can reimplement those things on other systems. And other systems have already done this!
But forcing the use of epoll instead of an existing abstraction like libevent means that now epoll is added to the list of things that must be implemented.
I could go through my code and change all the open(O_CREAT) calls to open(0x200) because that's the same thing. And then none of that code would work on linux, where O_CREAT is 0x40. Would that be an improvement?
- JoshTriplett 11y ago> But forcing the use of epoll instead of an existing abstraction like libevent means that now epoll is added to the list of things that must be implemented. Only if you care about being compatible with Linux. There's a 100% Linux-compatible kernel already available, though. :) And any platform that wants 100% compatibility with Linux could always run it through virtualization. I'm not saying portability is always a bad thing; far from it. It's also not always a good thing, though. And there's something to be said for the mindset that any time spent on portability is time not spent making the best possible program for the only platform you care about. Some programs should be portable. It's awesome that Firefox, Libreoffice, and other user-level software runs on Windows, for instance, to introduce people to FOSS and make it easier to switch platforms later. On the other hand, quite a bit of low-level or server software just doesn't make sense to run elsewhere, especially now that virtualization exists. At some point, it seems like the simplest portability layer is a copy of a Linux kernel and a way to run it on your target platform. > I could go through my code and change all the open(O_CREAT) calls to open(0x200) because that's the same thing. And then none of that code would work on linux, where O_CREAT is 0x40. Would that be an improvement? No; that wouldn't be an improvement even for code that only needs to run on one platform, because O_CREAT produces more self-documenting code. On the other hand, you could write all your code using openat and friends, and never call chdir, which can make software that otherwise had to worry about the working directory much simpler. That may be an improvement, even though that code then won't run on arbitrary POSIX OSes.
- tedunangst 11y agoopenat is posix.
- JoshTriplett 11y ago"and friends", most of which aren't.