Coder Social home page Coder Social logo

Comments (11)

Lastique avatar Lastique commented on August 15, 2024

On 09/29/16 23:52, Nathan Toone wrote:

Version 1.62.0 will not compile on android due to the fact that the
android bionic runtime does not have a |getsid| function. This is
referenced at
https://github.com/boostorg/log/blob/boost-1.62.0/src/posix/object_name.cpp#L71

I am willing to work up a PR and submit it - but am wondering what the
best approach to do for android would be. Should I |#ifndef| just the
|format_id| call there - and use something else instead of |getsid|? Or
should I |#ifndef| the access to |object_name::session| altogether so
that scope isn't even available? Or is there some other approach that
would be better (I don't believe there is an alternative to |getsid| on
android - you just aren't allowed to access it at all).

I don't know Android well enough to pick the correct solution. Ideally,
getsid should be replaced with some other API on that platform having
a similar effect. I know at least some Android versions support multiple
user logins - there must be a way to discern one session from the other.
If not, then we can only pretend there is only one session system-wide
and all processes are its members.

PS: A quick search shows that there is the __NR_getsid syscall1. I
suspect, it's the libc wrapper that is missing on some SDK versions.
Which one are you using?

from log.

toonetown avatar toonetown commented on August 15, 2024

PS: A quick search shows that there is the __NR_getsid syscall1. I
suspect, it's the libc wrapper that is missing on some SDK versions.
Which one are you using?

1:
https://android.googlesource.com/platform/bionic/+/1ad10a5/libc/arch-x86/syscalls/getsid.S

And I don't know enough about syscalls to know if that will work or not. All I know is that the header explicitly mentions some functions that are disabled in bionic1. The version I am using is android-15, but a quick grep through the android headers seems to show the same functions disabled in all the other versions as well.

I don't know what alternate function would be useful either...what with not being super familiar with getsid in the first place.

What about writing an inline function that just returns -1, like described in the man page2?

from log.

Lastique avatar Lastique commented on August 15, 2024

On 09/30/16 00:19, Nathan Toone wrote:

PS: A quick search shows that there is the __NR_getsid syscall[1]. I
suspect, it's the libc wrapper that is missing on some SDK versions.
Which one are you using?

[1]:

https://android.googlesource.com/platform/bionic/+/1ad10a5/libc/arch-x86/syscalls/getsid.S

And I don't know enough about syscalls to know if that will work or not.
All I know is that the header explicitly mentions some functions that
are disabled in bionic[1]. The version I am using is android-15, but a
quick grep through the android headers seems to show the same
functions disabled in all the other versions as well.

I've committed a workaround (93a063c) but I can't test it. Could you try
it on your setup?

from log.

toonetown avatar toonetown commented on August 15, 2024

Getting there...now the same thing is happening with getpwuid_r (it appears in the headers in android API 21 as well, but is commented out prior to that version).

Maybe I'll just build against android-21. 😄

from log.

toonetown avatar toonetown commented on August 15, 2024

It will build against android-21 - however, it would be good to support a few versions back than that.

getpwuid_r doesn't exist as a syscall either...

from log.

Lastique avatar Lastique commented on August 15, 2024

On 09/30/16 01:55, Nathan Toone wrote:

It will build against android-21 - however, it would be good to support
a few versions back than that.

|getpwuid_r| doesn't exist as a syscall either...

Yes, getpwuid_r is not that easy to work around. There is getpwuid,
but it's not thread-safe, at least not according to POSIX. I don't know
how safe it is on Android.

from log.

toonetown avatar toonetown commented on August 15, 2024

for getpwuid_r, couldn't we add a #define BOOST_LOG_ANDROID_SINGLE_USER in the block you just added, and then only do getpwuid_r when not defined (falling back to only running the else block at https://github.com/boostorg/log/blob/develop/src/posix/object_name.cpp#L105 when BOOST_LOG_ANDROID_SINGLE_USER is defined)?

from log.

toonetown avatar toonetown commented on August 15, 2024

An example patch which actually will compile and appears to work can be found at toonetown@4d41ff0

from log.

Lastique avatar Lastique commented on August 15, 2024

On 09/30/16 01:59, Andrey Semashev wrote:

On 09/30/16 01:55, Nathan Toone wrote:

It will build against android-21 - however, it would be good to support
a few versions back than that.

|getpwuid_r| doesn't exist as a syscall either...

Yes, getpwuid_r is not that easy to work around. There is getpwuid,
but it's not thread-safe, at least not according to POSIX. I don't know
how safe it is on Android.

I've added another workaround in (d13e6cb). Please, try if it helps.

from log.

Lastique avatar Lastique commented on August 15, 2024

On 09/30/16 02:11, Nathan Toone wrote:

An example patch which actually will compile and appears to work can be
found at toonetown/boostorg-log@4d41ff0
toonetown@4d41ff0

Yes, that's basically what I did as well.

from log.

toonetown avatar toonetown commented on August 15, 2024

Yes - your fix appears to work now. Thanks! Sorry I wasn't more help... 😉

from log.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.