From patchwork Mon Oct 15 20:49:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 148887 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4251452lji; Mon, 15 Oct 2018 13:50:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV62af5sUHwhTzfaL/3pb3q8lsbW306naiDUJX7GsNh8fnahaHReWr1UqatzADtvqOCnpz5U5 X-Received: by 2002:a62:aa17:: with SMTP id e23-v6mr19183106pff.211.1539636627877; Mon, 15 Oct 2018 13:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539636627; cv=none; d=google.com; s=arc-20160816; b=DshZL9bsE1z9RTJt7mWWvzAgeSJZa0W+jWi0Vts/G3HL6c5hbmYnZDEA5Txx0X1d+Q Wz/YNdjl7YqTpf08wwsehcrEa+0bSiSgWoh+OIeAERt0Bqnbky20lbVSDPTNcMYhm4x6 KLVR3xSLuCfw14PXDdbF/su9PI+gM5SWirj6jvdgoBfDxVkyFsqzsOzy1yr3D4xJTadj +wPr0SCf6IeOtV7e0lOS59iuDOdGaIHkslU/nbbWJfl2OTf63sIQOV9OQpoUymwHIIeb ck1CWKLz+HttRIaSk51kwrjbkCvqqn1oisv3MpajS02dCmB465Tt8qd1Gd1OQj4vQEl4 pOxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=9lHgxBA5eGG9tFrI2HfuCpBK28+k1wTpuDImcllQC5A=; b=W+eY/hY4vCJVozqEg7TQKhmyneLpQN2TCtZEDfJF1PUnfjBBymG60Es7u/lh3b9klt Rdx9DGG+R5wXrWjlZ/09rZpPe786eQIGDidZjYll4h1Tw2u0vAxZi2yBwIssdOOYalbL uhB/tTGJ0Ausvhj209lGy1wdrtbmMJ7PZLUkHp7ztgqzDHy0E9WrqgpE7a9Tx5j9awyp 8DkSaaRQQ5uswh/6q8pEMKXqIsXCgQdq4C9dRmPXctIf4aRtLYvUGajQGe1JAV2PP0uw L//jwxBmzBtpsbLxNMQlCOAGsdhtgRRvL0zmzQUHL/UFaasOyxIq1c0f7bpnQzAgjpGk b7Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=JLeVCU4t; dkim=pass header.i=@linaro.org header.s=google header.b=f4bc5Yjv; spf=pass (google.com: domain of libc-alpha-return-96437-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-96437-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y76-v6si12418137pfd.254.2018.10.15.13.50.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 13:50:27 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-96437-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=JLeVCU4t; dkim=pass header.i=@linaro.org header.s=google header.b=f4bc5Yjv; spf=pass (google.com: domain of libc-alpha-return-96437-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-96437-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=S8K1+H+NdsVkdED5MsXPlZIfabTKPEI W6TlUQenQOH+c+G+QUt3EYfzADLoTPIj/RgdIEtWIsRrIDHegBxkUb4xLmcAA4O4 hWC/tJPJy+ZmE3ubTLrSfz4zuCkQ5RKWV76b284YCe/lgsaDg2TLkA7/0MKrtyJQ aGiqyObdA5Lo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=pnQD1/R+1zoJA3X4kHT4ucd9a/I=; b=JLeVC U4t7q02+PfqsRpgYiCj34Rkpgt0EuZOnJb6hZKeKiLILJBGhbhA/bZOLx7+l0hEq RTalYNAhbaOYElbFGZjOlCkDbd2EGPd44Z4VHb5wcfxXBe6SyHUvBvEeKGw3RmEd GgRKBl++1agXLQ+0eOl2JZzyOr6LKfdoMS7lgo= Received: (qmail 15051 invoked by alias); 15 Oct 2018 20:50:15 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 14353 invoked by uid 89); 15 Oct 2018 20:50:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:optiona, consolidate, Consolidate, discipline X-HELO: mail-qt1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9lHgxBA5eGG9tFrI2HfuCpBK28+k1wTpuDImcllQC5A=; b=f4bc5YjvKnZ+C+boMSOJeHqvxd4MMsfhADMG64KO2pv9X70xh+CF21gSU10WXiH9/K KHsEopZf3KvCxTluffTPv2khg2Rvyf1alxSKP5tHbhWdKqLVNVlfLXDsbpR08+N0ql/a gMrSgSZE6s+FZI8TDrbWRKgrKMUxXsrnYbK/k= Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: hpa@zytor.com Subject: [PATCH 02/12] termios: Consolidate struct termios Date: Mon, 15 Oct 2018 17:49:46 -0300 Message-Id: <20181015204956.25558-2-adhemerval.zanella@linaro.org> In-Reply-To: <20181015204956.25558-1-adhemerval.zanella@linaro.org> References: <20181015204956.25558-1-adhemerval.zanella@linaro.org> This patch consolidates the struct termios definition on its own header and adds arch-defined ones for ABIs that deviate from generic implementation. They are: - alpha which has a slight different layout than generic one (c_cc field is defined prior c_line). - sparc and mips which do not have the c_ispeed/c_ospeed fields. No semantic change is expected, checked on a build against x86_64-linux-gnu, alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. * sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h: New file. * sysdeps/unix/sysv/linux/bits/termios-struct.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/termios-struct.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h: Likewise. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add termios-struct.h. * sysdeps/unix/sysv/linux/bits/termios.h (struct termios): Move to termios-struct.h. * sysdeps/unix/sysv/linux/alpha/bits/termios.h (struct termios): Likewise. * sysdeps/unix/sysv/linux/mips/bits/termios.h (struct termios): Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h (struct termios): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h (struct termios): Likewise. * sysdeps/unix/sysv/linux/kernel_termios.h (_HAVE_C_ISPEED, _HAVE_C_OSPEED): Define. * sysdeps/unix/sysv/linux/mips/kernel_termios.h (_HAVE_C_ISPEED, _HAVE_C_OSPEED): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel_termios.h (_HAVE_C_ISPEED, _HAVE_C_OSPEED): Likewise. * sysdeps/unix/sysv/linux/speed.c [_HAVE_STRUCT_TERMIOS_C_OSPEED] (cfsetospeed): Check for define value instead of existence. [_HAVE_STRUCT_TERMIOS_C_ISPEED] (cfsetispeed): Likewise. * sysdeps/unix/sysv/linux/tcgetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED && _HAVE_C_ISPEED] (__tcgetattr): Likewise. * sysdeps/unix/sysv/linux/tcsetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED && _HAVE_C_ISPEED] (__tcsetattr): Likewise. --- sysdeps/unix/sysv/linux/Makefile | 2 +- .../sysv/linux/alpha/bits/termios-struct.h | 37 +++++++++++++++++++ sysdeps/unix/sysv/linux/alpha/bits/termios.h | 15 +------- sysdeps/unix/sysv/linux/bits/termios-struct.h | 36 ++++++++++++++++++ sysdeps/unix/sysv/linux/bits/termios.h | 15 +------- sysdeps/unix/sysv/linux/kernel_termios.h | 3 ++ .../sysv/linux/mips/bits/termios-struct.h | 34 +++++++++++++++++ sysdeps/unix/sysv/linux/mips/bits/termios.h | 11 +----- sysdeps/unix/sysv/linux/mips/kernel_termios.h | 3 ++ .../unix/sysv/linux/powerpc/bits/termios.h | 20 +--------- .../sysv/linux/sparc/bits/termios-struct.h | 34 +++++++++++++++++ sysdeps/unix/sysv/linux/sparc/bits/termios.h | 11 +----- .../unix/sysv/linux/sparc/kernel_termios.h | 3 ++ sysdeps/unix/sysv/linux/speed.c | 4 +- sysdeps/unix/sysv/linux/tcgetattr.c | 8 ++-- sysdeps/unix/sysv/linux/tcsetattr.c | 4 +- 16 files changed, 164 insertions(+), 76 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h create mode 100644 sysdeps/unix/sysv/linux/bits/termios-struct.h create mode 100644 sysdeps/unix/sysv/linux/mips/bits/termios-struct.h create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index ff4535cdca..184a5b19e1 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -43,7 +43,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ bits/siginfo-arch.h bits/siginfo-consts-arch.h \ bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \ bits/procfs-prregset.h bits/mman-map-flags-generic.h \ - bits/msq-pad.h + bits/msq-pad.h bits/termios-struct.h tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \ diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h new file mode 100644 index 0000000000..268988c1a4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h @@ -0,0 +1,37 @@ +/* struct termios definition. Linux/alpha version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* Alpha has C_CC before C_LINE compare to Linux generic definition. */ +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[NCCS]; /* control characters */ + cc_t c_line; /* line discipline (== c_cc[33]) */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 + }; diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h index 24423e8fc9..fe358dd8f5 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h @@ -24,20 +24,7 @@ typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; -#define NCCS 32 -struct termios - { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_cc[NCCS]; /* control characters */ - cc_t c_line; /* line discipline (== c_cc[33]) */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 -#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 - }; +#include /* c_cc characters */ #define VEOF 0 diff --git a/sysdeps/unix/sysv/linux/bits/termios-struct.h b/sysdeps/unix/sysv/linux/bits/termios-struct.h new file mode 100644 index 0000000000..ba56a547c1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/termios-struct.h @@ -0,0 +1,36 @@ +/* struct termios definition. Linux/generic version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 + }; diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h index 1e567affc3..93536130aa 100644 --- a/sysdeps/unix/sysv/linux/bits/termios.h +++ b/sysdeps/unix/sysv/linux/bits/termios.h @@ -24,20 +24,7 @@ typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; -#define NCCS 32 -struct termios - { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 -#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 - }; +#include /* c_cc characters */ #define VINTR 0 diff --git a/sysdeps/unix/sysv/linux/kernel_termios.h b/sysdeps/unix/sysv/linux/kernel_termios.h index 6f505c7b61..cd000af833 100644 --- a/sysdeps/unix/sysv/linux/kernel_termios.h +++ b/sysdeps/unix/sysv/linux/kernel_termios.h @@ -31,4 +31,7 @@ struct __kernel_termios cc_t c_cc[__KERNEL_NCCS]; /* control characters */ }; +#define _HAVE_C_ISPEED 0 +#define _HAVE_C_OSPEED 0 + #endif /* kernel_termios.h */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h b/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h new file mode 100644 index 0000000000..f7684e51f1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h @@ -0,0 +1,34 @@ +/* struct termios definition. Linux/mips version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0 + }; diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h index 7969144633..2b2f873f35 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/termios.h +++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h @@ -24,16 +24,7 @@ typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; -#define NCCS 32 -struct termios - { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ - }; +#include /* c_cc characters */ #define VINTR 0 /* Interrupt character [ISIG]. */ diff --git a/sysdeps/unix/sysv/linux/mips/kernel_termios.h b/sysdeps/unix/sysv/linux/mips/kernel_termios.h index 1c54b19428..5f88c745a0 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel_termios.h +++ b/sysdeps/unix/sysv/linux/mips/kernel_termios.h @@ -31,4 +31,7 @@ struct __kernel_termios cc_t c_cc[__KERNEL_NCCS]; /* control characters */ }; +#define _HAVE_C_ISPEED 0 +#define _HAVE_C_OSPEED 0 + #endif /* kernel_termios.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h index afe592d5e4..ddb32bd7e5 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h @@ -23,25 +23,7 @@ typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; -/* - * termios type and macro definitions. Be careful about adding stuff - * to this file since it's used in GNU libc and there are strict rules - * concerning namespace pollution. - */ - -#define NCCS 32 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline (== c_cc[19]) */ - cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 -#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 -}; +#include /* c_cc characters */ #define VINTR 0 diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h b/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h new file mode 100644 index 0000000000..7c3489e1b9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h @@ -0,0 +1,34 @@ +/* struct termios definition. Linux/sparc version. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#define NCCS 17 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0 + }; diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h index ffe8483694..5fd6055c8e 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h @@ -24,16 +24,7 @@ typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; -#define NCCS 17 -struct termios - { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ - }; +#include /* c_cc characters */ #define VINTR 0 diff --git a/sysdeps/unix/sysv/linux/sparc/kernel_termios.h b/sysdeps/unix/sysv/linux/sparc/kernel_termios.h index 31c717ea9d..3a27382d36 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel_termios.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel_termios.h @@ -34,4 +34,7 @@ struct __kernel_termios cc_t c_cc[__KERNEL_NCCS]; /* control characters */ }; +#define _HAVE_C_ISPEED 0 +#define _HAVE_C_OSPEED 0 + #endif /* kernel_termios.h */ diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c index 7db9e998c3..23834c10b5 100644 --- a/sysdeps/unix/sysv/linux/speed.c +++ b/sysdeps/unix/sysv/linux/speed.c @@ -58,7 +58,7 @@ cfsetospeed (struct termios *termios_p, speed_t speed) && (speed < B57600 || speed > __MAX_BAUD)) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); -#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED +#if _HAVE_STRUCT_TERMIOS_C_OSPEED termios_p->c_ospeed = speed; #endif termios_p->c_cflag &= ~(CBAUD | CBAUDEX); @@ -80,7 +80,7 @@ cfsetispeed (struct termios *termios_p, speed_t speed) && (speed < B57600 || speed > __MAX_BAUD)) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); -#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED +#if _HAVE_STRUCT_TERMIOS_C_ISPEED termios_p->c_ispeed = speed; #endif if (speed == 0) diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c index 9748bc8cc4..b79d9f1462 100644 --- a/sysdeps/unix/sysv/linux/tcgetattr.c +++ b/sysdeps/unix/sysv/linux/tcgetattr.c @@ -44,15 +44,15 @@ __tcgetattr (int fd, struct termios *termios_p) termios_p->c_cflag = k_termios.c_cflag; termios_p->c_lflag = k_termios.c_lflag; termios_p->c_line = k_termios.c_line; -#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED -# ifdef _HAVE_C_ISPEED +#if _HAVE_STRUCT_TERMIOS_C_ISPEED +# if _HAVE_C_ISPEED termios_p->c_ispeed = k_termios.c_ispeed; # else termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX); # endif #endif -#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED -# ifdef _HAVE_C_OSPEED +#if _HAVE_STRUCT_TERMIOS_C_OSPEED +# if _HAVE_C_OSPEED termios_p->c_ospeed = k_termios.c_ospeed; # else termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX); diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c index a916e70253..f8025a0473 100644 --- a/sysdeps/unix/sysv/linux/tcsetattr.c +++ b/sysdeps/unix/sysv/linux/tcsetattr.c @@ -66,10 +66,10 @@ __tcsetattr (int fd, int optional_actions, const struct termios *termios_p) k_termios.c_cflag = termios_p->c_cflag; k_termios.c_lflag = termios_p->c_lflag; k_termios.c_line = termios_p->c_line; -#if defined _HAVE_C_ISPEED && defined _HAVE_STRUCT_TERMIOS_C_ISPEED +#if _HAVE_C_ISPEED && _HAVE_STRUCT_TERMIOS_C_ISPEED k_termios.c_ispeed = termios_p->c_ispeed; #endif -#if defined _HAVE_C_OSPEED && defined _HAVE_STRUCT_TERMIOS_C_OSPEED +#if _HAVE_C_OSPEED && _HAVE_STRUCT_TERMIOS_C_OSPEED k_termios.c_ospeed = termios_p->c_ospeed; #endif memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],