博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
进程创建时pid分配
阅读量:4151 次
发布时间:2019-05-25

本文共 1200 字,大约阅读时间需要 4 分钟。

 
struct pid *alloc_pid(struct pid_namespace *ns){ struct pid *pid; enum pid_type type; int i, nr; struct pid_namespace *tmp; struct upid *upid; int retval = -ENOMEM;  pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); if (!pid)  return ERR_PTR(retval);  tmp = ns; pid->level = ns->level; for (i = ns->level; i >= 0; i--) {  nr = alloc_pidmap(tmp);  if (nr < 0) {   retval = nr;   goto out_free;  }   pid->numbers[i].nr = nr;  pid->numbers[i].ns = tmp;  tmp = tmp->parent; }  if (unlikely(is_child_reaper(pid))) {  if (pid_ns_prepare_proc(ns))   goto out_free; }  get_pid_ns(ns); atomic_set(&pid->count, 1); for (type = 0; type < PIDTYPE_MAX; ++type)  INIT_HLIST_HEAD(&pid->tasks[type]);  upid = pid->numbers + ns->level; spin_lock_irq(&pidmap_lock); if (!(ns->nr_hashed & PIDNS_HASH_ADDING))  goto out_unlock; for ( ; upid >= pid->numbers; --upid) {  hlist_add_head_rcu(&upid->pid_chain,    &pid_hash[pid_hashfn(upid->nr, upid->ns)]);  upid->ns->nr_hashed++; } spin_unlock_irq(&pidmap_lock);  return pid; out_unlock: spin_unlock_irq(&pidmap_lock); put_pid_ns(ns); out_free: while (++i <= ns->level)  free_pidmap(pid->numbers + i);  kmem_cache_free(ns->pid_cachep, pid); return ERR_PTR(retval);}
 
 

转载地址:http://wkhti.baihongyu.com/

你可能感兴趣的文章
Flex 布局教程:语法篇
查看>>
年薪50万+的90后程序员都经历了什么?
查看>>
2019年哪些外快收入可达到2万以上?
查看>>
【JavaScript 教程】标准库—Date 对象
查看>>
前阿里手淘前端负责人@winter:前端人如何保持竞争力?
查看>>
【JavaScript 教程】面向对象编程——实例对象与 new 命令
查看>>
我在网易做了6年前端,想给求职者4条建议
查看>>
SQL1015N The database is in an inconsistent state. SQLSTATE=55025
查看>>
RQP-DEF-0177
查看>>
MySQL字段类型的选择与MySQL的查询效率
查看>>
Java的Properties配置文件用法【续】
查看>>
JAVA操作properties文件的代码实例
查看>>
java杂记
查看>>
RunTime.getRuntime().exec()
查看>>
Oracle 分组排序函数
查看>>
删除weblogic 域
查看>>
VMware Workstation 14中文破解版下载(附密钥)(笔记)
查看>>
日志框架学习
查看>>
日志框架学习2
查看>>
SVN-无法查看log,提示Want to go offline,时间显示1970问题,error主要是 url中 有一层的中文进行了2次encode
查看>>