移植 C++从 Solaris 到 Linux 的代码应用程序以及实时标头问题
请帮忙,我使用的工具是kdevelop和qt4。在我的 main.cpp 上有错误,例如;
Error: sys/procset.h: No such files or directory
Error: sys/priocntl.h: No such files or directory
Error: sys/tspriocntl.h: No such files or directory
Error: sys/rtpriocntl.h: No such files or directory
In function 'int main(int. char**)':
Error: 'pcparms_t' was not declared in this scope
Error: expected ';' before 'pcparms'
Error: 'rtparms_t' was not declared in this scope
Error: 'rtparmsp' was not declared in this scope
Error: 'pcinfo_t' was not declared in this scope
Error: expected ';' before 'pcinfo'
Error: 'rtinfo_t' was not declared in this scope
Error: 'rtinfop' was not declared in this scope
warning: unused variable 'lret'
warning: unused variable 'priority'
...
...
...
*Exited with Status:2 *
我在 Centos 5 Linux 上找不到实时这些标头。另外,我不知道上述 Linux 标头的等效性。我知道我必须为 Solaris 和 Linux 添加 If 语句作为包含标头,并且我不知道 if/else 语句中将包含哪些标头。
当我通过注释掉实时标题和Solaris实时功能的功能来删除标题时,我让它运行。
//pcparms_t pcparms;
//rtparms_t *rtparmsp;
//pcinfo_t pcinfo;
//rtinfo_t *rtinfop;
我的问题是 Linux 或相当于 Linux 的实时标头和函数是什么。我的应用程序代码是 C++ 和 qt4 的混合。在qt4方面,他们需要使用实时功能吗?在 Solaris 的 c++ 上我需要实时函数吗?如果是,我在哪里可以找到它们或者它们叫什么以及我把它们放在哪里?
Please help, The tools that I am using are kdevelop and qt4. On my main.cpp have errors, for example;
Error: sys/procset.h: No such files or directory
Error: sys/priocntl.h: No such files or directory
Error: sys/tspriocntl.h: No such files or directory
Error: sys/rtpriocntl.h: No such files or directory
In function 'int main(int. char**)':
Error: 'pcparms_t' was not declared in this scope
Error: expected ';' before 'pcparms'
Error: 'rtparms_t' was not declared in this scope
Error: 'rtparmsp' was not declared in this scope
Error: 'pcinfo_t' was not declared in this scope
Error: expected ';' before 'pcinfo'
Error: 'rtinfo_t' was not declared in this scope
Error: 'rtinfop' was not declared in this scope
warning: unused variable 'lret'
warning: unused variable 'priority'
...
...
...
*Exited with Status:2 *
I can't find real time those headers on my Centos 5 Linux. Plus, I don't know the equivalence of those above headers for Linux. I know I have to add an If statement for Solaris and Linux for the include headers, and I don't know which headers will be included on the if/else statement.
When I remove headers by comment them out the real time headers and function for realtime function for solaris, I get it to run.
//pcparms_t pcparms;
//rtparms_t *rtparmsp;
//pcinfo_t pcinfo;
//rtinfo_t *rtinfop;
My problem is what are the real time headers and functions for Linux or equivalent to Linux. My application code is a mix between c++ and qt4. On the side of qt4 is their a need to use Real Time functions? On the c++ from Solaris do I need real time functions? If yes, where can I find them or what are they call and where do I place them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上并不是一个与 QT 相关的问题,而更多的是一个移植 Solaris->Linux 的问题。
这些文件都是 Solaris 特定的系统调用。它们是priocntlset的一部分 - 通用进程调度程序控制。
来自联机帮助页
Solaris 和 Linux 之间处理进程的方式是不同的。这两个系统都是 Unix 的变体,但您要查找的特定系统调用没有 Linux 等效项。基本上 priocntlset 用于(重新)调度进程。我不了解最新的 Linux 内核,也不知道有哪些调度程序可用,但是任何关于 2.6(或 2.4)内核的好书都会有一个关于调度的部分和示例。
在 Linux 机器上,一个好的起点是
man syscalls
。This is not really a QT related question but more of a porting Solaris->Linux question.
Those files are all Solaris specific system calls. They are part of priocntlset - generalized process scheduler control.
From the manpage
The way in which processes are handled between Solaris and Linux is different. Both systems are variants of Unix, but the specific system calls you are looking for do not have a Linux equivalent. Basically priocntlset is used to (re)schedule processes. I am not up to date on the latest Linux Kernel, or what schedulers are available anymore, but any good book on a 2.6 (or 2.4) Kernel will have a section on scheduling with examples.
A good place to start on a Linux machine would be
man syscalls
.