免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4169 | 回复: 6
打印 上一主题 下一主题

[FreeBSD] 不知不觉,FreeBSD连续运行一千多天了 [复制链接]

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2017-02-02 10:25 |只看该作者 |倒序浏览
radius服务器,自已写的WEB用户管理系统,另有一个内网的ftp。
右上角的时间显示出错了,空格被挤掉,两个时间靠一起了。


论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
2 [报告]
发表于 2017-02-02 10:29 |只看该作者
另一个问题:pid是什么结构?为什么last pid会比nginx的那些进程pid小?pid会用尽么?

不要抱怨我懒哦,现在手头工作跟计算机没关系,真懒得再去翻代码。

论坛徽章:
2
双子座
日期:2014-05-18 22:44:102015年迎新春徽章
日期:2015-03-04 09:58:11
3 [报告]
发表于 2017-02-04 12:39 |只看该作者
pid好像如果到极限了 似乎会从头开始重新生成 比如1000极限 等到了1000 ,那就从1重新开始,如果1被占用,使用下一个pid 似乎是这个意思

论坛徽章:
12
寅虎
日期:2013-12-04 20:37:4915-16赛季CBA联赛之广东
日期:2017-08-22 19:23:1215-16赛季CBA联赛之上海
日期:2016-06-18 23:05:05操作系统版块每日发帖之星
日期:2016-06-06 06:20:00操作系统版块每日发帖之星
日期:2016-06-05 06:20:00操作系统版块每日发帖之星
日期:2016-06-03 06:20:002015年辞旧岁徽章
日期:2015-03-03 16:54:152015年亚洲杯之巴勒斯坦
日期:2015-02-10 21:38:08卯兔
日期:2014-10-31 20:42:23申猴
日期:2014-06-11 17:15:10处女座
日期:2014-05-22 09:00:1815-16赛季CBA联赛之广夏
日期:2017-09-25 23:37:46
4 [报告]
发表于 2017-02-04 19:15 |只看该作者
本帖最后由 wait_rabbit 于 2017-02-04 19:19 编辑

你设置了 random pid ?

241,242行

话说引用的代码里边怎么加粗,标红?

  1. 186 static int randompid = 0;
  2. 187
  3. 188 static int
  4. 189 sysctl_kern_randompid(SYSCTL_HANDLER_ARGS)
  5. 190 {
  6. 191         int error, pid;
  7. 192
  8. 193         error = sysctl_wire_old_buffer(req, sizeof(int));
  9. 194         if (error != 0)
  10. 195                 return(error);
  11. 196         sx_xlock(&allproc_lock);
  12. 197         pid = randompid;
  13. 198         error = sysctl_handle_int(oidp, &pid, 0, req);
  14. 199         if (error == 0 && req->newptr != NULL) {
  15. 200                 if (pid < 0 || pid > pid_max - 100)     /* out of range */
  16. 201                         pid = pid_max - 100;
  17. 202                 else if (pid < 2)                       /* NOP */
  18. 203                         pid = 0;
  19. 204                 else if (pid < 100)                     /* Make it reasonable */
  20. 205                         pid = 100;
  21. 206                 randompid = pid;
  22. 207         }
  23. 208         sx_xunlock(&allproc_lock);
  24. 209         return (error);
  25. 210 }
  26. 211
  27. 212 SYSCTL_PROC(_kern, OID_AUTO, randompid, CTLTYPE_INT|CTLFLAG_RW,
  28. 213     0, 0, sysctl_kern_randompid, "I", "Random PID modulus");
  29. 214
  30. 215 static int
  31. 216 fork_findpid(int flags)
  32. 217 {
  33. 218         struct proc *p;
  34. 219         int trypid;
  35. 220         static int pidchecked = 0;
  36. 221
  37. 222         /*
  38. 223          * Requires allproc_lock in order to iterate over the list
  39. 224          * of processes, and proctree_lock to access p_pgrp.
  40. 225          */
  41. 226         sx_assert(&allproc_lock, SX_LOCKED);
  42. 227         sx_assert(&proctree_lock, SX_LOCKED);
  43. 228
  44. 229         /*
  45. 230          * Find an unused process ID.  We remember a range of unused IDs
  46. 231          * ready to use (from lastpid+1 through pidchecked-1).
  47. 232          *
  48. 233          * If RFHIGHPID is set (used during system boot), do not allocate
  49. 234          * low-numbered pids.
  50. 235          */
  51. 236         trypid = lastpid + 1;
  52. 237         if (flags & RFHIGHPID) {
  53. 238                 if (trypid < 10)
  54. 239                         trypid = 10;
  55. 240         } else {
  56. 241                 if (randompid)
  57. 242                         trypid += arc4random() % randompid;
  58. 243         }
  59. 244 retry:
  60. 245         /*
  61. 246          * If the process ID prototype has wrapped around,
  62. 247          * restart somewhat above 0, as the low-numbered procs
  63. 248          * tend to include daemons that don't exit.
  64. 249          */
  65. 250         if (trypid >= pid_max) {
  66. 251                 trypid = trypid % pid_max;
  67. 252                 if (trypid < 100)
  68. 253                         trypid += 100;
  69. 254                 pidchecked = 0;
  70. 255         }
  71. 256         if (trypid >= pidchecked) {
  72. 257                 int doingzomb = 0;
  73. 258
  74. 259                 pidchecked = PID_MAX;
  75. 260                 /*
  76. 261                  * Scan the active and zombie procs to check whether this pid
  77. 262                  * is in use.  Remember the lowest pid that's greater
  78. 263                  * than trypid, so we can avoid checking for a while.
  79. 264                  */
  80. 265                 p = LIST_FIRST(&allproc);
  81. 266 again:
  82. 267                 for (; p != NULL; p = LIST_NEXT(p, p_list)) {
  83. 268                         while (p->p_pid == trypid ||
  84. 269                             (p->p_pgrp != NULL &&
  85. 270                             (p->p_pgrp->pg_id == trypid ||
  86. 271                             (p->p_session != NULL &&
  87. 272                             p->p_session->s_sid == trypid)))) {
  88. 273                                 trypid++;
  89. 274                                 if (trypid >= pidchecked)
  90. 275                                         goto retry;
  91. 276                         }
  92. 277                         if (p->p_pid > trypid && pidchecked > p->p_pid)
  93. 278                                 pidchecked = p->p_pid;
  94. 279                         if (p->p_pgrp != NULL) {
  95. 280                                 if (p->p_pgrp->pg_id > trypid &&
  96. 281                                     pidchecked > p->p_pgrp->pg_id)
  97. 282                                         pidchecked = p->p_pgrp->pg_id;
  98. 283                                 if (p->p_session != NULL &&
  99. 284                                     p->p_session->s_sid > trypid &&
  100. 285                                     pidchecked > p->p_session->s_sid)
  101. 286                                         pidchecked = p->p_session->s_sid;
  102. 287                         }
  103. 288                 }
  104. 289                 if (!doingzomb) {
  105. 290                         doingzomb = 1;
  106. 291                         p = LIST_FIRST(&zombproc);
  107. 292                         goto again;
  108. 293                 }
  109. 294   
  110. 296         /*
  111. 297          * RFHIGHPID does not mess with the lastpid counter during boot.
  112. 298          */
  113. 299         if (flags & RFHIGHPID)
  114. 300                 pidchecked = 0;
  115. 301         else
  116. 302                 lastpid = trypid;
  117. 303
  118. 304         return (trypid);
  119. 305 }
  120. 306
复制代码

论坛徽章:
12
寅虎
日期:2013-12-04 20:37:4915-16赛季CBA联赛之广东
日期:2017-08-22 19:23:1215-16赛季CBA联赛之上海
日期:2016-06-18 23:05:05操作系统版块每日发帖之星
日期:2016-06-06 06:20:00操作系统版块每日发帖之星
日期:2016-06-05 06:20:00操作系统版块每日发帖之星
日期:2016-06-03 06:20:002015年辞旧岁徽章
日期:2015-03-03 16:54:152015年亚洲杯之巴勒斯坦
日期:2015-02-10 21:38:08卯兔
日期:2014-10-31 20:42:23申猴
日期:2014-06-11 17:15:10处女座
日期:2014-05-22 09:00:1815-16赛季CBA联赛之广夏
日期:2017-09-25 23:37:46
5 [报告]
发表于 2017-02-04 19:20 |只看该作者

不过你这个看起来是 pid 到头了,所以滚回去重新开始。

上限好像是 99999,你已经有好几个 96xxx 的了。

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
6 [报告]
发表于 2017-02-09 21:28 |只看该作者
/root % sysctl -a | grep pid
kern.lastpid: 88864
kern.randompid: 0
kern.pid_max: 99999
net.inet.tcp.keepidle: 60000

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
7 [报告]
发表于 2017-02-09 21:29 |只看该作者
pid_max还真的是99999
@wait_rabbit
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP