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

Supporting Android platform? #148

Closed
tiann opened this issue Sep 28, 2021 · 4 comments
Closed

Supporting Android platform? #148

tiann opened this issue Sep 28, 2021 · 4 comments
Milestone

Comments

@tiann
Copy link

tiann commented Sep 28, 2021

I run the demo code in Android plaform:

fn main() {
    let me = procfs::process::Process::myself().unwrap();
    println!("PID: {}", me.pid);
}

and the error occurs:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PermissionDenied(Some("/proc/sys/kernel/osrelease"))', /Users/weishu/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b/procfs-0.10.1/src/lib.rs:303:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Normal app in Android have no permission to read /proc/sys/kernel/osrelease, (it is forbidden by SELinux), how can i fix this?

@eminence
Copy link
Owner

Hi, thanks for the report.

This is unfortunately a bug: #138

I'm a little surprised to see this panic while calling Process::myself() (so seeing the full stack trace would be helpful), but this is a procfs bug that still must be fixed

@tiann
Copy link
Author

tiann commented Sep 30, 2021

It seems that backtrace is not working well on Android ?

101|ginkgo:/data/local/tmp $ RUST_BACKTRACE=full ./abcd
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PermissionDenied(Some("/proc/sys/kernel/osrelease"))', /Users/weishu/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b/procfs-0.10.1/src/lib.rs:303:34
stack backtrace:
   0:       0x59d42c5600 - <unknown>
   1:       0x59d42db818 - <unknown>
   2:       0x59d42c37ec - <unknown>
   3:       0x59d42c6e50 - <unknown>
   4:       0x59d42c699c - <unknown>
   5:       0x59d42c75d4 - <unknown>
   6:       0x59d42c7100 - <unknown>
   7:       0x59d42c5a84 - <unknown>
   8:       0x59d42c7068 - <unknown>
   9:       0x59d42daa64 - <unknown>
  10:       0x59d42dabe8 - <unknown>
  11:       0x59d42ad04c - <unknown>
  12:       0x59d42a59b0 - <unknown>
  13:       0x59d42aeed8 - <unknown>
  14:       0x59d42af410 - <unknown>
  15:       0x59d42c532c - <unknown>
  16:       0x59d42af3a0 - <unknown>
  17:       0x59d42a34c4 - <unknown>
  18:       0x59d42aa338 - <unknown>
  19:       0x59d42adcf0 - <unknown>
  20:       0x59d42ae024 - <unknown>
  21:       0x59d42a0b00 - <unknown>
  22:       0x59d42a08e4 - <unknown>
  23:       0x59d42a0ac4 - <unknown>
  24:       0x59d42a09b4 - <unknown>
  25:       0x59d42c78dc - <unknown>
  26:       0x59d42a0980 - <unknown>
  27:       0x59d42a0be8 - <unknown>
  28:       0x79f69cb97c - <unknown>
  29:                0x0 - <unknown>

@eminence
Copy link
Owner

Hello, the latest v0.11.0 release should fix this. Please try it out and let me know if you still have problems. Thanks again for the bug report.

@tiann
Copy link
Author

tiann commented Oct 15, 2021

0.11.0 works well, thanks for your great work!

@eminence eminence added this to the v0.11.0 milestone Nov 26, 2021
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

No branches or pull requests

2 participants