📄 setpgid.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>setpgid</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_008_447"> </a>NAME</h4><blockquote>setpgid - set process group ID for job control</blockquote><h4><a name = "tag_000_008_448"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="systypes.h.html">sys/types.h</a>>#include <<a href="unistd.h.html">unistd.h</a>>int setpgid(pid_t <i>pid</i>, pid_t <i>pgid</i>);</code></pre></blockquote><h4><a name = "tag_000_008_449"> </a>DESCRIPTION</h4><blockquote>The<i>setpgid()</i>function is used either to join an existing process group orcreate a new process group within the session of the callingprocess.The process group ID of a session leader will not change.Upon successful completion, the process group ID of the processwith a process ID that matches<i>pid</i>will be set to<i>pgid</i>.As a special case, if<i>pid</i>is 0, the process ID of the calling process will be used. Also, if<i>pgid</i>is 0, the process group ID of the indicated process will be used.</blockquote><h4><a name = "tag_000_008_450"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>setpgid()</i>returns 0. Otherwise -1 is returned and<i>errno</i>is set to indicate the error.</blockquote><h4><a name = "tag_000_008_451"> </a>ERRORS</h4><blockquote>The<i>setpgid()</i>function will fail if:<dl compact><dt>[EACCES]<dd>The value of the<i>pid</i>argument matches the process ID of a child process of the callingprocess and the child process has successfully executedone of the<i>exec</i>functions.<dt>[EINVAL]<dd>The value of the<i>pgid</i>argument is less than 0, or is not a valuesupported by the implementation.<dt>[EPERM]<dd>The process indicated by the<i>pid</i>argument is a session leader.The value of the<i>pid</i>argument matches the process ID of a child process of the callingprocess and the child process is not in the same session as thecalling process.The value of the<i>pgid</i>argument is valid but does not match the process ID of theprocess indicated by the<i>pid</i>argument and there is no process with a process group ID thatmatches the value of the<i>pgid</i>argument in the same session as the calling process.<dt>[ESRCH]<dd>The value of the<i>pid</i>argument does not match the process ID of the callingprocess or of a child process of the calling process.</dl></blockquote><h4><a name = "tag_000_008_452"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_453"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_454"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_455"> </a>SEE ALSO</h4><blockquote><i><a href="exec.html">exec</a></i>,<i><a href="getpgrp.html">getpgrp()</a></i>,<i><a href="setsid.html">setsid()</a></i>,<i><a href="tcsetpgrp.html">tcsetpgrp()</a></i>,<i><a href="systypes.h.html"><sys/types.h></a></i>,<i><a href="unistd.h.html"><unistd.h></a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from the POSIX.1-1988 standard.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -