This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: make openpty's termp and winp parameters const?


Roland McGrath, le Mon 17 Dec 2007 04:28:23 -0800, a écrit :
> Sounds fine.  Send a patch.

Here it is.

2007-12-17  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* login/forkpty.c (forkpty): Add const qualifier to parameters termp
	and winp.
	* login/openpty.c (openpty): Likewise.
	* login/pty.h (openpty, forkpty): Likewise.
	* manual/terminal.texi (openpty, forkpty): Likewise

Index: login/forkpty.c
===================================================================
RCS file: /cvs/glibc/libc/login/forkpty.c,v
retrieving revision 1.3
diff -u -r1.3 forkpty.c
--- login/forkpty.c	20 Jul 2007 07:20:07 -0000	1.3
+++ login/forkpty.c	17 Dec 2007 21:00:34 -0000
@@ -27,8 +27,8 @@
 forkpty (amaster, name, termp, winp)
      int *amaster;
      char *name;
-     struct termios *termp;
-     struct winsize *winp;
+     const struct termios *termp;
+     const struct winsize *winp;
 {
   int master, slave, pid;
 
Index: login/openpty.c
===================================================================
RCS file: /cvs/glibc/libc/login/openpty.c,v
retrieving revision 1.7
diff -u -r1.7 openpty.c
--- login/openpty.c	26 Oct 2004 02:36:47 -0000	1.7
+++ login/openpty.c	17 Dec 2007 21:00:34 -0000
@@ -84,8 +84,8 @@
    according to TERMP and WINP.  Return handles for both ends in
    AMASTER and ASLAVE, and return the name of the slave end in NAME.  */
 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)
 {
 #ifdef PATH_MAX
   char _buf[PATH_MAX];
Index: login/pty.h
===================================================================
RCS file: /cvs/glibc/libc/login/pty.h,v
retrieving revision 1.7
diff -u -r1.7 pty.h
--- login/pty.h	6 Jul 2001 04:55:34 -0000	1.7
+++ login/pty.h	17 Dec 2007 21:00:34 -0000
@@ -32,12 +32,14 @@
    attributes according to TERMP and WINP and return handles for both
    ends in AMASTER and ASLAVE.  */
 extern int openpty (int *__amaster, int *__aslave, char *__name,
-		    struct termios *__termp, struct winsize *__winp) __THROW;
+		    const struct termios *__termp,
+		    const struct winsize *__winp) __THROW;
 
 /* Create child process and establish the slave pseudo terminal as the
    child's controlling terminal.  */
 extern int forkpty (int *__amaster, char *__name,
-		    struct termios *__termp, struct winsize *__winp) __THROW;
+		    const struct termios *__termp,
+		    const struct winsize *__winp) __THROW;
 
 __END_DECLS
 
Index: manual/terminal.texi
===================================================================
RCS file: /cvs/glibc/libc/manual/terminal.texi,v
retrieving revision 1.65
diff -u -r1.65 terminal.texi
--- manual/terminal.texi	1 Mar 2003 01:11:08 -0000	1.65
+++ manual/terminal.texi	17 Dec 2007 21:00:34 -0000
@@ -2075,7 +2075,7 @@
 
 @comment pty.h
 @comment BSD
-@deftypefun int openpty (int *@var{amaster}, int *@var{aslave}, char *@var{name}, struct termios *@var{termp}, struct winsize *@var{winp})
+@deftypefun int openpty (int *@var{amaster}, int *@var{aslave}, char *@var{name}, const struct termios *@var{termp}, const struct winsize *@var{winp})
 This function allocates and opens a pseudo-terminal pair, returning the
 file descriptor for the master in @var{*amaster}, and the file
 descriptor for the slave in @var{*aslave}.  If the argument @var{name}
@@ -2106,7 +2106,7 @@
 
 @comment pty.h
 @comment BSD
-@deftypefun int forkpty (int *@var{amaster}, char *@var{name}, struct termios *@var{termp}, struct winsize *@var{winp})
+@deftypefun int forkpty (int *@var{amaster}, char *@var{name}, const struct termios *@var{termp}, const struct winsize *@var{winp})
 This function is similar to the @code{openpty} function, but in
 addition, forks a new process (@pxref{Creating a Process}) and makes the
 newly opened slave pseudo-terminal device the controlling terminal


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]