亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
12下一頁(yè)
最近訪問(wèn)板塊 發(fā)新帖
查看: 3493 | 回復(fù): 12
打印 上一主題 下一主題

[C++] 怪哉,服務(wù)程序悄無(wú)聲息的退出 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2012-07-30 12:09 |只看該作者 |倒序?yàn)g覽
本帖最后由 fly6 于 2012-07-30 12:10 編輯

程序啟動(dòng)時(shí)就下注冊(cè)了如下信號(hào),并在信號(hào)自理程序中打印了日志。
if((sigaction(SIGILL, &struAct, NULL) != 0) ||
           (sigaction(SIGSEGV, &struAct, NULL) != 0) ||
           (sigaction(SIGBUS, &struAct, NULL) != 0))
        {
                cutil_log_error("install sigaction catch error:%s\n", cutil_get_error(-1));
                return -1;
        }

程序主循環(huán),這是一個(gè)死循環(huán)
while(1)
{
  do_some_thing();
}

按理說(shuō)程序要退出,除非異常退出,奇怪的是并沒(méi)有輸出異常信息。(程序不會(huì)接收到SIGKILL,SIGQUIT)
請(qǐng)問(wèn)還有什么會(huì)令程序退出不打印異常信息

論壇徽章:
2
CU大;照
日期:2013-04-17 11:46:28CU大;照
日期:2013-04-17 11:46:39
2 [報(bào)告]
發(fā)表于 2012-07-30 13:04 |只看該作者
正常退出,貌似不會(huì)打印吧

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2012-07-30 13:15 |只看該作者
這是個(gè)死循環(huán),不會(huì)正常退出的

論壇徽章:
7
榮譽(yù)版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07獅子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10雙子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
4 [報(bào)告]
發(fā)表于 2012-07-30 13:46 |只看該作者
猜一下,是不是tty沒(méi)關(guān)閉?
其實(shí)守護(hù)進(jìn)程就那么幾個(gè)要點(diǎn),弄個(gè)check list挨個(gè)查一遍就找到原因了。

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2012-07-30 21:56 |只看該作者
  1. if((sigaction(SIGILL, &struAct, NULL) != 0) ||
  2.            (sigaction(SIGSEGV, &struAct, NULL) != 0) ||
  3.            (sigaction(SIGBUS, &struAct, NULL) != 0))
  4.         {
  5.                 cutil_log_error("install sigaction catch error:%s\n", cutil_get_error(-1));
  6.                 return -1;
  7.         }

復(fù)制代碼
你這只是信號(hào)注冊(cè)部分吧,相應(yīng)的信號(hào)處理函數(shù)是什么樣的...............

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2012-07-30 22:29 |只看該作者
回復(fù) 4# r2007
這個(gè)在程序一開(kāi)始就做了demon處理,包括關(guān)閉tty,關(guān)閉會(huì)話,還有fork

     

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2012-07-30 22:31 |只看該作者
回復(fù) 5# Moon_Bird
就是打印錯(cuò)誤信息及堆棧信息


   

論壇徽章:
7
榮譽(yù)版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07獅子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10雙子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
8 [報(bào)告]
發(fā)表于 2012-07-31 01:44 |只看該作者
FYI
The common method for a process to become a daemon involves:

    Dissociating from the controlling tty
    Becoming a session leader
    Becoming a process group leader
    Executing as a background task by forking and exiting (once or twice). This is required sometimes for the process to become a session leader. It also allows the parent process to continue its normal execution.
    Setting the root directory ("/") as the current working directory so that the process does not keep any directory in use that may be on a mounted file system (allowing it to be unmounted).
    Changing the umask to 0 to allow open(), creat(), et al. operating system calls to provide their own permission masks and not to depend on the umask of the caller
    Closing all inherited files at the time of execution that are left open by the parent process, including file descriptors 0, 1 and 2 (stdin, stdout, stderr). Required files will be opened later.
    Using a logfile, the console, or /dev/null as stdin, stdout, and stderr

論壇徽章:
208
巨蟹座
日期:2013-09-02 09:16:36卯兔
日期:2013-09-02 20:53:59酉雞
日期:2013-09-05 21:21:45戌狗
日期:2013-10-15 20:51:17寅虎
日期:2013-10-18 21:13:16白羊座
日期:2013-10-23 21:15:19午馬
日期:2013-10-25 21:22:48技術(shù)圖書(shū)徽章
日期:2013-11-01 09:11:32雙魚(yú)座
日期:2013-11-01 20:29:44丑牛
日期:2013-11-01 20:40:00卯兔
日期:2013-11-11 09:21:32酉雞
日期:2013-12-04 19:56:39
9 [報(bào)告]
發(fā)表于 2012-07-31 08:56 |只看該作者
信號(hào)不一定能抓到,有些程序都抓SIGSEGV了,還是沒(méi)提示,直接掛了
多半是exception退出了

論壇徽章:
0
10 [報(bào)告]
發(fā)表于 2012-07-31 09:03 |只看該作者
嗯,樓上可以再詳細(xì)點(diǎn)具體點(diǎn)不
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專(zhuān)區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP