resgid=n and resuid=n The ext2 filesystem reserves a certain percentage of the available space (by default 5%, see mke2fs(8) and tune2fs(8)). These options determine who can use the reserved blocks. (Roughly: whoever has the specified uid, or belongs to the specified group.)
man tune2fs:
-r reserved-blocks-count Set the number of reserved filesystem blocks.
-g group Set the group which can use the reserved filesystem blocks. The group parameter can be a numerical gid or a group name. If a group name is given, it is converted to a numerical gid before it is stored in the superblock.
ok, 关键函数:
staticinlinebool __allow_reserved_blocks(struct f2fs_sb_info *sbi) { if (!test_opt(sbi, RESERVE_ROOT)) returnfalse; if (capable(CAP_SYS_RESOURCE)) returntrue; if (uid_eq(sbi->s_resuid, current_fsuid())) returntrue; if (!gid_eq(sbi->s_resgid, GLOBAL_ROOT_GID) && in_group_p(sbi->s_resgid)) returntrue; returnfalse; }
service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server class main priority -20 user root group root readproc reserved_disk
可以用id命令显示uid/gid等信息:
xxx:/ # ps -A | grep system_server USER PID PPID VSZ RSS WCHAN ADDR S NAME system 2888 286 1127972 73976 SyS_epoll_wait b008a658 S system_server xxx:/ # xxx:/ # id system uid=1000(system) gid=1000(system) groups=1000(system), context=u:r:su:s0 xxx:/ # xxx:/ # id reserved_disk uid=1065(reserved_disk) gid=1065(reserved_disk) groups=1065(reserved_disk), cont ext=u:r:su:s0