0
点赞
收藏
分享

微信扫一扫

网路安全技能竞赛——【Linux操作系统渗透提权】解析(超级详细)

老罗话编程 2023-05-31 阅读 76

kernel-4.4\drivers\power\power_supply_core.c

当电量信息需要更新的时候,kernel会调用power_supply_changed_work这个工作队列,使用kobject_uevent函数往上发送uevent事件,action是KOBJ_CHANGE;

static void power_supply_changed_work(struct work_struct *work)
{
    unsigned long flags;
    struct power_supply *psy = container_of(work, struct power_supply,
                        changed_work);
 
    dev_dbg(&psy->dev, "%s\n", __func__);
 
    spin_lock_irqsave(&psy->changed_lock, flags);
    /*
     * Check 'changed' here to avoid issues due to race between
     * power_supply_changed() and this routine. In worst case
     * power_supply_changed() can be called again just before we take above
     * lock. During the first call of this routine we will mark 'changed' as
     * false and it will stay false for the next call as well.
     */
    if (likely(psy->changed)) {
        printk("power_supply_changed_work 1111 \n" );
  
举报

相关推荐

0 条评论