我想在 Android 中列出 "/proc" 下的文件和目录。作为我的应用进程运行时,很多文件不可读。
如果我将目录列为 shell 用户,我会得到以下输出:
shell@flounder:/ $ whoami
shell
shell@flounder:/ $ /system/bin/toolbox ls -l /proc
dr-xr-xr-x root root 2015-09-12 03:30 1
dr-xr-xr-x root root 2015-09-12 03:31 10
dr-xr-xr-x root root 2015-09-12 03:31 101
dr-xr-xr-x shell shell 2015-09-15 03:24 10196
dr-xr-xr-x root root 2015-09-12 03:31 102
dr-xr-xr-x root root 2015-09-12 03:31 103
dr-xr-xr-x root root 2015-09-12 03:31 104
dr-xr-xr-x u0_a15 u0_a15 2015-09-14 07:37 10451
dr-xr-xr-x root root 2015-09-12 03:31 105
dr-xr-xr-x wifi wifi 2015-09-14 08:53 10570
dr-xr-xr-x root root 2015-09-12 03:31 106
dr-xr-xr-x root root 2015-09-12 03:31 107
dr-xr-xr-x root root 2015-09-12 03:31 108
dr-xr-xr-x root root 2015-09-12 03:31 11
dr-xr-xr-x root root 2015-09-12 03:31 110
dr-xr-xr-x root root 2015-09-12 03:31 111
dr-xr-xr-x root root 2015-09-12 03:31 112
dr-xr-xr-x root root 2015-09-12 03:31 113
dr-xr-xr-x root root 2015-09-12 03:31 114
dr-xr-xr-x root root 2015-09-12 03:31 115
dr-xr-xr-x root root 2015-09-12 03:31 116
dr-xr-xr-x root root 2015-09-12 03:31 117
dr-xr-xr-x root root 2015-09-12 03:31 118
dr-xr-xr-x root root 2015-09-12 03:31 119
dr-xr-xr-x u0_a26 u0_a26 2015-09-12 03:31 1193
dr-xr-xr-x root root 2015-09-12 03:31 12
dr-xr-xr-x root root 2015-09-12 03:31 120
dr-xr-xr-x u0_a57 u0_a57 2015-09-12 03:31 1209
dr-xr-xr-x root root 2015-09-12 03:31 121
dr-xr-xr-x root root 2015-09-12 03:31 122
dr-xr-xr-x nfc nfc 2015-09-12 03:31 1227
dr-xr-xr-x root root 2015-09-12 03:31 123
dr-xr-xr-x radio radio 2015-09-12 03:31 1239
dr-xr-xr-x root root 2015-09-12 03:31 124
dr-xr-xr-x u0_a26 u0_a26 2015-09-12 03:31 1246
dr-xr-xr-x root root 2015-09-12 03:31 125
dr-xr-xr-x root root 2015-09-12 03:31 126
dr-xr-xr-x root root 2015-09-12 03:31 127
dr-xr-xr-x root root 2015-09-12 03:30 128
dr-xr-xr-x root root 2015-09-12 03:31 13
dr-xr-xr-x u0_a26 u0_a26 2015-09-12 03:31 1305
dr-xr-xr-x root root 2015-09-12 03:30 132
dr-xr-xr-x root root 2015-09-12 03:31 134
dr-xr-xr-x u0_a86 u0_a86 2015-09-14 07:16 1343
dr-xr-xr-x root root 2015-09-12 03:31 135
dr-xr-xr-x root root 2015-09-12 03:31 136
dr-xr-xr-x root root 2015-09-12 03:31 137
dr-xr-xr-x root root 2015-09-12 03:31 138
dr-xr-xr-x root root 2015-09-12 03:31 139
dr-xr-xr-x root root 2015-09-12 03:31 14
dr-xr-xr-x root root 2015-09-12 03:31 140
dr-xr-xr-x root root 2015-09-12 03:31 141
dr-xr-xr-x root root 2015-09-12 03:31 142
dr-xr-xr-x root root 2015-09-12 03:31 143
dr-xr-xr-x root root 2015-09-12 03:31 144
dr-xr-xr-x root root 2015-09-12 03:31 145
dr-xr-xr-x root root 2015-09-12 03:31 149
dr-xr-xr-x root root 2015-09-12 03:31 150
dr-xr-xr-x logd logd 2015-09-12 03:30 153
dr-xr-xr-x root root 2015-09-12 03:30 155
dr-xr-xr-x root root 2015-09-12 03:31 16
dr-xr-xr-x root root 2015-09-12 03:31 160
dr-xr-xr-x root root 2015-09-12 03:30 163
dr-xr-xr-x root root 2015-09-12 03:30 164
dr-xr-xr-x system system 2015-09-12 03:30 165
dr-xr-xr-x u0_a9 u0_a9 2015-09-12 03:31 1652
dr-xr-xr-x system graphics 2015-09-12 03:30 166
dr-xr-xr-x root root 2015-09-12 03:31 17
dr-xr-xr-x system system 2015-09-14 05:30 18227
dr-xr-xr-x root root 2015-09-12 03:31 188
dr-xr-xr-x root root 2015-09-12 03:31 192
dr-xr-xr-x root root 2015-09-12 03:31 193
dr-xr-xr-x root root 2015-09-12 03:31 194
dr-xr-xr-x root root 2015-09-12 03:31 195
dr-xr-xr-x root root 2015-09-12 03:31 2
dr-xr-xr-x root root 2015-09-12 03:31 20
dr-xr-xr-x u0_a19 u0_a19 2015-09-14 05:36 20564
dr-xr-xr-x root root 2015-09-12 03:31 207
dr-xr-xr-x u0_a45 u0_a45 2015-09-15 03:00 20763
dr-xr-xr-x root root 2015-09-12 03:31 208
dr-xr-xr-x root root 2015-09-12 03:31 21
dr-xr-xr-x shell shell 2015-09-12 03:31 210
dr-xr-xr-x root root 2015-09-12 03:31 215
dr-xr-xr-x root root 2015-09-12 03:31 216
dr-xr-xr-x root root 2015-09-12 03:31 217
dr-xr-xr-x drm drm 2015-09-12 03:31 218
dr-xr-xr-x media audio 2015-09-12 03:31 219
dr-xr-xr-x root root 2015-09-12 03:31 22
dr-xr-xr-x root root 2015-09-12 03:31 220
dr-xr-xr-x keystore keystore 2015-09-12 03:31 222
dr-xr-xr-x system system 2015-09-12 03:31 223
dr-xr-xr-x root root 2015-09-12 03:31 224
dr-xr-xr-x root root 2015-09-12 03:31 225
dr-xr-xr-x shell shell 2015-09-15 03:15 2258
dr-xr-xr-x system root 2015-09-12 03:31 226
dr-xr-xr-x gps system 2015-09-12 03:31 227
dr-xr-xr-x u0_a67 u0_a67 2015-09-15 03:15 2270
dr-xr-xr-x root root 2015-09-12 03:31 23
dr-xr-xr-x root root 2015-09-12 03:31 24
dr-xr-xr-x root root 2015-09-12 03:31 2428
dr-xr-xr-x root root 2015-09-15 03:05 24353
dr-xr-xr-x root root 2015-09-12 03:31 25
dr-xr-xr-x root root 2015-09-15 03:11 25597
dr-xr-xr-x root root 2015-09-12 03:31 26
dr-xr-xr-x root root 2015-09-15 03:11 26671
dr-xr-xr-x root root 2015-09-12 03:31 27
dr-xr-xr-x u0_a84 u0_a84 2015-09-15 03:15 2738
dr-xr-xr-x root root 2015-09-12 03:31 28
dr-xr-xr-x root root 2015-09-12 03:31 29
dr-xr-xr-x root root 2015-09-15 03:11 29355
dr-xr-xr-x root root 2015-09-15 03:16 2958
dr-xr-xr-x root root 2015-09-12 03:31 3
dr-xr-xr-x root root 2015-09-12 03:31 30
dr-xr-xr-x u0_a5 u0_a5 2015-09-15 03:10 30095
dr-xr-xr-x u0_a18 u0_a18 2015-09-15 03:11 30266
dr-xr-xr-x u0_a40 u0_a40 2015-09-15 03:11 30290
dr-xr-xr-x system system 2015-09-15 03:11 30333
dr-xr-xr-x u0_a37 u0_a37 2015-09-15 03:11 30382
dr-xr-xr-x u0_a77 u0_a77 2015-09-15 03:11 30420
dr-xr-xr-x u0_a61 u0_a61 2015-09-15 03:11 30458
dr-xr-xr-x root root 2015-09-14 09:56 30729
dr-xr-xr-x u0_a4 u0_a4 2015-09-14 11:12 30994
dr-xr-xr-x root root 2015-09-12 03:31 31
dr-xr-xr-x u0_a9 u0_a9 2015-09-14 13:31 31453
dr-xr-xr-x shell shell 2015-09-15 03:12 31844
dr-xr-xr-x root root 2015-09-12 03:31 32
dr-xr-xr-x u0_a6 u0_a6 2015-09-15 01:13 32176
dr-xr-xr-x root root 2015-09-15 02:34 32422
dr-xr-xr-x root root 2015-09-15 03:13 32476
dr-xr-xr-x shell shell 2015-09-15 02:39 32552
dr-xr-xr-x root root 2015-09-12 03:31 33
dr-xr-xr-x root root 2015-09-12 03:31 47
dr-xr-xr-x root root 2015-09-12 03:31 48
dr-xr-xr-x root root 2015-09-12 03:31 49
dr-xr-xr-x root root 2015-09-12 03:31 5
dr-xr-xr-x root root 2015-09-12 03:31 50
dr-xr-xr-x system system 2015-09-12 03:31 590
dr-xr-xr-x root root 2015-09-12 03:31 64
dr-xr-xr-x root root 2015-09-12 03:31 65
dr-xr-xr-x root root 2015-09-12 03:31 66
dr-xr-xr-x media_rw media_rw 2015-09-12 03:31 666
dr-xr-xr-x root root 2015-09-12 03:31 67
dr-xr-xr-x root root 2015-09-12 03:31 68
dr-xr-xr-x root root 2015-09-12 03:31 69
dr-xr-xr-x u0_a24 u0_a24 2015-09-12 03:31 694
dr-xr-xr-x root root 2015-09-12 03:31 7
dr-xr-xr-x root root 2015-09-12 03:31 70
dr-xr-xr-x root root 2015-09-12 03:31 71
dr-xr-xr-x u0_a88 u0_a88 2015-09-14 06:14 7104
dr-xr-xr-x root root 2015-09-12 03:31 72
dr-xr-xr-x u0_a88 u0_a88 2015-09-14 06:15 7217
dr-xr-xr-x root root 2015-09-15 03:21 7221
dr-xr-xr-x root root 2015-09-12 03:31 73
dr-xr-xr-x root root 2015-09-12 03:31 74
dr-xr-xr-x root root 2015-09-15 03:21 7487
dr-xr-xr-x root root 2015-09-12 03:31 75
dr-xr-xr-x root root 2015-09-12 03:31 76
dr-xr-xr-x root root 2015-09-12 03:31 77
dr-xr-xr-x root root 2015-09-12 03:31 78
dr-xr-xr-x root root 2015-09-12 03:31 79
dr-xr-xr-x root root 2015-09-12 03:31 8
dr-xr-xr-x root root 2015-09-12 03:31 81
dr-xr-xr-x root root 2015-09-12 03:31 82
dr-xr-xr-x u0_a14 u0_a14 2015-09-15 02:45 8250
dr-xr-xr-x root root 2015-09-12 03:31 83
dr-xr-xr-x root root 2015-09-12 03:31 84
dr-xr-xr-x root root 2015-09-12 03:31 85
dr-xr-xr-x u0_a53 u0_a53 2015-09-13 11:39 8517
dr-xr-xr-x root root 2015-09-12 03:31 87
dr-xr-xr-x root root 2015-09-12 03:31 88
dr-xr-xr-x root root 2015-09-12 03:31 89
dr-xr-xr-x root root 2015-09-12 03:31 9
dr-xr-xr-x root root 2015-09-12 03:31 90
dr-xr-xr-x u0_a9 u0_a9 2015-09-12 03:31 903
dr-xr-xr-x root root 2015-09-12 03:31 91
dr-xr-xr-x u0_a9 u0_a9 2015-09-13 11:45 9159
dr-xr-xr-x root root 2015-09-12 03:31 93
dr-xr-xr-x u0_a66 u0_a66 2015-09-14 08:52 9356
dr-xr-xr-x root root 2015-09-12 03:31 94
dr-xr-xr-x root root 2015-09-12 03:31 95
dr-xr-xr-x root root 2015-09-12 03:31 97
dr-xr-xr-x root root 2015-09-12 03:31 98
dr-xr-xr-x root root 2015-09-12 03:31 99
dr-xr-xr-x root root 2015-09-15 03:24 asound
dr-xr-xr-x root root 2015-09-15 03:24 bluetooth
-r--r--r-- root root 0 2015-09-15 03:24 buddyinfo
dr-xr-xr-x root root 2015-09-15 03:24 bus
-r--r--r-- root root 0 2015-09-15 03:24 cgroups
-r--r----- root radio 0 2015-09-15 03:24 cmdline
-r--r--r-- root root 0 2015-09-15 03:24 consoles
-r--r--r-- root root 0 2015-09-15 03:24 cpuinfo
-r--r--r-- root root 0 2015-09-15 03:24 crypto
dr-xr-xr-x root root 2015-09-15 03:24 device-tree
-r--r--r-- root root 0 2015-09-15 03:24 devices
-r--r--r-- root root 0 2015-09-15 03:24 diskstats
dr-xr-xr-x root root 2015-09-15 03:24 driver
-r--r--r-- root root 0 2015-09-15 03:24 execdomains
-r--r--r-- root root 0 2015-09-15 03:24 fb
-r--r--r-- root root 0 2015-09-15 03:24 filesystems
dr-xr-xr-x root root 2015-09-15 03:24 fs
-r--r--r-- root root 0 2015-09-15 03:24 interrupts
-r--r--r-- root root 0 2015-09-15 03:24 iomem
-r--r--r-- root root 0 2015-09-15 03:24 ioports
dr-xr-xr-x root root 2015-09-15 03:24 irq
-r--r--r-- root root 0 2015-09-15 03:24 kallsyms
-r--r----- root system 0 2015-09-12 03:30 kmsg
-r-------- root root 0 2015-09-15 03:24 kpagecount
-r-------- root root 0 2015-09-15 03:24 kpageflags
-r--r--r-- root root 0 2015-09-15 03:24 loadavg
-r--r--r-- root root 0 2015-09-15 03:24 locks
-r--r--r-- root root 0 2015-09-15 03:24 meminfo
-r--r--r-- root root 0 2015-09-15 03:24 misc
lrwxrwxrwx root root 2015-09-15 03:24 mounts -> self/mounts
lrwxrwxrwx root root 2015-09-15 03:24 net -> self/net
-r--r--r-- root root 0 2015-09-15 03:24 pagetypeinfo
-r--r--r-- root root 0 2015-09-15 03:24 partitions
dr-xr-xr-x root root 2015-09-15 03:24 quadd
-r--r--r-- root root 0 2015-09-15 03:24 sched_debug
-r--r--r-- root root 0 2015-09-15 03:24 schedstat
dr-xr-xr-x root root 2015-09-15 03:24 scsi
lrwxrwxrwx root root 1969-12-31 16:00 self -> 10196
-r--r----- root log 0 2015-09-15 03:24 slabinfo
-r--r--r-- root root 0 2015-09-15 03:24 softirqs
-r--r--r-- root root 0 2015-09-15 03:24 stat
-r--r--r-- root root 0 2015-09-15 03:24 swaps
dr-xr-xr-x root root 2015-09-14 06:13 sys
lstat '/proc/sysrq-trigger' failed: Permission denied
dr-xr-xr-x root root 2015-09-15 03:24 sysvipc
-r--r--r-- root root 0 2015-09-15 03:24 timer_list
-rw-r--r-- root root 0 2015-09-15 03:24 timer_stats
dr-xr-xr-x root root 2015-09-15 03:24 tty
dr-xr-xr-x root root 2015-09-15 03:24 uid_cputime
dr-xr-xr-x root root 2015-09-15 03:24 uid_stat
-r--r--r-- root root 0 2015-09-15 03:24 uptime
-r--r--r-- root root 0 2015-09-15 03:24 version
-r--r----- root log 0 2015-09-15 03:24 vmallocinfo
-r--r--r-- root root 0 2015-09-15 03:24 vmstat
-r--r--r-- root root 0 2015-09-15 03:24 zoneinfo
如果我将目录列为我的应用进程(使用 run-as [PACKAGE_NAME]):
shell@flounder:/ $ run-as my.packagename
shell@flounder:/data/data/my.packagename $ whoami
u0_a84
shell@flounder:/data/data/my.packagename $ /system/bin/toolbox ls -l /proc
lstat '/proc/1' failed: Permission denied
lstat '/proc/10' failed: Permission denied
lstat '/proc/101' failed: Permission denied
lstat '/proc/102' failed: Permission denied
lstat '/proc/103' failed: Permission denied
lstat '/proc/104' failed: Permission denied
dr-xr-xr-x u0_a15 u0_a15 2015-09-14 07:37 10451
lstat '/proc/105' failed: Permission denied
lstat '/proc/10570' failed: Permission denied
lstat '/proc/106' failed: Permission denied
lstat '/proc/107' failed: Permission denied
lstat '/proc/108' failed: Permission denied
lstat '/proc/11' failed: Permission denied
lstat '/proc/110' failed: Permission denied
lstat '/proc/111' failed: Permission denied
lstat '/proc/112' failed: Permission denied
lstat '/proc/113' failed: Permission denied
lstat '/proc/114' failed: Permission denied
lstat '/proc/115' failed: Permission denied
dr-xr-xr-x u0_a84 u0_a84 2015-09-15 03:26 11513
lstat '/proc/116' failed: Permission denied
lstat '/proc/117' failed: Permission denied
lstat '/proc/11719' failed: Permission denied
lstat '/proc/118' failed: Permission denied
lstat '/proc/119' failed: Permission denied
dr-xr-xr-x u0_a26 u0_a26 2015-09-12 03:31 1193
lstat '/proc/12' failed: Permission denied
lstat '/proc/120' failed: Permission denied
dr-xr-xr-x u0_a57 u0_a57 2015-09-12 03:31 1209
lstat '/proc/121' failed: Permission denied
lstat '/proc/122' failed: Permission denied
lstat '/proc/1227' failed: Permission denied
lstat '/proc/123' failed: Permission denied
lstat '/proc/1239' failed: Permission denied
lstat '/proc/124' failed: Permission denied
dr-xr-xr-x u0_a26 u0_a26 2015-09-12 03:31 1246
lstat '/proc/125' failed: Permission denied
lstat '/proc/126' failed: Permission denied
lstat '/proc/12696' failed: Permission denied
lstat '/proc/127' failed: Permission denied
lstat '/proc/128' failed: Permission denied
lstat '/proc/13' failed: Permission denied
dr-xr-xr-x u0_a26 u0_a26 2015-09-12 03:31 1305
lstat '/proc/132' failed: Permission denied
lstat '/proc/134' failed: Permission denied
dr-xr-xr-x u0_a86 u0_a86 2015-09-14 07:16 1343
lstat '/proc/135' failed: Permission denied
lstat '/proc/136' failed: Permission denied
lstat '/proc/137' failed: Permission denied
lstat '/proc/138' failed: Permission denied
lstat '/proc/139' failed: Permission denied
lstat '/proc/14' failed: Permission denied
lstat '/proc/140' failed: Permission denied
dr-xr-xr-x u0_a84 u0_a84 2015-09-15 03:29 14005
lstat '/proc/141' failed: Permission denied
lstat '/proc/142' failed: Permission denied
lstat '/proc/143' failed: Permission denied
lstat '/proc/144' failed: Permission denied
lstat '/proc/145' failed: Permission denied
lstat '/proc/149' failed: Permission denied
lstat '/proc/150' failed: Permission denied
lstat '/proc/153' failed: Permission denied
lstat '/proc/155' failed: Permission denied
lstat '/proc/16' failed: Permission denied
lstat '/proc/160' failed: Permission denied
lstat '/proc/163' failed: Permission denied
lstat '/proc/164' failed: Permission denied
lstat '/proc/165' failed: Permission denied
dr-xr-xr-x u0_a9 u0_a9 2015-09-12 03:31 1652
lstat '/proc/166' failed: Permission denied
lstat '/proc/17' failed: Permission denied
lstat '/proc/18227' failed: Permission denied
lstat '/proc/188' failed: Permission denied
lstat '/proc/192' failed: Permission denied
lstat '/proc/193' failed: Permission denied
lstat '/proc/194' failed: Permission denied
lstat '/proc/195' failed: Permission denied
lstat '/proc/2' failed: Permission denied
lstat '/proc/20' failed: Permission denied
dr-xr-xr-x u0_a19 u0_a19 2015-09-14 05:36 20564
lstat '/proc/207' failed: Permission denied
dr-xr-xr-x u0_a45 u0_a45 2015-09-15 03:00 20763
lstat '/proc/208' failed: Permission denied
lstat '/proc/21' failed: Permission denied
lstat '/proc/210' failed: Permission denied
lstat '/proc/215' failed: Permission denied
lstat '/proc/216' failed: Permission denied
lstat '/proc/217' failed: Permission denied
lstat '/proc/218' failed: Permission denied
lstat '/proc/219' failed: Permission denied
lstat '/proc/22' failed: Permission denied
lstat '/proc/220' failed: Permission denied
lstat '/proc/222' failed: Permission denied
lstat '/proc/223' failed: Permission denied
lstat '/proc/224' failed: Permission denied
lstat '/proc/225' failed: Permission denied
lstat '/proc/2258' failed: Permission denied
lstat '/proc/226' failed: Permission denied
lstat '/proc/227' failed: Permission denied
dr-xr-xr-x u0_a67 u0_a67 2015-09-15 03:15 2270
lstat '/proc/23' failed: Permission denied
lstat '/proc/24' failed: Permission denied
lstat '/proc/2428' failed: Permission denied
lstat '/proc/24353' failed: Permission denied
lstat '/proc/25' failed: Permission denied
lstat '/proc/25597' failed: Permission denied
lstat '/proc/26' failed: Permission denied
lstat '/proc/26671' failed: Permission denied
lstat '/proc/27' failed: Permission denied
dr-xr-xr-x u0_a84 u0_a84 2015-09-15 03:15 2738
lstat '/proc/28' failed: Permission denied
lstat '/proc/29' failed: Permission denied
lstat '/proc/3' failed: Permission denied
lstat '/proc/30' failed: Permission denied
lstat '/proc/30095' failed: Permission denied
dr-xr-xr-x u0_a18 u0_a18 2015-09-15 03:11 30266
dr-xr-xr-x u0_a40 u0_a40 2015-09-15 03:11 30290
lstat '/proc/30333' failed: Permission denied
dr-xr-xr-x u0_a37 u0_a37 2015-09-15 03:11 30382
dr-xr-xr-x u0_a77 u0_a77 2015-09-15 03:11 30420
dr-xr-xr-x u0_a61 u0_a61 2015-09-15 03:11 30458
lstat '/proc/30729' failed: Permission denied
dr-xr-xr-x u0_a4 u0_a4 2015-09-14 11:12 30994
lstat '/proc/31' failed: Permission denied
dr-xr-xr-x u0_a9 u0_a9 2015-09-14 13:31 31453
lstat '/proc/31844' failed: Permission denied
lstat '/proc/32' failed: Permission denied
dr-xr-xr-x u0_a6 u0_a6 2015-09-15 01:13 32176
lstat '/proc/32422' failed: Permission denied
lstat '/proc/32476' failed: Permission denied
lstat '/proc/32552' failed: Permission denied
lstat '/proc/33' failed: Permission denied
lstat '/proc/47' failed: Permission denied
lstat '/proc/48' failed: Permission denied
lstat '/proc/49' failed: Permission denied
lstat '/proc/5' failed: Permission denied
lstat '/proc/50' failed: Permission denied
lstat '/proc/590' failed: Permission denied
lstat '/proc/64' failed: Permission denied
lstat '/proc/65' failed: Permission denied
lstat '/proc/66' failed: Permission denied
lstat '/proc/666' failed: Permission denied
lstat '/proc/67' failed: Permission denied
lstat '/proc/68' failed: Permission denied
lstat '/proc/69' failed: Permission denied
lstat '/proc/694' failed: Permission denied
lstat '/proc/7' failed: Permission denied
lstat '/proc/70' failed: Permission denied
lstat '/proc/71' failed: Permission denied
dr-xr-xr-x u0_a88 u0_a88 2015-09-14 06:14 7104
lstat '/proc/72' failed: Permission denied
dr-xr-xr-x u0_a88 u0_a88 2015-09-14 06:15 7217
lstat '/proc/7221' failed: Permission denied
lstat '/proc/73' failed: Permission denied
lstat '/proc/74' failed: Permission denied
lstat '/proc/7487' failed: Permission denied
lstat '/proc/75' failed: Permission denied
lstat '/proc/76' failed: Permission denied
lstat '/proc/77' failed: Permission denied
lstat '/proc/78' failed: Permission denied
lstat '/proc/79' failed: Permission denied
lstat '/proc/8' failed: Permission denied
lstat '/proc/81' failed: Permission denied
lstat '/proc/82' failed: Permission denied
dr-xr-xr-x u0_a14 u0_a14 2015-09-15 02:45 8250
lstat '/proc/83' failed: Permission denied
lstat '/proc/84' failed: Permission denied
lstat '/proc/85' failed: Permission denied
dr-xr-xr-x u0_a53 u0_a53 2015-09-13 11:39 8517
lstat '/proc/87' failed: Permission denied
lstat '/proc/88' failed: Permission denied
lstat '/proc/89' failed: Permission denied
lstat '/proc/9' failed: Permission denied
lstat '/proc/90' failed: Permission denied
dr-xr-xr-x u0_a9 u0_a9 2015-09-12 03:31 903
lstat '/proc/91' failed: Permission denied
dr-xr-xr-x u0_a9 u0_a9 2015-09-13 11:45 9159
lstat '/proc/93' failed: Permission denied
dr-xr-xr-x u0_a66 u0_a66 2015-09-14 08:52 9356
lstat '/proc/94' failed: Permission denied
lstat '/proc/95' failed: Permission denied
lstat '/proc/97' failed: Permission denied
lstat '/proc/98' failed: Permission denied
lstat '/proc/99' failed: Permission denied
dr-xr-xr-x root root 2015-09-15 03:29 asound
dr-xr-xr-x root root 2015-09-15 03:29 bluetooth
-r--r--r-- root root 0 2015-09-15 03:29 buddyinfo
dr-xr-xr-x root root 2015-09-15 03:29 bus
-r--r--r-- root root 0 2015-09-15 03:29 cgroups
-r--r----- root radio 0 2015-09-15 03:29 cmdline
-r--r--r-- root root 0 2015-09-15 03:29 consoles
-r--r--r-- root root 0 2015-09-15 03:29 cpuinfo
-r--r--r-- root root 0 2015-09-15 03:29 crypto
dr-xr-xr-x root root 2015-09-15 03:29 device-tree
-r--r--r-- root root 0 2015-09-15 03:29 devices
-r--r--r-- root root 0 2015-09-15 03:29 diskstats
dr-xr-xr-x root root 2015-09-15 03:29 driver
-r--r--r-- root root 0 2015-09-15 03:29 execdomains
-r--r--r-- root root 0 2015-09-15 03:29 fb
-r--r--r-- root root 0 2015-09-15 03:29 filesystems
dr-xr-xr-x root root 2015-09-15 03:29 fs
-r--r--r-- root root 0 2015-09-15 03:29 interrupts
-r--r--r-- root root 0 2015-09-15 03:29 iomem
-r--r--r-- root root 0 2015-09-15 03:29 ioports
dr-xr-xr-x root root 2015-09-15 03:29 irq
-r--r--r-- root root 0 2015-09-15 03:29 kallsyms
-r--r----- root system 0 2015-09-12 03:30 kmsg
-r-------- root root 0 2015-09-15 03:29 kpagecount
-r-------- root root 0 2015-09-15 03:29 kpageflags
-r--r--r-- root root 0 2015-09-15 03:29 loadavg
-r--r--r-- root root 0 2015-09-15 03:29 locks
-r--r--r-- root root 0 2015-09-15 03:29 meminfo
-r--r--r-- root root 0 2015-09-15 03:29 misc
lrwxrwxrwx root root 2015-09-15 03:29 mounts -> self/mounts
lrwxrwxrwx root root 2015-09-15 03:29 net -> self/net
-r--r--r-- root root 0 2015-09-15 03:29 pagetypeinfo
-r--r--r-- root root 0 2015-09-15 03:29 partitions
dr-xr-xr-x root root 2015-09-15 03:29 quadd
-r--r--r-- root root 0 2015-09-15 03:29 sched_debug
-r--r--r-- root root 0 2015-09-15 03:29 schedstat
dr-xr-xr-x root root 2015-09-15 03:29 scsi
lrwxrwxrwx root root 1969-12-31 16:00 self -> 14005
-r--r----- root log 0 2015-09-15 03:29 slabinfo
-r--r--r-- root root 0 2015-09-15 03:29 softirqs
-r--r--r-- root root 0 2015-09-15 03:29 stat
-r--r--r-- root root 0 2015-09-15 03:29 swaps
dr-xr-xr-x root root 2015-09-14 06:13 sys
lstat '/proc/sysrq-trigger' failed: Permission denied
dr-xr-xr-x root root 2015-09-15 03:29 sysvipc
-r--r--r-- root root 0 2015-09-15 03:29 timer_list
-rw-r--r-- root root 0 2015-09-15 03:29 timer_stats
dr-xr-xr-x root root 2015-09-15 03:29 tty
dr-xr-xr-x root root 2015-09-15 03:29 uid_cputime
dr-xr-xr-x root root 2015-09-15 03:29 uid_stat
-r--r--r-- root root 0 2015-09-15 03:29 uptime
-r--r--r-- root root 0 2015-09-15 03:29 version
-r--r----- root log 0 2015-09-15 03:29 vmallocinfo
-r--r--r-- root root 0 2015-09-15 03:29 vmstat
-r--r--r-- root root 0 2015-09-15 03:29 zoneinfo
显然,我收到“权限被拒绝”错误的文件也无法使用 new java.io.File("/proc").listFiles(); 读取。
为什么我的应用进程不能读取这些目录?权限授予“其他”用户读取权限(“dr-xr-xr-x”)。
最佳答案
Android 5 及更高版本使用 SELinux,它使用两种形式的访问控制。传统 Linux 使用自主访问控制列表。 SE 组件还执行强制访问控制列表。前者默认允许,后者默认拒绝。
只有在两组权限都允许的情况下,您或进程才能访问对象。访问由 SE 上下文决定。 Shell 和应用程序上下文具有不同的权限,不幸的是,没有任何已知的方法来提供应用程序 Shell 上下文。
您可以使用以下方式查看安全上下文:
ls -Z
我没有要测试的 Marshmallow 设备,但是可以为您的应用程序提供必要上下文的是获取 usagestatsmanager 权限。用户必须启用它的安全设置,我被告知三星设备没有必要的菜单。请记住,在黑暗中拍摄。
如果你想试试看这个问题:How to check if "android.permission.PACKAGE_USAGE_STATS" permission is given?
此页面可能会为您提供有关权限的更多信息:https://su.chainfire.eu/#selinux
关于Android 6.0上的Android文件权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32584063/
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时
我的目标是转换表单输入,例如“100兆字节”或“1GB”,并将其转换为我可以存储在数据库中的文件大小(以千字节为单位)。目前,我有这个:defquota_convert@regex=/([0-9]+)(.*)s/@sizes=%w{kilobytemegabytegigabyte}m=self.quota.match(@regex)if@sizes.include?m[2]eval("self.quota=#{m[1]}.#{m[2]}")endend这有效,但前提是输入是倍数(“gigabytes”,而不是“gigabyte”)并且由于使用了eval看起来疯狂不安全。所以,功能正常,
Rails2.3可以选择随时使用RouteSet#add_configuration_file添加更多路由。是否可以在Rails3项目中做同样的事情? 最佳答案 在config/application.rb中:config.paths.config.routes在Rails3.2(也可能是Rails3.1)中,使用:config.paths["config/routes"] 关于ruby-on-rails-Rails3中的多个路由文件,我们在StackOverflow上找到一个类似的问题
对于具有离线功能的智能手机应用程序,我正在为Xml文件创建单向文本同步。我希望我的服务器将增量/差异(例如GNU差异补丁)发送到目标设备。这是计划:Time=0Server:hasversion_1ofXmlfile(~800kiB)Client:hasversion_1ofXmlfile(~800kiB)Time=1Server:hasversion_1andversion_2ofXmlfile(each~800kiB)computesdeltaoftheseversions(=patch)(~10kiB)sendspatchtoClient(~10kiBtransferred)Cl
我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚
使用带有Rails插件的vim,您可以创建一个迁移文件,然后一次性打开该文件吗?textmate也可以这样吗? 最佳答案 你可以使用rails.vim然后做类似的事情::Rgeneratemigratonadd_foo_to_bar插件将打开迁移生成的文件,这正是您想要的。我不能代表textmate。 关于ruby-使用VimRails,您可以创建一个新的迁移文件并一次性打开它吗?,我们在StackOverflow上找到一个类似的问题: https://sta
好的,所以我的目标是轻松地将一些数据保存到磁盘以备后用。您如何简单地写入然后读取一个对象?所以如果我有一个简单的类classCattr_accessor:a,:bdefinitialize(a,b)@a,@b=a,bendend所以如果我从中非常快地制作一个objobj=C.new("foo","bar")#justgaveitsomerandomvalues然后我可以把它变成一个kindaidstring=obj.to_s#whichreturns""我终于可以将此字符串打印到文件或其他内容中。我的问题是,我该如何再次将这个id变回一个对象?我知道我可以自己挑选信息并制作一个接受该信
我正在编写一个小脚本来定位aws存储桶中的特定文件,并创建一个临时验证的url以发送给同事。(理想情况下,这将创建类似于在控制台上右键单击存储桶中的文件并复制链接地址的结果)。我研究过回形针,它似乎不符合这个标准,但我可能只是不知道它的全部功能。我尝试了以下方法:defauthenticated_url(file_name,bucket)AWS::S3::S3Object.url_for(file_name,bucket,:secure=>true,:expires=>20*60)end产生这种类型的结果:...-1.amazonaws.com/file_path/file.zip.A
我注意到像bundler这样的项目在每个specfile中执行requirespec_helper我还注意到rspec使用选项--require,它允许您在引导rspec时要求一个文件。您还可以将其添加到.rspec文件中,因此只要您运行不带参数的rspec就会添加它。使用上述方法有什么缺点可以解释为什么像bundler这样的项目选择在每个规范文件中都需要spec_helper吗? 最佳答案 我不在Bundler上工作,所以我不能直接谈论他们的做法。并非所有项目都checkin.rspec文件。原因是这个文件,通常按照当前的惯例,只