posix - 如果 _POSIX_VDISABLE 值为 -1 会怎样?

标签 posix

在POSIX _POSIX_VDISABLE 值中如果为-1,则所有终端设备文件的特殊字符都没有禁用字符;否则该值是禁用字符值..

可以请任何人帮助我理解这一点。我无法理解这个的确切含义。

最佳答案

如果您查看 definition of special characters ,那应该意味着(thre '-1' 值),所有这些特殊字符都处于事件状态:

In canonical input, the terminal driver recognizes a number of special characters which perform various control functions.
These include the ERASE character (usually DEL) for editing input, and other editing characters.
The INTR character (normally Ctrl-c) for sending a SIGINT signal, and other signal-raising characters, may be available in either canonical or noncanonical input mode.



你有很多这样的特殊角色:
  • Characters for Input Editing
  • BSD Extensions to Editing Characters
  • Characters that Cause Signals
  • Special Characters for Flow Control
  • Other Special Characters


  • 已经提出了一个问题,看看 such a value was portable (确实总是编译)是否在 1997 年:

    The wording in section 2.9.4:

    If any of the constants in Table 2-11 are defined to have value -1 in the header ....

    can suggest, on casual reading, code like the following to minimize size and optimize efficiency for each implementation:


    #ifdef _POSIX_VDISABLE
    #if    _POSIX_VDISABLE == -1
        /* code that assumes no vdisable capability */
    #else
        /* code that assumes vdisable capability */
    #endif
    #else
        /* code that uses pathconf() to determine vdisable capability */
    #endif
    

    interpretation #34 表明它会。

    By using these values at COMPILE-TIME, a portable POSIX.1 application can avoid loading all pathconf() related code associated with a symbol in Table 2-11 when the symbol is defined.

    关于posix - 如果 _POSIX_VDISABLE 值为 -1 会怎样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2891425/

    相关文章:

    multithreading - POSIX 线程与 Win32 线程

    python - 打开文件进行读/写,如果需要则创建

    Linux : how to set default route from C?

    c - 在 C 中使用信号量和共享内存的读写器

    c - 如何正确终止信号处理程序中的线程?

    c - 为什么 select 不向带有缓冲数据的文件描述符发出信号?

    unix - 单 UNIX 或 POSIX 中 sizeof(int) 的保证

    c - 使用不同的根目录启动单独的进程,而无需 fork /克隆它

    visual-c++ - 关于 MSVC 编译器,open()、open() 和 fopen() 之间的区别?

    linux - 即使在 `sort` 之后, `uniq` 仍然重复一些值