MCPcopy Create free account
hub / github.com/SeeFlowerX/stackplz / Get_PackageInfos

Function Get_PackageInfos

user/util/helper.go:152–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150}
151
152func Get_PackageInfos() *PackageInfos {
153 // https://zhuanlan.zhihu.com/p/31124919
154 // /data/system/packages.list
155 content, err := ioutil.ReadFile("/data/system/packages.list")
156 if err != nil {
157 panic(err)
158 }
159 var pis PackageInfos
160 lines := strings.TrimSpace(string(content))
161 for _, line := range strings.Split(lines, "\n") {
162 parts := strings.Split(line, " ")
163 value, err := strconv.ParseUint(parts[1], 10, 32)
164 if err != nil {
165 panic(err)
166 }
167 pis.items = append(pis.items, PackageInfo{parts[0], uint32(value)})
168 }
169 return &pis
170}
171
172func ReadMapsByPid(pid uint32) (string, error) {
173 filename := fmt.Sprintf("/proc/%d/maps", pid)

Callers 1

persistentPreRunEFuncFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected