Retrieving minix OS version
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];
mess开发者_如何学Cage 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.
This code does what you are asking for:
#include <stdio.h>
#include<minix/config.h>
int main(int argc, char**argv) {
printf("the os version is %s.%s\n",OS_RELEASE,OS_VERSION);
return 0;
}
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.
精彩评论