X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fser-unix.c;h=597032afe8967b7ccc311e75029cd66b4c7789bf;hb=13084383e8955c2ff7017ac8839301688a9ee34d;hp=3492619f2d6e50d039b3432a1cb040e83a5fd03e;hpb=766f883622ef008230250aa5aecef9fb9b29f233;p=binutils-gdb.git diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index 3492619f2d6..597032afe89 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -1,6 +1,6 @@ /* Serial interface for local (hardwired) serial ports on Un*x like systems - Copyright (C) 1992-2019 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of GDB. @@ -26,13 +26,13 @@ #include #include "terminal.h" #include -#include "common/gdb_sys_time.h" +#include "gdbsupport/gdb_sys_time.h" -#include "gdb_select.h" +#include "gdbsupport/gdb_select.h" #include "gdbcmd.h" -#include "common/filestuff.h" +#include "gdbsupport/filestuff.h" #include -#include "inflow.h" +#include "gdbsupport/scoped_ignore_sigttou.h" struct hardwire_ttystate { @@ -41,7 +41,7 @@ struct hardwire_ttystate #ifdef CRTSCTS /* Boolean to explicitly enable or disable h/w flow control. */ -static int serial_hwflow; +static bool serial_hwflow; static void show_serial_hwflow (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -75,7 +75,7 @@ static int hardwire_setstopbits (struct serial *, int); static int hardwire_open (struct serial *scb, const char *name) { - scb->fd = gdb_open_cloexec (name, O_RDWR, 0); + scb->fd = gdb_open_cloexec (name, O_RDWR, 0).release (); if (scb->fd < 0) return -1; @@ -343,31 +343,31 @@ rate_to_code (int rate) { /* test for perfect macth. */ if (rate == baudtab[i].rate) - return baudtab[i].code; + return baudtab[i].code; else - { + { /* check if it is in between valid values. */ - if (rate < baudtab[i].rate) + if (rate < baudtab[i].rate) { if (i) - { - warning (_("Invalid baud rate %d. " + { + warning (_("Invalid baud rate %d. " "Closest values are %d and %d."), rate, baudtab[i - 1].rate, baudtab[i].rate); } else - { - warning (_("Invalid baud rate %d. Minimum value is %d."), + { + warning (_("Invalid baud rate %d. Minimum value is %d."), rate, baudtab[0].rate); } return -1; } - } + } } /* The requested speed was too large. */ warning (_("Invalid baud rate %d. Maximum value is %d."), - rate, baudtab[i - 1].rate); + rate, baudtab[i - 1].rate); return -1; } @@ -380,7 +380,7 @@ hardwire_setbaudrate (struct serial *scb, int rate) if (baud_code < 0) { /* The baud rate was not valid. - A warning has already been issued. */ + A warning has already been issued. */ errno = EINVAL; return -1; } @@ -498,8 +498,9 @@ static const struct serial_ops hardwire_ops = ser_unix_write_prim }; +void _initialize_ser_hardwire (); void -_initialize_ser_hardwire (void) +_initialize_ser_hardwire () { serial_add_interface (&hardwire_ops);