home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v7 / text0052.txt < prev    next >
Encoding:
Internet Message Format  |  1987-06-30  |  17.8 KB

  1. From: im4u!caip!hplabs!hpda!hpisoa1!davel@sally.utexas.edu (Dave Lennert)
  2. Date: Thu, 9 Oct 86 14:06:30 pdt
  3.  
  4. Attached is the P1003 job control proposal.  The first file contains 
  5. the text as accepted at the September P1003 meeting in Palo Alto.
  6. Note that this text sometimes replaces, and sometimes augments,
  7. existing POSIX text.  The second file contains the problems noticed 
  8. since then and the proposed resolutions.
  9.  
  10.     Dave Lennert                ucbvax!hpda!davel               [UUCP]
  11.     Hewlett-Packard - 47UX      ihnp4!hplabs!hpda!davel         [UUCP]
  12.     19447 Pruneridge Ave.       hpda!davel@ucb-vax.ARPA         [ARPA]
  13.     Cupertino, CA  95014        (408) 447-6325                  [AT&T]
  14.  
  15.  
  16. # This is a shell archive.  Remove anything before this line,
  17. # then unpack it by saving it in a file and typing "sh file".
  18. #
  19. # Wrapped by davel at hpisoa1 on Thu Oct  9 13:23:24 1986
  20. #
  21. # This archive contains:
  22. #    acceptedtext    problems    
  23. #
  24.  
  25. echo x - acceptedtext
  26. cat >acceptedtext <<'@EOF'
  27.                                    IEEE
  28.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  29.  
  30.        2.3  General Terms
  31.        Replace or add the following definitions:
  32.  
  33.  
  34.        job control option
  35.          Job control allows    users to selectively stop (suspend)
  36.          the execution of processes    and continue (resume) their
  37.          execution at a later point.  The user typically
  38.          employs this facility via the interactive interface
  39.          jointly supplied by the terminal I/O driver and a
  40.          command interpreter.  Conforming implementations may
  41.          optionally    support    job control facilities (see
  42.          Symbolic Constants      2.10).  Portions of the standard
  43.          operating system interface    which are required only    on
  44.          implementations which support the job control option
  45.          are so labelled.
  46.  
  47.  
  48.        process group leader
  49.          A process group leader is a process whose process ID
  50.          is    the same as its    process    group ID.  Any process that
  51.          is    not a process group leader may detach itself from
  52.          its process group and becomes the process group leader
  53.          of    a new process group by calling either the setpgrp()
  54.          or    setpgrp2() function, which can cause a process to
  55.          become either a session process group leader or a job
  56.          process group leader, respectively.  Job process group
  57.          leaders can exist on implementations which    support    the
  58.          job control option.
  59.  
  60.  
  61.        saved process group ID
  62.          An    active process has a saved process group ID that is
  63.          set to the    saved process group ID of the parent
  64.          process at    the time of creation of    the process (via
  65.          the fork()    function).  It is reset    to the process
  66.          group ID of the process when the process successfully
  67.          calls one of the exec functions.
  68.  
  69.  
  70.        2.10  Symbolic Constants
  71.        Add the following new constant after the    IEEE1003 constant
  72.        defintion:
  73.  
  74.  
  75.        IEEE1003job
  76.          If    this symbol is defined then the    implementation
  77.          supports the job control option.
  78.  
  79. ----------------------------------------------------------------------
  80.  
  81.                                    IEEE
  82.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  83.  
  84.        3.2.1  Wait for Process Termination
  85.        Functions: wait(), wait2()
  86.  
  87.        3.2.1.1    Synopsis
  88.        Add the following at the    end of the section:
  89.  
  90.          #include <sys/wait.h>
  91.          int wait2 (stat_loc, options)
  92.          int *stat_loc;
  93.          int options;
  94.  
  95.        3.2.1.2    Description
  96.        Add the following at the    end of the section:
  97.  
  98.        If the wait2() variant is used, then there are two options
  99.        available for modifying the behavior of the system call.
  100.        They may    be combined by oring them together.  The first is
  101.        WNOHANG which prevents wait2() from suspending the calling
  102.        process even if there are children to wait for.    In this
  103.        case, a value of    zero is    returned indicating there are no
  104.        children    which have stopped or died.  If    the second option
  105.        WUNTRACED is set, wait2() will also return information when
  106.        children    of the current process are stopped because they
  107.        received    a SIGTTIN, SIGTTOU, SIGTSTP, or    SIGSTOP    signal.
  108.  
  109.        The wait2() function is provided    if the implementation
  110.        supports    the job    control    option.
  111.  
  112.        3.2.1.3    Returns
  113.        Add the following at the    end of the section:
  114.  
  115.        If wait2() is called, the WNOHANG option    is used, and there
  116.        are no stopped or terminated children, then a value of zero
  117.        is returned.  Otherwise,    a value    of -1 is returned and errno
  118.        shall be    set to indicate    the error.
  119.  
  120. ----------------------------------------------------------------------
  121.  
  122.                                    IEEE
  123.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  124.  
  125.        In section 3.2.2.2 Description of the _exit function replace
  126.        the paragraph:
  127.  
  128.          If    the process is a process group leader, the SIGHUP
  129.          signal may    be sent    to each    process    that has a process
  130.          group ID equal to that of the calling process.
  131.  
  132.        with:
  133.  
  134.          If    the process is a session process group leader, the
  135.          SIGHUP signal may be sent to each process that has    a
  136.          process group ID equal to that of the calling process;
  137.          also, all such processes may have their process group
  138.          ID    set to zero.
  139.  
  140.          If    the implementation supports the    job control option
  141.          and if the    calling    process    has child processes that
  142.          are stopped, they will be sent SIGHUP and SIGCONT
  143.          signals.
  144.  
  145. ----------------------------------------------------------------------
  146.  
  147.                                    IEEE
  148.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  149.  
  150.        3.3.1  Signal Names
  151.  
  152.        3.3.1.2    Description
  153.        Add the following at the    end of the signals list.
  154.  
  155.        SIGCLD    +   child process terminated
  156.  
  157.        If the implementation supports the job control option then
  158.        the following are defined:
  159.  
  160.        SIGSTOP     #    stop (cannot be caught or    ignored)
  161.        SIGTSTP     #    stop signal generated from keyboard
  162.        SIGTTIN     #    background read attempted    from control terminal
  163.        SIGTTOU     #    background write attempted to control terminal
  164.        SIGCONT     %+   continue after stop
  165.  
  166.       +  Indicates that the    action on SIG_DFL is to    ignore the
  167.          signal, rather than terminate the process.
  168.  
  169.       #  Indicates that the    action on SIG_DFL is to    stop rather
  170.          than terminate the    process.
  171.  
  172.       %  Indicates that the    signal will not    be held    off by a
  173.          stopped process.
  174.  
  175. ----------------------------------------------------------------------
  176.  
  177.                                    IEEE
  178.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  179.  
  180.        In section 3.3.2.2 Description of the kill() function, add
  181.        the following paragraph at the end of the Description
  182.        section.
  183.  
  184.        As a single special case    on implementations that    support    the
  185.        job control option, the continue    signal SIGCONT can be sent
  186.        to any process that is a    descendant of the current process.
  187.  
  188. ----------------------------------------------------------------------
  189.  
  190.                                    IEEE
  191.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  192.  
  193.        3.3.3  Signal Processing
  194.  
  195.        3.3.3.2    Description
  196.        Replace the SIG_DFL and SIG_IGN discussions with    the
  197.        following text.    (Note that this    text needs rewording based
  198.        on the signal working group decisions from Palo Alto, 9/86.
  199.        Bob Lenk    is planning on merging this text with the proposal
  200.        he sends    you.  So you should only have to verify    that he    has
  201.        done this.)
  202.  
  203.        SIG_DFL - signal    specific default action
  204.          For all signals listed in the table in <signal.h>
  205.          3.3.1, unless otherwise indicated the default action
  206.          is    either simple abnormal termination or abnormal
  207.          termination with actions of the receiving process.
  208.          The result    of abnormal termination    with actions is
  209.          implementation-dependent.    Abnormal termination with
  210.          actions may result    in the creation    of a file named
  211.          core in the receiving process's current directory.
  212.          Such a core file should contain sufficient    information
  213.          to    document the state of the process at the time of
  214.          the signal.
  215.  
  216.          For certain indicated signals listed in the table in
  217.          <signal.h>      3.3.1, the default action is to stop
  218.          (suspend) the receiving process.  While a process is
  219.          stopped, any additional signals that are sent to the
  220.          process will be held off until the    process    is
  221.          continued.     An exception to this is SIGCONT which
  222.          always causes the receiving process to continue if    it
  223.          is    stopped.  When a process is continued, pending
  224.          signals will be processed.
  225.  
  226.          For certain indicated signals listed in the table in
  227.          <signal.h>      3.3.1, the default action is to ignore
  228.          the signal.
  229.  
  230.          Signals not described <signal.h>    3.3.1 may have
  231.          other default actions.
  232.  
  233.        SIG_IGN - ignore    signal
  234.          The signal    sig is to be ignored.  The signals SIGKILL
  235.          and SIGSTOP shall not be ignored.    Ignoring SIGCLD    may
  236.          cause terminating children    to be ignored by the wait
  237.          functions     3.2.1.
  238.  
  239.        At the end of the "function address - catch signal"
  240.        discussion, replace the statement:
  241.  
  242.        The signal SIGKILL cannot be caught.
  243.  
  244.        with:
  245.  
  246.        The signals SIGKILL and SIGSTOP cannot be caught.
  247.  
  248.        3.3.3.4    Errors
  249.        Replace:
  250.  
  251.        [EINVAL]    The value sig is either    an illegal signal number or
  252.          SIGKILL.
  253.  
  254.        with:
  255.  
  256.        [EINVAL]    The value sig is either    an illegal signal number,
  257.          or    is equal to SIGKILL or SIGSTOP.
  258.  
  259. ----------------------------------------------------------------------
  260.  
  261.                                    IEEE
  262.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  263.  
  264.        Replace all of section 4.3.1 with:
  265.  
  266.  
  267.  
  268.        4.3.1  Get Process Group    ID
  269.        Functions: getpgrp(), getpgrp2()
  270.  
  271.        4.3.1.1    Synopsis
  272.  
  273.          int getpgrp ( )
  274.  
  275.          int getpgrp2 (pid)
  276.          int pid;
  277.  
  278.        4.3.1.2    Description
  279.        The getpgrp() function returns the process group    ID of the
  280.        calling process.
  281.  
  282.        The getpgrp2() function returns the process group ID of the
  283.        specified process.  If pid is zero, the call applies to the
  284.        current process.     For this to be    allowed, the real or
  285.        effective user ID of the    current    process    must match the real
  286.        or effective user ID of the referenced process, the
  287.        effective user ID of the    current    process    must be    super-user,
  288.        or the referenced process must be a descendant of the
  289.        current process.     The saved set-user ID of the referenced
  290.        process may be checked in place of its effective    user ID.
  291.  
  292.        The getpgrp2() function is provided if the implementation
  293.        supports    the job    control    option.
  294.  
  295.        4.3.1.3    Returns
  296.        The getpgrp() function returns the process group    ID of the
  297.        calling process.
  298.  
  299.        Upon successful completion, the getpgrp2() function returns
  300.        the process group ID of the specified process.  Otherwise a
  301.        value of    -1 is returned and errno is set    to indicate the
  302.        error.
  303.  
  304.        4.3.1.4    Errors
  305.        If the getpgrp2() function returns -1, the value    stored in
  306.        errno may be interpreted    as follows:
  307.  
  308.        [EPERM]       The effective user ID of the    current    process    is
  309.            not super-user, the real or effective user ID of
  310.            the current process does not    match the real or
  311.            effective user ID (or saved set-user    ID) of the
  312.            specified process, and the specified    process    is
  313.            not a descendant of the current process.
  314.  
  315.        [ESRCH]       No process can be found corresponding to that
  316.            specified by    pid.
  317.  
  318.        4.3.1.5    References
  319.        setpgrp()   4.3.2, signal()   3.3.3.
  320.  
  321. ----------------------------------------------------------------------
  322.  
  323.                                    IEEE
  324.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  325.  
  326.        Replace all of section 4.3.2 with:
  327.  
  328.  
  329.  
  330.        4.3.2  Set Process Group
  331.        Functions: setpgrp(), setpgrp2()
  332.  
  333.        4.3.2.1    Synopsis
  334.  
  335.          int setpgrp ( )
  336.  
  337.          int setpgrp2 (pid, pgrp)
  338.          int pid, pgrp;
  339.  
  340.        4.3.2.2    Description
  341.        The setpgrp() function sets the process group ID    of the
  342.        calling process to the process ID of the    calling    process    and
  343.        returns the new process group ID.  The calling process
  344.        becomes a session process group leader.
  345.  
  346.        The setpgrp() function relinquishes the process's
  347.        controlling terminal unless the process is already the
  348.        process group leader.
  349.  
  350.        The setpgrp2() function sets the    process    group ID of the
  351.        process specified by pid    to be pgrp.  If    pid is zero, the
  352.        process group ID    of the calling process will be affected.
  353.        If the affected process's new process group ID is the same
  354.        as its process ID then the affected process becomes a job
  355.        control process group leader.
  356.  
  357.        The setpgrp2() function does not    affect the process's
  358.        controlling terminal.
  359.  
  360.        The setpgrp2() function is provided if the implementation
  361.        supports    the job    control    option.
  362.  
  363.        The following condition must be met for the setpgrp2()
  364.        function    to succeed; otherwise, the error [EINVAL] is
  365.        returned:
  366.  
  367.         The    value of pgrp must be in the range of valid process
  368.         group ID values, or    it must    be zero    ("no process
  369.         group").
  370.  
  371.        In addition, one    or more    of the following conditions must be
  372.        met for the setpgrp2() function to succeed; otherwise, the
  373.        error [EPERM] is    returned:
  374.  
  375.         The    effective user ID of the calling process is super-
  376.         user.
  377.  
  378.         The    affected process is a descendant of the    calling
  379.         process.
  380.  
  381.         The    real or    effective user ID of the calling process
  382.         matches the    real or    effective user ID of the affected
  383.         process.  The saved    set-user ID of the affected process
  384.         may    be checked in place of its effective user ID.
  385.  
  386.        In addition, one    or more    of the following conditions must be
  387.        met for the setpgrp2() function to succeed, otherwise, the
  388.        error [EPERM] is    returned:
  389.  
  390.         The    effective user ID of the calling process is super-
  391.         user.
  392.  
  393.         The    value of pgrp matches the saved    process    group ID of
  394.         the    calling    process.
  395.  
  396.         All    processes with a process ID or process group ID
  397.         that is the    same as    pgrp have the same real    or
  398.         effective user ID as the real or effective user ID of
  399.         the    calling    process, or are    descendants of the calling
  400.         process.  The saved    set-user ID of the related
  401.         processes may be checked in    place of their effective
  402.         user ID.
  403.  
  404.        4.3.2.3    Returns
  405.        The setpgrp() function returns the value    of the new process
  406.        group ID.
  407.  
  408.        Upon successful completion, the setpgrp2() function returns
  409.        a value of 0.  Otherwise, a value of -1 is returned and
  410.        errno is    set to indicate    the error.
  411.  
  412.        4.3.2.4    Errors
  413.        If the setpgrp2() function returns -1, the value    stored in
  414.        errno may be interpreted    as follows:
  415.  
  416.        [ESRCH]       No process can be found corresponding to that
  417.            specified by    pid.
  418.  
  419.        [EPERM]       The effective user ID of the    calling    process    is
  420.            not super-user; and the real    or effective user
  421.            ID of the calling process does not match the
  422.            real    or effective user ID (or saved set-user    ID)
  423.            of the specified process; and the specified
  424.            processes are not descendants of the    calling
  425.            process.
  426.  
  427.        [EPERM]       The effective user ID of the    calling    process    is
  428.            not super-user; and the value pgrp does not
  429.            match the saved process group ID of calling
  430.            process; and    a process exists that is not a
  431.            descendant of the calling process and whose
  432.            process ID or process group ID match    pgrp, while
  433.            neither the real or effective user ID (or saved
  434.            set-user ID)    of this    process    match either the
  435.            real    or effective user ID of    the calling
  436.            process.
  437.  
  438.        [EINVAL]       The value for pgrp is outside the range of valid
  439.            process group ID values and is non-zero.
  440.  
  441.        4.3.2.5    References
  442.        exec   3.1.2, _exit()   3.2.2, fork()   3.1.1, getpid()
  443.        4.1.1, kill()   3.3.2, signal()     3.3.3.
  444.  
  445. ----------------------------------------------------------------------
  446.  
  447.                                    IEEE
  448.        SYSTEM FOR COMPUTER ENVIRONMENTS             Std 1003.1
  449.  
  450.        Alter the forthcoming reliable signals proposal,    the
  451.        sigvector() description,    by adding the following    paragraph:
  452.  
  453.        The sv_flags field can be used to modify    the receipt the
  454.        specified signal.  If sig is SIGCLD and the implementation
  455.        supports    the job    control    option,    the following flag bit can
  456.        be set in sv_flags:
  457.  
  458.       SV_CLDSTOP   Also generate SIGCLD when children stop
  459.  
  460. @EOF
  461.  
  462. chmod 664 acceptedtext
  463.  
  464. echo x - problems
  465. cat >problems <<'@EOF'
  466. There are two omissions in the job control specification that
  467. have come to light since it was accepted at the P1003 meeting
  468. in Palo Alto.  There will be forthcoming proposals to correct
  469. these.
  470.  
  471. Omission 1:
  472.  
  473. Bob Lenk noticed that, in adding SIGCLD to the required portion of
  474. POSIX, we neglected to deal with the issue of what happens when
  475. SIGCLD is set to SIG_IGN.  Specifically, on ATT this causes 
  476. terminated children to be invisible to wait*() while on BSD there
  477. is no such side effect.  Bob Lenk feels the best way to handle this
  478. is to disallow conforming applications from setting SIGCLD to SIG_IGN.
  479. (There is no advantage to using SIG_IGN over SIG_DFL in the case
  480. of SIGCLD anyway.)  Bob is planning on submitting a cleanup proposal
  481. proposing this.
  482.  
  483. Omission 2:
  484.  
  485. Doug Gwyn pointed out the following omission:
  486.  
  487. The changes to section 3.2.1.2 for wait2() did not contain a
  488. description of the returned status information in the case
  489. of stopped children.
  490.  
  491. I've submitted a proposal to add the following additional text:
  492.  
  493. [OLD TEXT FOR CONTEXT:]
  494.  
  495. wait2() will also return information when children of the
  496. current process are stopped because they received a SIGTTIN,
  497. SIGTTOU, SIGTSTP, or SIGSTOP signal.
  498.  
  499. [NEW TEXT:]
  500.  
  501. In this case, the status information can also be interpreted
  502. in the following way:
  503.  
  504.     If the child process stopped, the 8 bits of status
  505.     (corresponding to the octal value 0177400) will contain
  506.     the number of the signal that caused the process to
  507.     stop and the low order 8 bits corresponding to the
  508.     octal value 0377 will be set equal to the octal value
  509.     0177.
  510. @EOF
  511.  
  512. chmod 664 problems
  513.  
  514. exit 0
  515.  
  516.  
  517. Volume-Number: Volume 7, Number 53
  518.  
  519.