baud.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* `struct termios' speed frobnication functions, baud rate wrappers.
  2. Any platform which doesn't have Bxxx == xxx for all baud rate
  3. constants will need to override this file.
  4. Copyright (C) 1991-2026 Free Software Foundation, Inc.
  5. This file is part of the GNU C Library.
  6. The GNU C Library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public
  8. License as published by the Free Software Foundation; either
  9. version 2.1 of the License, or (at your option) any later version.
  10. The GNU C Library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with the GNU C Library; if not, see
  16. <https://www.gnu.org/licenses/>. */
  17. #include <stddef.h>
  18. #include <errno.h>
  19. #include <termios.h>
  20. baud_t
  21. __cfgetobaud (const struct termios *termios_p)
  22. {
  23. return __cfgetospeed (termios_p);
  24. }
  25. libc_hidden_def (__cfgetobaud)
  26. weak_alias (__cfgetobaud, cfgetobaud)
  27. baud_t
  28. __cfgetibaud (const struct termios *termios_p)
  29. {
  30. return __cfgetispeed (termios_p);
  31. }
  32. libc_hidden_def (__cfgetibaud)
  33. weak_alias (__cfgetibaud, cfgetibaud)
  34. int
  35. __cfsetobaud (struct termios *termios_p, baud_t baud)
  36. {
  37. return __cfsetospeed (termios_p, baud);
  38. }
  39. libc_hidden_def (__cfsetobaud)
  40. weak_alias (__cfsetobaud, cfsetobaud)
  41. int
  42. __cfsetibaud (struct termios *termios_p, baud_t baud)
  43. {
  44. return __cfsetispeed (termios_p, baud);
  45. }
  46. libc_hidden_def (__cfsetibaud)
  47. weak_alias (__cfsetibaud, cfsetibaud)