xref: /illumos-gate/usr/src/lib/libc/port/sys/pgrpsys.c (revision 86d949f9497332fe19be6b5d711d265eb957439f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma weak _getpgrp = getpgrp
28 #pragma weak _setpgrp = setpgrp
29 #pragma weak _getsid = getsid
30 #pragma weak _setsid = setsid
31 #pragma weak _getpgid = getpgid
32 #pragma weak _setpgid = setpgid
33 
34 #include "lint.h"
35 #include <sys/types.h>
36 #include <unistd.h>
37 #include <sys/syscall.h>
38 
39 pid_t
40 getpgrp(void)
41 {
42 	return ((pid_t)syscall(SYS_pgrpsys, 0));
43 }
44 
45 pid_t
46 setpgrp(void)
47 {
48 	return ((pid_t)syscall(SYS_pgrpsys, 1));
49 }
50 
51 pid_t
52 getsid(pid_t pid)
53 {
54 	return ((pid_t)syscall(SYS_pgrpsys, 2, pid));
55 }
56 
57 pid_t
58 setsid(void)
59 {
60 	return ((pid_t)syscall(SYS_pgrpsys, 3));
61 }
62 
63 pid_t
64 getpgid(pid_t pid)
65 {
66 	return ((pid_t)syscall(SYS_pgrpsys, 4, pid));
67 }
68 
69 int
70 setpgid(pid_t pid, pid_t pgid)
71 {
72 	return (syscall(SYS_pgrpsys, 5, pid, pgid));
73 }
74