xref: /illumos-gate/usr/src/lib/libc/port/sys/pgrpsys.c (revision e8d3efa1c56e5f2b5368600a2baeb7b1d54a07f8)
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 /*
28  * Copyright 2026 Oxide Computer Company
29  */
30 
31 #pragma weak _getpgrp = getpgrp
32 #pragma weak _setpgrp = setpgrp
33 #pragma weak _getsid = getsid
34 #pragma weak _setsid = setsid
35 #pragma weak _getpgid = getpgid
36 #pragma weak _setpgid = setpgid
37 
38 #include "lint.h"
39 #include <sys/types.h>
40 #include <unistd.h>
41 #include <sys/syscall.h>
42 #include <sys/pgrpsys.h>
43 
44 pid_t
45 getpgrp(void)
46 {
47 	return ((pid_t)syscall(SYS_pgrpsys, PGRPSYS_GETPGRP));
48 }
49 
50 pid_t
51 setpgrp(void)
52 {
53 	return ((pid_t)syscall(SYS_pgrpsys, PGRPSYS_SETPGRP));
54 }
55 
56 pid_t
57 getsid(pid_t pid)
58 {
59 	return ((pid_t)syscall(SYS_pgrpsys, PGRPSYS_GETSID, pid));
60 }
61 
62 pid_t
63 setsid(void)
64 {
65 	return ((pid_t)syscall(SYS_pgrpsys, PGRPSYS_SETSID));
66 }
67 
68 pid_t
69 getpgid(pid_t pid)
70 {
71 	return ((pid_t)syscall(SYS_pgrpsys, PGRPSYS_GETPGID, pid));
72 }
73 
74 int
75 setpgid(pid_t pid, pid_t pgid)
76 {
77 	return (syscall(SYS_pgrpsys, PGRPSYS_SETPGID, pid, pgid));
78 }
79