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

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 3284 | 回復: 1
打印 上一主題 下一主題

請教一下exit函數(shù)! [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2006-08-21 09:38 |只看該作者 |倒序瀏覽
在讀程序的時候,經(jīng)常會看到exit函數(shù),例如exit(0),exit(-1),exit(-2)等,
它們各自代表什么意思呢,之間的區(qū)別是什么?

論壇徽章:
0
2 [報告]
發(fā)表于 2006-08-21 09:42 |只看該作者
EXIT(3)                              Linux Programmer’s Manual                             EXIT(3)

NAME
       exit - cause normal process termination

SYNOPSIS
       #include <stdlib.h>

       void exit(int status);

DESCRIPTION
       The  exit()  function  causes  normal process termination and the value of status & 0377 is
       returned to the parent (see wait(2)).

       All functions registered with atexit() and on_exit() are called, in the  reverse  order  of
       their  registration.   (It  is  possible  for  one  of  these  functions to use atexit() or
       on_exit() to register an additional function to be executed during exit processing; the new
       registration is added to the front of the list of functions that remain to be called.)

       All open streams are flushed and closed.  Files created by tmpfile() are removed.

       The  C  standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE, that may be passed
       to exit() to indicate successful or unsuccessful termination, respectively.

RETURN VALUE
       The exit() function does not return.

CONFORMING TO
       SVID 3, POSIX, 4.3BSD, ISO 9899 (‘‘ANSI C’’)

NOTES
       It is undefined what happens  if  one  of  the  functions  registered  using  atexit()  and
       on_exit() calls either exit() or longjmp().

       The  use  of  EXIT_SUCCESS and EXIT_FAILURE is slightly more portable (to non-Unix environ‐\r
       ments) than that of 0 and some non-zero value like 1 or -1. In particular, VMS uses a  dif‐\r
       ferent convention.
       BSD has attempted to standardize exit codes; see the file <sysexits.h>.

       After  exit(),  the  exit status must be transmitted to the parent process. There are three
       cases. If the parent has set SA_NOCLDWAIT, or has set the SIGCHLD handler to  SIG_IGN,  the
       status is discarded. If the parent was waiting on the child it is notified of the exit sta‐\r
       tus. In both cases the exiting process dies immediately. If the parent  has  not  indicated
       that it is not interested in the exit status, but is not waiting, the exiting process turns
       into a "zombie" process (which is nothing but a container for the single byte  representing
       the  exit  status)  so that the parent can learn the exit status when it later calls one of
       the wait() functions.

       If the implementation supports the SIGCHLD signal, this signal is sent to  the  parent.  If
       the parent has set SA_NOCLDWAIT, it is undefined whether a SIGCHLD signal is sent.

       If the process is a session leader and its controlling terminal is the controlling terminal
       of the session, then each process in the foreground process group of this controlling  ter‐\r
       minal  is sent a SIGHUP signal, and the terminal is disassociated from this session, allow‐\r
       ing it to be acquired by a new controlling process.

       If the exit of the process causes a process group to become orphaned, and if any member  of
       the  newly  orphaned  process  group is stopped, then a SIGHUP signal followed by a SIGCONT
       signal will be sent to each process in this process group.
您需要登錄后才可以回帖 登錄 | 注冊

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

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP