gpt4 book ai didi

c - tcsendbreak() 中的持续时间单位是什么?

转载 作者:太空宇宙 更新时间:2023-11-04 10:05:07 25 4
gpt4 key购买 nike

来自几乎所有的 Linux 联机帮助页 termios(3):

tcsendbreak() transmits a continuous stream of zero-valued bits for a specific duration, if the terminal is using asynchronous serial data transmission. If duration is zero, it transmits zero-valued bits for at least 0.25 seconds, and not more that 0.5 seconds. If duration is not zero, it sends zero-valued bits for some implementation-defined length of time.

If the terminal is not using asynchronous serial data transmission, tcsendbreak() returns without taking any action.

那么,“一些实现定义的时间长度”究竟是什么?

最佳答案

在 Linux 上,它是毫秒。

来自您引用的同一联机帮助页:

The effect of a nonzero duration with tcsendbreak() varies. SunOS specifies a break of duration * N seconds, where N is at least 0.25, and not more than 0.5. Linux, AIX, DU, Tru64 send a break of duration milliseconds. FreeBSD and NetBSD and HP-UX and MacOS ignore the value of duration. Under Solaris and UnixWare, tcsendbreak() with nonzero duration behaves like tcdrain()

可以看到出处here .

它正在调用 __ioctl (fd, TCSBRKP, (duration + 99)/100);,并且 TCSBRKP 本身会发送 arg 的中断十分之一秒,如 tty_ioctl(4) 联机帮助页中所述。

关于c - tcsendbreak() 中的持续时间单位是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53116152/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com