码迷,mamicode.com
首页 > 其他好文 > 详细

MIT 6.828 - 1.2 __acquires() 和 __releases()

时间:2019-11-24 19:45:40      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:ota   静态   not   ati   class   可见   https   struct   dev   

在对 dup / dup2 的源码分析中,我遇到了一对 annotation ,即 __acquires__releases

static int do_dup2(struct files_struct *files,
    struct file *file, unsigned fd, unsigned flags)
__releases(&files->file_lock) // <- 这个东西
{
    // ... omitted
}

经查阅,此为内核代码静态分析工具 Sparse 的 annotation 。Sparse 通过 gcc 的扩展属性 __attribute__ 以及自己定义的 __context__ 来对代码进行静态检查 。

其他可见 内核文档一篇博客

MIT 6.828 - 1.2 __acquires() 和 __releases()

标签:ota   静态   not   ati   class   可见   https   struct   dev   

原文地址:https://www.cnblogs.com/nlp-in-shell/p/11923426.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!