Skip to content

Commit 78fa49e

Browse files
committed
Make the termp and winp arguments for openpty, et al. const.
This matches the prototypes in glibc and musl libc. From Matthew Martin. OK tb@
1 parent c1e0a7d commit 78fa49e

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

lib/libutil/openpty.3

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $OpenBSD: openpty.3,v 1.19 2017/04/20 19:30:42 jmc Exp $
1+
.\" $OpenBSD: openpty.3,v 1.20 2022/04/20 14:00:19 millert Exp $
22
.\" Copyright (c) 1995
33
.\" The Regents of the University of California. All rights reserved.
44
.\"
@@ -30,7 +30,7 @@
3030
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3131
.\" SUCH DAMAGE.
3232
.\"
33-
.Dd $Mdocdate: April 20 2017 $
33+
.Dd $Mdocdate: April 20 2022 $
3434
.Dt OPENPTY 3
3535
.Os
3636
.Sh NAME
@@ -47,15 +47,15 @@
4747
.Ft int
4848
.Fn getptmfd "void"
4949
.Ft int
50-
.Fn openpty "int *amaster" "int *aslave" "char *name" "struct termios *termp" "struct winsize *winp"
50+
.Fn openpty "int *amaster" "int *aslave" "char *name" "const struct termios *termp" "const struct winsize *winp"
5151
.Ft int
52-
.Fn fdopenpty "int ptmfd" "int *amaster" "int *aslave" "char *name" "struct termios *termp" "struct winsize *winp"
52+
.Fn fdopenpty "int ptmfd" "int *amaster" "int *aslave" "char *name" "const struct termios *termp" "const struct winsize *winp"
5353
.Ft int
5454
.Fn login_tty "int fd"
5555
.Ft pid_t
56-
.Fn forkpty "int *amaster" "char *name" "struct termios *termp" "struct winsize *winp"
56+
.Fn forkpty "int *amaster" "char *name" "const struct termios *termp" "const struct winsize *winp"
5757
.Ft pid_t
58-
.Fn fdforkpty "int ptmfd" "int *amaster" "char *name" "struct termios *termp" "struct winsize *winp"
58+
.Fn fdforkpty "int ptmfd" "int *amaster" "char *name" "const struct termios *termp" "const struct winsize *winp"
5959
.Sh DESCRIPTION
6060
The
6161
.Fn openpty ,

lib/libutil/pty.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: pty.c,v 1.21 2017/04/20 17:48:30 nicm Exp $ */
1+
/* $OpenBSD: pty.c,v 1.22 2022/04/20 14:00:19 millert Exp $ */
22

33
/*-
44
* Copyright (c) 1990, 1993
@@ -50,8 +50,8 @@ getptmfd(void)
5050
}
5151

5252
int
53-
openpty(int *amaster, int *aslave, char *name, struct termios *termp,
54-
struct winsize *winp)
53+
openpty(int *amaster, int *aslave, char *name, const struct termios *termp,
54+
const struct winsize *winp)
5555
{
5656
int ptmfd;
5757

@@ -67,7 +67,7 @@ openpty(int *amaster, int *aslave, char *name, struct termios *termp,
6767

6868
int
6969
fdopenpty(int ptmfd, int *amaster, int *aslave, char *name,
70-
struct termios *termp, struct winsize *winp)
70+
const struct termios *termp, const struct winsize *winp)
7171
{
7272
int master, slave;
7373
struct ptmget ptm;
@@ -97,7 +97,8 @@ fdopenpty(int ptmfd, int *amaster, int *aslave, char *name,
9797
}
9898

9999
pid_t
100-
forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
100+
forkpty(int *amaster, char *name, const struct termios *termp,
101+
const struct winsize *winp)
101102
{
102103
int ptmfd;
103104
pid_t pid;
@@ -113,8 +114,8 @@ forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
113114
}
114115

115116
pid_t
116-
fdforkpty(int ptmfd, int *amaster, char *name, struct termios *termp,
117-
struct winsize *winp)
117+
fdforkpty(int ptmfd, int *amaster, char *name, const struct termios *termp,
118+
const struct winsize *winp)
118119
{
119120
int master, slave;
120121
pid_t pid;

lib/libutil/util.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: util.h,v 1.36 2019/08/30 03:57:56 deraadt Exp $ */
1+
/* $OpenBSD: util.h,v 1.37 2022/04/20 14:00:19 millert Exp $ */
22
/* $NetBSD: util.h,v 1.2 1996/05/16 07:00:22 thorpej Exp $ */
33

44
/*-
@@ -99,12 +99,14 @@ void pw_copy(int, int, const struct passwd *, const struct passwd *);
9999
int pw_scan(char *, struct passwd *, int *);
100100
void pw_error(const char *, int, int);
101101
int getptmfd(void);
102-
int openpty(int *, int *, char *, struct termios *, struct winsize *);
103-
int fdopenpty(int, int *, int *, char *, struct termios *,
104-
struct winsize *);
102+
int openpty(int *, int *, char *, const struct termios *,
103+
const struct winsize *);
104+
int fdopenpty(int, int *, int *, char *, const struct termios *,
105+
const struct winsize *);
105106
int opendisk(const char *, int, char *, size_t, int);
106-
pid_t forkpty(int *, char *, struct termios *, struct winsize *);
107-
pid_t fdforkpty(int, int *, char *, struct termios *, struct winsize *);
107+
pid_t forkpty(int *, char *, const struct termios *, const struct winsize *);
108+
pid_t fdforkpty(int, int *, char *, const struct termios *,
109+
const struct winsize *);
108110
int getmaxpartitions(void);
109111
int getrawpartition(void);
110112
void login_fbtab(const char *, uid_t, gid_t);

0 commit comments

Comments
 (0)