检索 minix 操作系统版本
我正在为大学做一个项目,其中(高于其他项目)我必须从 kernell 调用中获取 minix 操作系统版本。这就是我得到的结果(在一些帮助下):
int main (int argc, char *argv[] )
{
char M3ca1[23];
message ml;
m.m_u.m_m1.m3ca1= OS_VERSION;
char temp=_syscall(MM,69,&m);
printf("the os version is %c\n",temp);
return 0;
}
我收到多个错误。
I'm having a project for the university in which (above others ) i have to get the minix os version from kernell call. This is what i have come to (with some help):
int main (int argc, char *argv[] )
{
char M3ca1[23];
message ml;
m.m_u.m_m1.m3ca1= OS_VERSION;
char temp=_syscall(MM,69,&m);
printf("the os version is %c\n",temp);
return 0;
}
And i get multiple errors.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该代码满足您的要求:
如果这是一个大学项目,我怀疑这就是您所要求的。当然,您不会被要求实现一个提供操作系统版本的新系统调用,然后编写一个调用它的小程序?
******** 由于最近的评论,多年后进行编辑 ***
如果您想从运行中而不是静态地获取此信息,您需要查看 uname(2) 联机帮助页。 uname 将为您填充一个结构体,其中包含所有操作系统版本、版本、架构等。
没有正在运行的 minix 机器来组合/验证快速程序来调用和打印此信息。应该是直截了当的。可以用示例程序替换本段。
This code does what you are asking for:
If this is a university project I doubt this is what is being asked of you. Sure you aren't being asked to implement a new system call that gives the os version, and then write a small program that calls it?
******** Edit after many years due to a recent comment ***
If you want to grab this from the running current instead of statically, you want to look at the uname(2) manpage. uname will fill a struct for you with all OS release, version, arch, and so forth.
Don't have a running minix machine to put together/verify a quick program to call and print this info. Should be straight forward. Might replace this paragraph with sample program.