From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1921) id C7839385414D; Mon, 11 Jul 2022 11:53:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7839385414D Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Add tcgetwinsize(3) and tcsetwinsize(3) to termios X-Act-Checkin: newlib-cygwin X-Git-Author: Konstantin Belousov X-Git-Refname: refs/heads/master X-Git-Oldrev: c76896074b31125c69534e25754646c3655c2187 X-Git-Newrev: 581bde91a58289cfad8dec328c00283baa0a92e2 Message-Id: <20220711115339.C7839385414D@sourceware.org> Date: Mon, 11 Jul 2022 11:53:39 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2022 11:53:39 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D581bde91a58= 289cfad8dec328c00283baa0a92e2 commit 581bde91a58289cfad8dec328c00283baa0a92e2 Author: Konstantin Belousov Date: Fri Dec 25 01:05:31 2020 +0200 Add tcgetwinsize(3) and tcsetwinsize(3) to termios =20 These functions get/set tty winsize respectively, and are trivial wrapp= ers around corresponding termio ioctls. =20 The functions are expected to be a part of POSIX.1 issue 8: https://www.austingroupbugs.net/view.php?id=3D1151#c3856. They are currently available in NetBSD and in musl libc. =20 PR: 251868 Submitted by: Soumendra Ganguly MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27650 Diff: --- newlib/libc/sys/rtems/include/sys/_winsize.h | 49 ++++++++++++++++++++++++= ++++ newlib/libc/sys/rtems/include/sys/ttycom.h | 12 +------ newlib/libc/sys/rtems/include/termios.h | 6 ++++ 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/newlib/libc/sys/rtems/include/sys/_winsize.h b/newlib/libc/sys= /rtems/include/sys/_winsize.h new file mode 100644 index 000000000..78d0b8a6e --- /dev/null +++ b/newlib/libc/sys/rtems/include/sys/_winsize.h @@ -0,0 +1,49 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1988, 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP= OSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT= IAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR= ICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 + * $FreeBSD$ + */ + +#ifndef _SYS__WINSIZE_H_ +#define _SYS__WINSIZE_H_ + +/* + * Window/terminal size structure. This information is stored by the kern= el + * in order to provide a consistent interface, but is not used by the kern= el. + */ +struct winsize { + unsigned short ws_row; /* rows, in characters */ + unsigned short ws_col; /* columns, in characters */ + unsigned short ws_xpixel; /* horizontal size, pixels */ + unsigned short ws_ypixel; /* vertical size, pixels */ +}; + +#endif /* !_SYS__WINSIZE_H_ */ diff --git a/newlib/libc/sys/rtems/include/sys/ttycom.h b/newlib/libc/sys/r= tems/include/sys/ttycom.h index 5aabb074a..a7309d4c5 100644 --- a/newlib/libc/sys/rtems/include/sys/ttycom.h +++ b/newlib/libc/sys/rtems/include/sys/ttycom.h @@ -41,23 +41,13 @@ #define _SYS_TTYCOM_H_ =20 #include +#include =20 /* * Tty ioctl's except for those supported only for backwards compatibility * with the old tty driver. */ =20 -/* - * Window/terminal size structure. This information is stored by the kern= el - * in order to provide a consistent interface, but is not used by the kern= el. - */ -struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels */ - unsigned short ws_ypixel; /* vertical size, pixels */ -}; - /* 0-2 compat */ /* 3-7 unused */ /* 8-10 compat */ diff --git a/newlib/libc/sys/rtems/include/termios.h b/newlib/libc/sys/rtem= s/include/termios.h index ce31d447f..9b808329a 100644 --- a/newlib/libc/sys/rtems/include/termios.h +++ b/newlib/libc/sys/rtems/include/termios.h @@ -38,6 +38,9 @@ #include #include #include +#if __BSD_VISIBLE +#include +#endif =20 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; @@ -92,6 +95,9 @@ int tcsetsid(int, pid_t); void cfmakeraw(struct termios *); void cfmakesane(struct termios *); int cfsetspeed(struct termios *, speed_t); + +int tcgetwinsize(int, struct winsize *); +int tcsetwinsize(int, const struct winsize *); #endif __END_DECLS