• Home
  • Raw
  • Download

Lines Matching refs:uid

111 bool TrafficController::hasUpdateDeviceStatsPermission(uid_t uid) {  in hasUpdateDeviceStatsPermission()  argument
114 uint32_t appId = uid % PER_USER_RANGE; in hasUpdateDeviceStatsPermission()
348 int TrafficController::tagSocket(int sockFd, uint32_t tag, uid_t uid, uid_t callingUid) { in tagSocket() argument
350 if (uid != callingUid && !hasUpdateDeviceStatsPermission(callingUid)) { in tagSocket()
355 if (legacy_tagSocket(sockFd, tag, uid)) return -errno; in tagSocket()
361 UidTag newKey = {.uid = (uint32_t)uid, .tag = tag}; in tagSocket()
370 const auto countUidStatsEntries = [uid, &totalEntryCount, &perUidEntryCount]( in tagSocket()
372 if (key.uid == uid) { in tagSocket()
402 totalEntryCount, uid, perUidEntryCount); in tagSocket()
434 int TrafficController::setCounterSet(int counterSetNum, uid_t uid, uid_t callingUid) { in setCounterSet() argument
441 if (legacy_setCounterSet(counterSetNum, uid)) return -errno; in setCounterSet()
448 Status res = mUidCounterSetMap.deleteValue(uid); in setCounterSet()
457 Status res = mUidCounterSetMap.writeValue(uid, tmpCounterSetNum, BPF_ANY); in setCounterSet()
469 int TrafficController::deleteTagData(uint32_t tag, uid_t uid, uid_t callingUid) { in deleteTagData() argument
474 if (legacy_deleteTagData(tag, uid)) return -errno; in deleteTagData()
480 const auto deleteMatchedCookieEntries = [uid, tag](const uint64_t& key, const UidTag& value, in deleteTagData()
482 if (value.uid == uid && (value.tag == tag || tag == 0)) { in deleteTagData()
495 const auto deleteMatchedUidTagEntries = [uid, tag](const StatsKey& key, in deleteTagData()
497 if (key.uid == uid && (key.tag == tag || tag == 0)) { in deleteTagData()
503 ALOGE("Failed to delete data(uid=%u, tag=%u): %s\n", key.uid, key.tag, in deleteTagData()
514 Status res = mUidCounterSetMap.deleteValue(uid); in deleteTagData()
516 ALOGE("Failed to delete counterSet data(uid=%u, tag=%u): %s\n", uid, tag, in deleteTagData()
520 auto deleteAppUidStatsEntry = [uid](const uint32_t& key, BpfMap<uint32_t, StatsValue>& map) { in deleteTagData()
521 if (key == uid) { in deleteTagData()
552 Status TrafficController::updateOwnerMapEntry(UidOwnerMatchType match, uid_t uid, FirewallRule rule, in updateOwnerMapEntry() argument
556 RETURN_IF_NOT_OK(addRule(mUidOwnerMap, uid, match)); in updateOwnerMapEntry()
558 RETURN_IF_NOT_OK(removeRule(mUidOwnerMap, uid, match)); in updateOwnerMapEntry()
577 Status TrafficController::removeRule(BpfMap<uint32_t, UidOwnerValue>& map, uint32_t uid, in removeRule() argument
579 auto oldMatch = map.readValue(uid); in removeRule()
584 RETURN_IF_NOT_OK(map.deleteValue(uid)); in removeRule()
586 RETURN_IF_NOT_OK(map.writeValue(uid, newMatch, BPF_ANY)); in removeRule()
589 return statusFromErrno(ENOENT, StringPrintf("uid: %u does not exist in map", uid)); in removeRule()
594 Status TrafficController::addRule(BpfMap<uint32_t, UidOwnerValue>& map, uint32_t uid, in addRule() argument
602 auto oldMatch = map.readValue(uid); in addRule()
606 RETURN_IF_NOT_OK(map.writeValue(uid, newMatch, BPF_ANY)); in addRule()
609 RETURN_IF_NOT_OK(map.writeValue(uid, newMatch, BPF_ANY)); in addRule()
625 long uid = strtol(appStrUid.c_str(), &endPtr, 10); in updateUidOwnerMap() local
626 if ((errno == ERANGE && (uid == LONG_MAX || uid == LONG_MIN)) || in updateUidOwnerMap()
632 RETURN_IF_NOT_OK(removeRule(mUidOwnerMap, uid, match)); in updateUidOwnerMap()
634 RETURN_IF_NOT_OK(addRule(mUidOwnerMap, uid, match)); in updateUidOwnerMap()
643 int TrafficController::changeUidOwnerRule(ChildChain chain, uid_t uid, FirewallRule rule, in changeUidOwnerRule() argument
652 res = updateOwnerMapEntry(DOZABLE_MATCH, uid, rule, type); in changeUidOwnerRule()
655 res = updateOwnerMapEntry(STANDBY_MATCH, uid, rule, type); in changeUidOwnerRule()
658 res = updateOwnerMapEntry(POWERSAVE_MATCH, uid, rule, type); in changeUidOwnerRule()
665 ALOGE("change uid(%u) rule of %d failed: %s, rule: %d, type: %d", uid, chain, in changeUidOwnerRule()
686 for(auto uid : uidsToDelete) { in replaceRulesInMap() local
687 RETURN_IF_NOT_OK(removeRule(mUidOwnerMap, uid, match)); in replaceRulesInMap()
690 for (auto uid : uids) { in replaceRulesInMap() local
691 RETURN_IF_NOT_OK(addRule(mUidOwnerMap, uid, match)); in replaceRulesInMap()
707 for (auto uid : uidsToAdd) { in addUidInterfaceRules() local
708 netdutils::Status result = addRule(mUidOwnerMap, uid, IIF_MATCH, iif); in addUidInterfaceRules()
710 ALOGW("addRule failed(%d): uid=%d iif=%d", result.code(), uid, iif); in addUidInterfaceRules()
723 for (auto uid : uidsToDelete) { in removeUidInterfaceRules() local
724 netdutils::Status result = removeRule(mUidOwnerMap, uid, IIF_MATCH); in removeUidInterfaceRules()
726 ALOGW("removeRule failed(%d): uid=%d", result.code(), uid); in removeUidInterfaceRules()
844 for (uid_t uid : uids) { in setPermissionForUids() local
847 mPrivilegedUser.erase(uid); in setPermissionForUids()
849 Status ret = mUidPermissionMap.deleteValue(uid); in setPermissionForUids()
851 ALOGE("Failed to clean up the permission for %u: %s", uid, in setPermissionForUids()
861 for (uid_t uid : uids) { in setPermissionForUids() local
863 mPrivilegedUser.insert(uid); in setPermissionForUids()
865 mPrivilegedUser.erase(uid); in setPermissionForUids()
875 Status ret = mUidPermissionMap.writeValue(uid, permission, BPF_ANY); in setPermissionForUids()
878 UidPermissionTypeToString(permission).c_str(), uid, strerror(ret.code())); in setPermissionForUids()
881 Status ret = mUidPermissionMap.deleteValue(uid); in setPermissionForUids()
883 ALOGE("Failed to remove uid %u from permission map: %s", uid, strerror(ret.code())); in setPermissionForUids()
979 dw.println("cookie=%" PRIu64 " tag=0x%x uid=%u", key, value.tag, value.uid); in dump()
1025 ifname.value().name, key.tag, key.uid, key.counterSet, value.rxBytes, in dump()
1123 for (uid_t uid : mPrivilegedUser) { in dump() local
1124 dw.println("%u ALLOW_UPDATE_DEVICE_STATS", (uint32_t)uid); in dump()