1*61185Sbostic.\" Copyright (c) 1980, 1991, 1993 2*61185Sbostic.\" The Regents of the University of California. All rights reserved. 320126Smckusick.\" 447208Scael.\" %sccs.include.redist.man% 520126Smckusick.\" 6*61185Sbostic.\" @(#)setpgid.2 8.1 (Berkeley) 06/04/93 747208Scael.\" 847208Scael.Dd 947208Scael.Dt SETPGID 2 1047208Scael.Os BSD 4 1147208Scael.Sh NAME 1247208Scael.Nm setpgid , 1347208Scael.Nm setpgrp 1447208Scael.Nd set process group 1547208Scael.Sh SYNOPSIS 1647208Scael.Fd #include <unistd.h> 1747208Scael.Ft int 1847208Scael.Fn setpgid pid_tpid pid_tpgrp 1947208Scael.Ft int 2047208Scael.Fn setpgrp pid_tpid pid_tpgrp 2147208Scael.Sh DESCRIPTION 2247208Scael.Fn Setpgid 2320126Smckusicksets the process group of the specified process 2447208Scael.Ar pid 2520126Smckusickto the specified 2647208Scael.Ar pgrp . 2720126SmckusickIf 2847208Scael.Ar pid 2920126Smckusickis zero, then the call applies to the current process. 3047208Scael.Pp 3120126SmckusickIf the invoker is not the super-user, then the affected process 3220126Smckusickmust have the same effective user-id as the invoker or be a descendant 3320126Smckusickof the invoking process. 3447208Scael.Sh RETURN VALUES 3547208Scael.Fn Setpgid 3646470Sbosticreturns 0 when the operation was successful. 3747208ScaelIf the request failed, -1 is returned and the global variable 3847208Scael.Va errno 3920127Smckusickindicates the reason. 4047208Scael.Sh ERRORS 4147208Scael.Fn Setpgid 4247208Scaelwill fail and the process group will not be altered if: 4347208Scael.Bl -tag -width indent 4447208Scael.It Bq Er ESRCH 4520127SmckusickThe requested process does not exist. 4647208Scael.It Bq Er EPERM 4720127SmckusickThe effective user ID of the requested process is different 4820127Smckusickfrom that of the caller and the process is not a descendent 4920127Smckusickof the calling process. 5047208Scael.El 5147208Scael.Sh SEE ALSO 5247208Scael.Xr getpgrp 2 5347208Scael.Sh STANDARDS 5447208Scael.Fn Setpgid 5547208Scaelconforms to IEEE Std 1003.1-1988 5647208Scael.Pq Dq Tn POSIX . 5747208Scael.Sh COMPATIBILITY 5847208Scael.Fn Setpgrp 5946470Sbosticis identical to 6047208Scael.Fn setpgid , 6146470Sbosticand is retained for calling convention compatibility with historical 6247208Scaelversions of 6347208Scael.Bx . 64