根据本指南python描述符 https://docs.python.org/2/howto/descriptor.html
新样式类中的方法对象是使用描述符实现的,以避免在属性查找中特殊包装它们.
我理解这一点的方法是有一个方法对象类型实现__get__并在使用实例和未绑定的方法对象调用时返回绑定的方法对象,在没有实例和只有类的情况下调用.文章还指出,这个逻辑是在object .__ getattribute__方法中实现的.像这样:
def __getattribute__(self, key):
"Emulate type_getattro() in Objects/typeobject.c"
v = object.__getattribute__(self, key)
if hasattr(v, '__get__'):
return v.__get__(None, self)
return v
Run Code Online (Sandbox Code Playgroud)
但是对象.__ getattribute__本身就是一种方法!那怎么绑定一个对象(没有无限递归)?如果它在属性查找中是特殊的,那不会破坏删除旧式特殊套管的目的吗?
我一直在寻找SEAndroid,并且一直在尝试了解过程域是如何给出的。
到目前为止,我得到的是init.rc文件中的某些服务声明下,有一个称为seclabel的令牌:
service adbd /sbin/adbd --root_seclabel=u:r:su:s0
class core
socket adbd stream 660 system system
disabled
seclabel u:r:adbd:s0
Run Code Online (Sandbox Code Playgroud)
setexeccon将稍后在init.c中设置为所写的上下文:
if (svc->seclabel) {
if (is_selinux_enabled() > 0 && setexeccon(svc->seclabel) < 0) {
ERROR("cannot setexeccon('%s'): %s\n", svc->seclabel, strerror(errno));
_exit(127);
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,域将为adbd。
但是我没有发现服务声明中没有seclabel令牌时会发生什么。init.c中发生的事情是它不会调用setexeccon,这意味着..保留父域?
致电至:
ps -Z
Run Code Online (Sandbox Code Playgroud)
在adb shell中,它显示了所有进程及其域,否则显示。
For example, the servicemanager in init.rc:
class core
user system
group system
critical
onrestart restart healthd
onrestart restart zygote
onrestart restart media
onrestart restart surfaceflinger
onrestart restart drm
Run Code Online (Sandbox Code Playgroud)
但是调用ps -Z显示:
u:r:servicemanager:s0 system 53 1 /system/bin/servicemanager …Run Code Online (Sandbox Code Playgroud) 我一直在使用buildroot来使用uclibc构建工具链。现在,buildroot下载所有包,解压并构建它们。
我想更改工具链的uclibc源代码,然后使用新源代码重新编译工具链,但我只是不明白如何以漂亮的方式完成它。
完成构建后,所有提取的源都可以在“ <buildroot-src>/output/build ”中找到。但更改它们不会给我带来任何好处,因为 buildroot 仅在构建期间使用此目录作为中间目录。
所以我的想法是,也许可以更改uclibc包中的 .mk 文件,并使其使用我修改过的源代码,而不是下载并提取它(尚未确定是否可以在那里完成),但这似乎是一个有点难看的解决方案。
所以我的问题是:有没有更好的方法告诉 buildroot 使用现有源构建包?