1 .\"
   2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
   3 .\" permission to reproduce portions of its copyrighted documentation.
   4 .\" Original documentation from The Open Group can be obtained online at
   5 .\" http://www.opengroup.org/bookstore/.
   6 .\"
   7 .\" The Institute of Electrical and Electronics Engineers and The Open
   8 .\" Group, have given us permission to reprint portions of their
   9 .\" documentation.
  10 .\"
  11 .\" In the following statement, the phrase ``this text'' refers to portions
  12 .\" of the system documentation.
  13 .\"
  14 .\" Portions of this text are reprinted and reproduced in electronic form
  15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
  16 .\" Standard for Information Technology -- Portable Operating System
  17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
  18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
  19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
  20 .\" between these versions and the original IEEE and The Open Group
  21 .\" Standard, the original IEEE and The Open Group Standard is the referee
  22 .\" document.  The original Standard can be obtained online at
  23 .\" http://www.opengroup.org/unix/online.html.
  24 .\"
  25 .\" This notice shall appear on any product containing this material.
  26 .\"
  27 .\" The contents of this file are subject to the terms of the
  28 .\" Common Development and Distribution License (the "License").
  29 .\" You may not use this file except in compliance with the License.
  30 .\"
  31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  32 .\" or http://www.opensolaris.org/os/licensing.
  33 .\" See the License for the specific language governing permissions
  34 .\" and limitations under the License.
  35 .\"
  36 .\" When distributing Covered Code, include this CDDL HEADER in each
  37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38 .\" If applicable, add the following below this CDDL HEADER, with the
  39 .\" fields enclosed by brackets "[]" replaced with your own identifying
  40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41 .\"
  42 .\"
  43 .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
  44 .\" Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved
  45 .\" Copyright 2019, Joyent, Inc.
  46 .\"
  47 .Dd January 20, 2019
  48 .Dt CFSETISPEED 3C
  49 .Os
  50 .Sh NAME
  51 .Nm cfsetispeed ,
  52 .Nm cfsetospeed ,
  53 .Nm cfsetspeed
  54 .Nd set input and output baud rate
  55 .Sh SYNOPSIS
  56 .In termios.h
  57 .Ft int
  58 .Fo cfsetispeed
  59 .Fa "struct termios *termios_p"
  60 .Fa "speed_t speed"
  61 .Fc
  62 .Ft int
  63 .Fo cfsetospeed
  64 .Fa "struct termios *termios_p"
  65 .Fa "speed_t speed"
  66 .Fc
  67 .Ft int
  68 .Fo cfsetspeed
  69 .Fa "struct termios *termios_p"
  70 .Fa "speed_t speed"
  71 .Fc
  72 .Sh DESCRIPTION
  73 The
  74 .Fn cfsetispeed
  75 function sets the input baud rate stored in the
  76 structure pointed to by
  77 .Fa termios_p
  78 to
  79 .Fa speed .
  80 .Pp
  81 The
  82 .Fn cfsetospeed
  83 function sets the output baud rate stored in the
  84 structure pointed to by
  85 .Fa termios_p
  86 to
  87 .Fa speed .
  88 .Pp
  89 The
  90 .Fn cfsetspeed
  91 function sets both the input and output baud rate stored in the structure
  92 pointed to by
  93 .Fa termios_p
  94 to
  95 .Fa speed.
  96 .Pp
  97 There is no effect on the baud rates set in the hardware until a subsequent
  98 successful call to
  99 .Xr tcsetattr 3C
 100 on the same
 101 .Vt termios
 102 structure.
 103 .Sh RETURN VALUES
 104 Upon successful completion,
 105 .Fn cfsetispeed
 106 and
 107 .Fn cfsetospeed
 108 return
 109 .Sy 0 .
 110 Otherwise
 111 .Sy \(mi1
 112 is returned, and
 113 .Va errno
 114 may be set to indicate the error.
 115 .Sh ERRORS
 116 The
 117 .Fn cfsetispeed
 118 and
 119 .Fn cfsetospeed
 120 functions may fail if:
 121 .Bl -tag -width EINVAL
 122 .It Er EINVAL
 123 The
 124 .Fa speed
 125 value is not a valid baud rate.
 126 .It Er EINVAL
 127 The value of
 128 .Fa speed
 129 is outside the range of possible speed values as specified in
 130 .In termios.h .
 131 .El
 132 .Sh INTERFACE STABILITY
 133 Standard
 134 .Sh MT-LEVEL
 135 MT-Safe
 136 .Pp
 137 Async-Signal-Safe
 138 .Sh SEE ALSO
 139 .Xr cfgetispeed 3C ,
 140 .Xr tcsetattr 3C ,
 141 .Xr attributes 5 ,
 142 .Xr standards 5 ,
 143 .Xr termio 7I