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

fdprintf() available in stdio.h, but not libc.so #72

Closed
NHellFire opened this issue Apr 7, 2016 · 4 comments
Closed

fdprintf() available in stdio.h, but not libc.so #72

NHellFire opened this issue Apr 7, 2016 · 4 comments

Comments

@NHellFire
Copy link

Same as this issue: https://code.google.com/p/android/issues/detail?id=11197
fdprintf() is missing from libc in the NDK again (since r11).

@DanAlbert
Copy link
Member

Looks like it was dropped in https://android-review.googlesource.com/#/c/194561/

It was made private in bionic because there is no such function. fdprintf is not specified by C, POSIX, nor even a GNU extension.

It looks like we have the POSIX extension dprintf, but afaict that wasn't added until L, so there actually isn't any portable option for you (dprintf work on L and newer, but fdprintf won't work on 64-bit devices).

There aren't any good options for fixing this right now, but this is the kind of thing that will be fixed when we clean up our headers and add the compatibility library (we'll be able to provide an implementation of dprintf even on older devices).

For now, I think the best option is to use fdopen.

@DanAlbert DanAlbert modified the milestones: r13, r14 Aug 9, 2016
@DanAlbert DanAlbert reopened this Nov 15, 2016
@DanAlbert
Copy link
Member

Headers are fixed, but I'm going to leave this open so I remember to make sure dprintf makes it into the compatibility library.

The part of this that can be fixed in r14 is fixed, so I'm re-triaging this.

@DanAlbert DanAlbert modified the milestones: r15, r14 Nov 15, 2016
@DanAlbert DanAlbert modified the milestones: r16, r15 May 5, 2017
@DanAlbert
Copy link
Member

Compatibility library got pushed to r16 because O ate all of r15's time.

hubot pushed a commit to aosp-mirror/platform_bionic that referenced this issue Jul 31, 2017
Old versions of Android called these fdprintf and vfdprintf out of
fears that the glibc names would collide with user debug printfs.

Allow users to just use dprintf and vfdprintf on any version by
renaming those calls to their legacy equivalents if needed.

Test: built trivial NDK module targeting android-14 and using dprintf
Test: make checkbuild
Bug: android/ndk#72
Change-Id: I90de149278f931380418536abaef47c5cee5c195
hubot pushed a commit to aosp-mirror/platform_bionic that referenced this issue Aug 3, 2017
The ordering of __attribute__ and __asm__ matters for GCC.

Test: `#include <stdio.h>` with gcc
Bug: android/ndk#72
Change-Id: I20bcd7cac2f96d220746e389f0ca467dc95c37c2
@DanAlbert
Copy link
Member

Fix ended up not needing to be added to the compatibility library. dprintf and vdprintf should work regardless of target API in r16.

sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
Old versions of Android called these fdprintf and vfdprintf out of
fears that the glibc names would collide with user debug printfs.

Allow users to just use dprintf and vfdprintf on any version by
renaming those calls to their legacy equivalents if needed.

Test: built trivial NDK module targeting android-14 and using dprintf
Test: make checkbuild
Bug: android/ndk#72
Change-Id: I90de149278f931380418536abaef47c5cee5c195
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
Old versions of Android called these fdprintf and vfdprintf out of
fears that the glibc names would collide with user debug printfs.

Allow users to just use dprintf and vfdprintf on any version by
renaming those calls to their legacy equivalents if needed.

Test: built trivial NDK module targeting android-14 and using dprintf
Test: make checkbuild
Bug: android/ndk#72
Change-Id: I90de149278f931380418536abaef47c5cee5c195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants