libc icon indicating copy to clipboard operation
libc copied to clipboard

FreeBSD: add evdev structures

Open Awoonyaa opened this issue 1 year ago • 14 comments

Awoonyaa avatar Jun 21 '24 15:06 Awoonyaa

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

rustbot avatar Jun 21 '24 15:06 rustbot

Some context: On FreeBSD the evdev headers are not part of the base system, but come from a package named evdev-proto. It seems this package should be installed to make this PR compile.

@devnexen You did some FreeBSD PRs already, could you please look at this one too?

arrowd avatar Jun 24 '24 06:06 arrowd

Some context: On FreeBSD the evdev headers are not part of the base system, but come from a package named evdev-proto. It seems this package should be installed to make this PR compile.

Just quick response here: by definition if it is not part of the system thus has no place in this crate, e.g. libutil is still part of builtin libraries. my 2 cents :)

devnexen avatar Jun 24 '24 07:06 devnexen

Yes, but on Linux these data types are part of libc. Because of this, the consumers of this library that are using these types will fail to compile on FreeBSD. This is the case for the new release of https://github.com/mqudsi/syngesture

I think that putting these types here is the most correct solution, but I know nothing of Rust ecosystem.

arrowd avatar Jun 24 '24 07:06 arrowd

I get it, but Linux is Linux. However though, nothing is stopping you define those types in the requested project (or to publish a crate dedicated to those sort of things ?). But hey, I m not the maintainer of libc :) I do not get to decide.

devnexen avatar Jun 24 '24 07:06 devnexen

nothing is stopping you define those types in the requested project

This would require patching for each project that depends on these types in libc.

or to publish a crate dedicated to those sort of things ?

This would probably require patching too, although much less? Maybe it is a way to go then?

arrowd avatar Jun 24 '24 07:06 arrowd

Regardless, to make CI work here you would need to add the related dependency. CI at the moment only install what necessaty, it appears, for rustup nothing else. The decision to merge it or not is more @JohnTitor call :)

devnexen avatar Jun 24 '24 08:06 devnexen

I think you need to declare the appropriate evdev-proto header in libc-test/build.rs in the freebsd's list.

devnexen avatar Jul 05 '24 08:07 devnexen

Also note you need to treat struct field such as input_event::type_ as it is for sure not its real name, see other example how it is done in libc-test/build.rs.

devnexen avatar Jul 10 '24 08:07 devnexen

@devnexen thank you for the comments! Maybe you can advise me how to create a flag for checking file in /usr/local/include ?

Awoonyaa avatar Jul 12 '24 08:07 Awoonyaa

@devnexen thank you for the comments! Maybe you can advise me how to create a flag for checking file in /usr/local/include ?

Are you able to run tests locally ?

devnexen avatar Jul 12 '24 15:07 devnexen

@devnexen thank you for the comments! Maybe you can advise me how to create a flag for checking file in /usr/local/include ?

Are you able to run tests locally ?

Yes

Awoonyaa avatar Jul 16 '24 12:07 Awoonyaa

I asked about this as a policy question in https://github.com/rust-lang/libc/issues/3839. Until then:

@rustbot blocked

tgross35 avatar Aug 16 '24 18:08 tgross35

:umbrella: The latest upstream changes (presumably #3889) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Aug 29 '24 21:08 bors

On FreeBSD the evdev headers are not part of the base system, but come from a package named evdev-proto.

<linux/input.h> is also available as <dev/evdev/input.h> (ditto input-event-codes.h and uinput.h). For static platform bindings it may be fine to test against FreeBSD headers which are subset of Linux. This should help unblock progress here by sidestepping #3839.

CC @wulf7 who implemented evdev on FreeBSD and defined evdev-proto policy.

jbeich avatar Oct 23 '24 10:10 jbeich

On FreeBSD the evdev headers are not part of the base system, but come from a package named evdev-proto.

<linux/input.h> is also available as <dev/evdev/input.h> (ditto input-event-codes.h and uinput.h). For static platform bindings it may be fine to test against FreeBSD headers which are subset of Linux. This should help unblock progress here by sidestepping #3839.

CC @wulf7 who implemented evdev on FreeBSD and defined evdev-proto policy.

If this code is FreeBSD-only, you can rely on <dev/evdev/input.h> If some chunks of it are shared with Linux, then <linux/input.h> is preferable to not use extra #ifdef-s in shared sections

wulf7 avatar Oct 27 '24 11:10 wulf7

@tgross35 Can we get this in? The change does not use headers from 3rd-party packages anymore, so #3839 is now unrelated.

arrowd avatar Dec 22 '24 18:12 arrowd

@tgross35 Can we get this in? The change does not use headers from 3rd-party packages anymore, so #3839 is now unrelated.

Thanks for the ping, I didn't realize this was ready (for future reference, @rustbot review updates the labels).

@Awoonyaa one nit above and can you add these to libc-test/semver/freebsd.txt?

Cc @asomers

@rustbot author

tgross35 avatar Dec 22 '24 19:12 tgross35

The definitions look correct to me. Personally I'd be tempted to expose these under an evdev:: module rather than at the crate root. But Linux already exposes them at the crate root, so I guess the horse has already left the barn.

asomers avatar Dec 22 '24 20:12 asomers

The definitions look correct to me. Personally I'd be tempted to expose these under an evdev:: module rather than at the crate root. But Linux already exposes them at the crate root, so I guess the horse has already left the barn.

Thanks for taking a look. I have been thinking that modules mirroring C header paths might be worth doing for 1.0, then only reexporting a common subset for backward compatibility. Especially considering this would make our sources easier to navigate and cross reference to the system headers. But indeed we may as well be consistent here.

tgross35 avatar Dec 22 '24 21:12 tgross35

Hi

On Mon, Dec 23, 2024, 3:56 AM Trevor Gross @.***> wrote:

The definitions look correct to me. Personally I'd be tempted to expose these under an evdev:: module rather than at the crate root. But Linux already exposes them at the crate root, so I guess the horse has already left the barn.

Thanks for taking a look. I have been thinking that modules mirroring C header paths might be worth doing for 1.0, then only reexporting a common subset for backward compatibility. Especially considering this would make our sources easier to navigate and cross reference to the system headers. But indeed we may as well be consistent here.

— Reply to this email directly, view it on GitHub https://github.com/rust-lang/libc/pull/3756#issuecomment-2558616235, or unsubscribe https://github.com/notifications/unsubscribe-auth/BKS2BZKO3EPKO5VPIYUP4SD2G4YPXAVCNFSM6AAAAABJWHGAZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJYGYYTMMRTGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

redwan-islam-rumman avatar Dec 22 '24 21:12 redwan-islam-rumman

Where are you from?

On Mon, Dec 23, 2024, 3:56 AM Akash Khan @.***> wrote:

Hi

On Mon, Dec 23, 2024, 3:56 AM Trevor Gross @.***> wrote:

The definitions look correct to me. Personally I'd be tempted to expose these under an evdev:: module rather than at the crate root. But Linux already exposes them at the crate root, so I guess the horse has already left the barn.

Thanks for taking a look. I have been thinking that modules mirroring C header paths might be worth doing for 1.0, then only reexporting a common subset for backward compatibility. Especially considering this would make our sources easier to navigate and cross reference to the system headers. But indeed we may as well be consistent here.

— Reply to this email directly, view it on GitHub https://github.com/rust-lang/libc/pull/3756#issuecomment-2558616235, or unsubscribe https://github.com/notifications/unsubscribe-auth/BKS2BZKO3EPKO5VPIYUP4SD2G4YPXAVCNFSM6AAAAABJWHGAZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJYGYYTMMRTGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

redwan-islam-rumman avatar Dec 22 '24 21:12 redwan-islam-rumman

Can we get this in, please? Or is it something else we need to fix?

Awoonyaa avatar Feb 11 '25 07:02 Awoonyaa

Can we get this in, please? Or is it something else we need to fix?

I believe this is ready except for https://github.com/rust-lang/libc/pull/3756#discussion_r1895040761

tgross35 avatar Feb 12 '25 19:02 tgross35