nix icon indicating copy to clipboard operation
nix copied to clipboard

Futex

Open JonathanWoollett-Light opened this issue 2 years ago • 8 comments
trafficstars

Add futex interface.

JonathanWoollett-Light avatar Dec 04 '22 19:12 JonathanWoollett-Light

Does https://github.com/m-ou-se/linux-futex meet your needs?

rtzoeller avatar Dec 04 '22 22:12 rtzoeller

Does https://github.com/m-ou-se/linux-futex meet your needs?

This is a useful reference, thank you. I do think this functionality should be included in nix.

JonathanWoollett-Light avatar Dec 04 '22 22:12 JonathanWoollett-Light

I do think this functionality should be included in nix.

I don't disagree in principle, but I'd like to see nix's support provide some value-add compared to prior art. For example, Mara's crate only (appears to) supports Linux futexes. It'd be nice if nix supported the BSD variants as well.

rtzoeller avatar Dec 04 '22 23:12 rtzoeller

I do think this functionality should be included in nix.

I don't disagree in principle, but I'd like to see nix's support provide some value-add compared to prior art. For example, Mara's crate only (appears to) supports Linux futexes. It'd be nice if nix supported the BSD variants as well.

I haven't implemented BSD since it is not personally useful to me. I think if someone needs this they can implement it. This is still a significant value add to nix and I would also argue my implementation is smaller and simpler than linux-futex and this I would argue makes it better.

JonathanWoollett-Light avatar Dec 31 '22 23:12 JonathanWoollett-Light

I still don't understand what advantage this PR has over the existing linux-futex crate.

asomers avatar Nov 25 '23 17:11 asomers

I still don't understand what advantage this PR has over the existing linux-futex crate.

The advantage is having it in Nix and it aligning with the design of Nix.

The point of nix is to provide wrappers to Unix-like systems..

Providing bindings to Unix-like systems except for functionality that is already covered by other crates would mean removing like 80% of already implemented functionality.

JonathanWoollett-Light avatar Nov 25 '23 20:11 JonathanWoollett-Light

The point of nix is to provide wrappers to Unix-like systems..

The point of Nix is to provide idiomatic zero-cost access to Unix system APIs. But providing access to ALL Unix system APIs isn't a goal. Nor is it productive to duplicate work that others have already done. That wastes developer resources and increases our maintenance burden. If another crate already does a good job, then there's no reason why we should need to, too.

asomers avatar Nov 26 '23 16:11 asomers

The point of nix is to provide wrappers to Unix-like systems..

The point of Nix is to provide idiomatic zero-cost access to Unix system APIs. But providing access to ALL Unix system APIs isn't a goal. Nor is it productive to duplicate work that others have already done. That wastes developer resources and increases our maintenance burden. If another crate already does a good job, then there's no reason why we should need to, too.

If this is really the path Nix pursues it should be documented:

Nix seeks to provide friendly bindings to various nix platform APIs (Linux, Darwin, ...) except where existing safe bindings exist in the eco-system.

*e.g. Nix does not implement an interface to futex because https://github.com/m-ou-se/linux-futex exists.

I think this sounds absurd. I do not agree with this, I see the reasoning but I think it is shallow. I could for instance post an issue on half the functionality on Nix saying it should be removed since decent alternatives exist. I could also leave this comment on most currently open PRs saying a decent alternative exists that support this. Following this almost completely eliminates the purpose of Nix.

A key value is that Nix covers many things, that I don't need 30 different crates to cover each small component. That Nix offers an interface to all this functionality that reasonably neatly fits together.

JonathanWoollett-Light avatar Nov 26 '23 17:11 JonathanWoollett-Light