getpwnam() function implementation ?

10,568 views
Skip to first unread message

Uma Sankar

unread,
Jun 17, 2010, 7:13:17 AM6/17/10
to android-ndk
Hi All,

I am cross compiling a sample program which reads the password file
entry by using getpwnam() function. This program is failing on Android
emulator as Android does not have /etc/passwd file. The same program
is able to run successful on X86.

My question is where is passwd file is present for Android in
different path? or there is no meaning of passwd file for Android as
it does not support multiple users?

Thanks

Onur Cinar

unread,
Jun 17, 2010, 2:43:37 PM6/17/10
to android-ndk

Hi Uma,

Actually there is a stub for mapping the android_id to passwd
structure. Although there is no physical /etc/passed, the stub should
populate the values. What is the username going to getpwnam function
call?

If you want to take a look at the stubs, here is the bionic file:
http://android.git.kernel.org/?p=platform/bionic.git;a=blob;f=libc/bionic/stubs.c;h=365f21a2ac93866095e4ed8b4b8aea10c5ff59a5;hb=HEAD

Regards,

-onur
---
www.zdo.com

Uma Sankar

unread,
Jun 18, 2010, 2:15:55 AM6/18/10
to android-ndk
Thanks Onur for your information.

When I try to pass the "nobody" or "root" as login name its returning
some values.
But when I pass "bin" as login name its failing by giving error like
"No such file or directory".
It seems "bin" user is not present. Is there any place can we find the
list of logins in Android?

Thanks

On Jun 17, 11:43 pm, Onur Cinar <onur.ci...@gmail.com> wrote:
> Hi Uma,
>
> Actually there is a stub for mapping the android_id to passwd
> structure. Although there is no physical /etc/passed, the stub should
> populate the values. What is the username going to getpwnam function
> call?
>
> If you want to take a look at the stubs, here is the bionic file:http://android.git.kernel.org/?p=platform/bionic.git;a=blob;f=libc/bi...

Angus Lees

unread,
Jun 18, 2010, 9:26:44 AM6/18/10
to andro...@googlegroups.com
system/core/include/private/android_filesystem_config.h:

 - Gus


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


Uma Sankar

unread,
Jun 18, 2010, 2:00:57 PM6/18/10
to android-ndk
Thanks Gus for your information.

On Jun 18, 6:26 pm, Angus Lees <al...@google.com> wrote:
> system/core/include/private/android_filesystem_config.h:http://android.git.kernel.org/?p=platform/system/core.git;a=blob;f=in...
>
>  - Gus
> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>
> > .
Reply all
Reply to author
Forward
0 new messages