Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from obsolete utmp interface to utmpx #213

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

E5ten
Copy link
Contributor

@E5ten E5ten commented May 28, 2020

On linux, utmp isn't obsolete, and utmpx is the same as it, but on pretty much any other system utmp is obsolete and utmpx should be used instead.

@landley
Copy link
Owner

landley commented Apr 1, 2023

Android NDK 25b has utmp.h but not utmpx.h. Switching API would break building these on android.

@enh-google
Copy link
Collaborator

Android NDK 25b has utmp.h but not utmpx.h. Switching API would break building these on android.

yeah, while i'm always skeptical of "obsolete", and even more skeptical of anything being removed, a more persuasive version of this would have been "Switch from legacy utmp interface to POSIX utmpx". and since these are all no-ops on Android anyway, I can actually fix this for you in a header-file-only backwards-compatible way. amusingly, portability.h is already using __has_include() so by adding the header locally, i've already tested toybox that way :-)

https://android-review.googlesource.com/c/platform/bionic/+/2521475

(if you want to make this change, you'll still need a newer NDK, of course. but toybox binaries built by it will run on any existing version of Android.)

pull bot pushed a commit to MaxMood96/platform_bionic that referenced this pull request Apr 6, 2023
Now <utmpx.h> isn't any more useful on Android than <utmp.h> is, but it
is POSIX, and -- importantly -- we can implement it with just a header
file, so code can use it on every existing API level.

macOS does indeed only have the <utmpx.h> functions (although it does
still have the <utmp.h> header!), so potentially portable code might
want <utmpx.h> on Android. (glibc/musl both have both headers.)

Bug: landley/toybox#213
Test: treehugger
Change-Id: Iaa88167708182009a63e2e1a15f11186b251ed02
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this pull request Apr 22, 2024
Now <utmpx.h> isn't any more useful on Android than <utmp.h> is, but it
is POSIX, and -- importantly -- we can implement it with just a header
file, so code can use it on every existing API level.

macOS does indeed only have the <utmpx.h> functions (although it does
still have the <utmp.h> header!), so potentially portable code might
want <utmpx.h> on Android. (glibc/musl both have both headers.)

Bug: landley/toybox#213
Test: treehugger
Change-Id: Iaa88167708182009a63e2e1a15f11186b251ed02
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this pull request Apr 22, 2024
Now <utmpx.h> isn't any more useful on Android than <utmp.h> is, but it
is POSIX, and -- importantly -- we can implement it with just a header
file, so code can use it on every existing API level.

macOS does indeed only have the <utmpx.h> functions (although it does
still have the <utmp.h> header!), so potentially portable code might
want <utmpx.h> on Android. (glibc/musl both have both headers.)

Bug: landley/toybox#213
Test: treehugger
Change-Id: Iaa88167708182009a63e2e1a15f11186b251ed02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants