【问题标题】:What is the Linux equivalent for termiox.h?termiox.h 的 Linux 等效项是什么?
【发布时间】:2012-09-25 14:00:26
【问题描述】:

我有一个古老的调制解调器接口库,它最初是为 Solaris 和 Linux 制作的,我正在尝试看看它是否适用于 Linux。

在 Linux 上编译时,我看到了:

#if ! defined(WIN32)

#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <termios.h>
#include <sys/termiox.h>

它似乎无法找到 termiox.h 的位置,当我搜索它时,它只显示 termios.h 的结果

我不能简单地删除引用,因为有很多调用它。

有谁知道在 Linux 下 termiox 调用是在哪里定义的?

操作系统版本为 RHEL 5.5

引用 termiox 库的代码只是说它忽略了 termiox 选项:

 /home/local/NT/jayanthv/8.7/CallBur/lib/unix.c(556): error: struct "<unnamed>" has no field "termiox"
 if( modem_opt_ignore_termiox == No && ioctl( modem_handle, TCSETX, &mattr_current.termiox ) < 0 )

我应该继续在代码周围添加#if !defined() 吗?

【问题讨论】:

  • 它似乎来自 AIX——termiox.h 中定义了您需要的哪些调用/结构?即,在没有包含的情况下尝试编译时会出现什么错误?编辑:我们的 SunOS 服务器似乎也有 termiox。
  • 我已经用信息更新了问题,您认为忽略调用 termiox 的代码是否明智?
  • 很难说——我个人会继续尝试 :) 您发布的 ioctl 调用基本上将 modem_handle 的流控制设置设置为 mattr_current.termiox 中的设置。 mattr_current.termiox 是如何初始化的?
  • 顺便说一句,这里是 SunOS termiox 手册页:www-it.desy.de/cgi-bin/man-cgi?termiox+7

标签: c linux rhel


【解决方案1】:

别开玩笑了。在man page linked by rodion 的底部写着:

提供 termiox(7I) 系统调用是为了兼容 以前的版本,不鼓励使用。相反,termio(7I) 推荐系统调用。

该手册页的日期为 1990 年。从那时起,termio has also become obsolete:

termio.h
此头文件已过时,已被 termios.h 取代,它是 POSIX 标准的一部分。这两个头文件非常相似。但是,termios.h 不包含与termio.h 相同的头文件。因此,您应该确保直接查看 termios.h 标头,以确保它包含您的应用程序所需的所有内容。

所以termiox被termio代替了,termio又被termios代替了。

【讨论】:

  • 我刚刚删除了所有对 termiox 的引用
猜你喜欢
  • 2010-11-02
  • 2014-03-01
  • 2021-08-07
  • 2019-03-19
  • 1970-01-01
  • 2017-09-20
  • 2018-12-01
  • 2012-12-04
  • 1970-01-01
相关资源
最近更新 更多