On Thu, Apr 07, 2022 at 06:11:45PM -0500, Matthew Martin wrote:
> const the termp and winp arguments for openpty and related. This matches
> the prototypes for openpty and forkpty in glibc and musl libc.

ping; has an ok from tb@ [1]

1: https://marc.info/?l=openbsd-tech&m=164986161215132&w=2

diff --git openpty.3 openpty.3
index e0c82e00c53..080d92d8ced 100644
--- openpty.3
+++ openpty.3
@@ -47,15 +47,15 @@
 .Ft int
 .Fn getptmfd "void"
 .Ft int
-.Fn openpty "int *amaster" "int *aslave" "char *name" "struct termios *termp" 
"struct winsize *winp"
+.Fn openpty "int *amaster" "int *aslave" "char *name" "const struct termios 
*termp" "const struct winsize *winp"
 .Ft int
-.Fn fdopenpty "int ptmfd" "int *amaster" "int *aslave" "char *name" "struct 
termios *termp" "struct winsize *winp"
+.Fn fdopenpty "int ptmfd" "int *amaster" "int *aslave" "char *name" "const 
struct termios *termp" "const struct winsize *winp"
 .Ft int
 .Fn login_tty "int fd"
 .Ft pid_t
-.Fn forkpty "int *amaster" "char *name" "struct termios *termp" "struct 
winsize *winp"
+.Fn forkpty "int *amaster" "char *name" "const struct termios *termp" "const 
struct winsize *winp"
 .Ft pid_t
-.Fn fdforkpty "int ptmfd" "int *amaster" "char *name" "struct termios *termp" 
"struct winsize *winp"
+.Fn fdforkpty "int ptmfd" "int *amaster" "char *name" "const struct termios 
*termp" "const struct winsize *winp"
 .Sh DESCRIPTION
 The
 .Fn openpty ,
diff --git pty.c pty.c
index c796acb5041..d59f863ff2d 100644
--- pty.c
+++ pty.c
@@ -50,8 +50,8 @@ getptmfd(void)
 }
 
 int
-openpty(int *amaster, int *aslave, char *name, struct termios *termp,
-    struct winsize *winp)
+openpty(int *amaster, int *aslave, char *name, const struct termios *termp,
+    const struct winsize *winp)
 {
        int ptmfd;
 
@@ -67,7 +67,7 @@ openpty(int *amaster, int *aslave, char *name, struct termios 
*termp,
 
 int
 fdopenpty(int ptmfd, int *amaster, int *aslave, char *name,
-    struct termios *termp, struct winsize *winp)
+    const struct termios *termp, const struct winsize *winp)
 {
        int master, slave;
        struct ptmget ptm;
@@ -97,7 +97,8 @@ fdopenpty(int ptmfd, int *amaster, int *aslave, char *name,
 }
 
 pid_t
-forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
+forkpty(int *amaster, char *name, const struct termios *termp,
+    const struct winsize *winp)
 {
        int ptmfd;
        pid_t pid;
@@ -113,8 +114,8 @@ forkpty(int *amaster, char *name, struct termios *termp, 
struct winsize *winp)
 }
 
 pid_t
-fdforkpty(int ptmfd, int *amaster, char *name, struct termios *termp,
-    struct winsize *winp)
+fdforkpty(int ptmfd, int *amaster, char *name, const struct termios *termp,
+    const struct winsize *winp)
 {
        int master, slave;
        pid_t pid;
diff --git util.h util.h
index d7aa8faed4b..ecae5819e53 100644
--- util.h
+++ util.h
@@ -99,12 +99,14 @@ void        pw_copy(int, int, const struct passwd *, const 
struct passwd *);
 int    pw_scan(char *, struct passwd *, int *);
 void   pw_error(const char *, int, int);
 int    getptmfd(void);
-int    openpty(int *, int *, char *, struct termios *, struct winsize *);
-int    fdopenpty(int, int *, int *, char *, struct termios *,
-           struct winsize *);
+int    openpty(int *, int *, char *, const struct termios *,
+           const struct winsize *);
+int    fdopenpty(int, int *, int *, char *, const struct termios *,
+           const struct winsize *);
 int    opendisk(const char *, int, char *, size_t, int);
-pid_t  forkpty(int *, char *, struct termios *, struct winsize *);
-pid_t  fdforkpty(int, int *, char *, struct termios *, struct winsize *);
+pid_t  forkpty(int *, char *, const struct termios *, const struct winsize *);
+pid_t  fdforkpty(int, int *, char *, const struct termios *,
+           const struct winsize *);
 int    getmaxpartitions(void);
 int    getrawpartition(void);
 void   login_fbtab(const char *, uid_t, gid_t);

Reply via email to