github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/pkg/termios/var_linux.go (about)

     1  // Copyright 2015-2017 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package termios
     6  
     7  import (
     8  	"syscall"
     9  
    10  	"golang.org/x/sys/unix"
    11  )
    12  
    13  // baud2unixB convert a baudrate to the corresponding unix const.
    14  var baud2unixB = map[int]uint32{
    15  	50:      unix.B50,
    16  	75:      unix.B75,
    17  	110:     unix.B110,
    18  	134:     unix.B134,
    19  	150:     unix.B150,
    20  	200:     unix.B200,
    21  	300:     unix.B300,
    22  	600:     unix.B600,
    23  	1200:    unix.B1200,
    24  	1800:    unix.B1800,
    25  	2400:    unix.B2400,
    26  	4800:    unix.B4800,
    27  	9600:    unix.B9600,
    28  	19200:   unix.B19200,
    29  	38400:   unix.B38400,
    30  	57600:   unix.B57600,
    31  	115200:  unix.B115200,
    32  	230400:  unix.B230400,
    33  	460800:  unix.B460800,
    34  	500000:  unix.B500000,
    35  	576000:  unix.B576000,
    36  	921600:  unix.B921600,
    37  	1000000: unix.B1000000,
    38  	1152000: unix.B1152000,
    39  	1500000: unix.B1500000,
    40  	2000000: unix.B2000000,
    41  	2500000: unix.B2500000,
    42  	3000000: unix.B3000000,
    43  	3500000: unix.B3500000,
    44  	4000000: unix.B4000000,
    45  }
    46  
    47  // init adds constants that are linux-specific
    48  func init() {
    49  	extra := map[string]*bit{
    50  		"iuclc": {word: I, mask: syscall.IUCLC},
    51  		"olcuc": {word: O, mask: syscall.OLCUC},
    52  		"xcase": {word: L, mask: syscall.XCASE},
    53  		// not in FreeBSD
    54  		"iutf8": {word: I, mask: syscall.IUTF8},
    55  		"ofill": {word: O, mask: syscall.OFILL},
    56  		"ofdel": {word: O, mask: syscall.OFDEL},
    57  	}
    58  	for k, v := range extra {
    59  		boolFields[k] = v
    60  	}
    61  }