1

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.

tshepang
  • 12,111
  • 21
  • 91
  • 136
majnun
  • 19
  • 1

1 Answers1

0

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.

D'Nabre
  • 2,226
  • 16
  • 13
  • NB this is the version at compile time, not at run time. – Polluks Jan 03 '19 at 16:54
  • @Polluks Please look at dates on questions. After 8 years, both the question and answer provider have moved on, and/or often the question has been edited (as is this case, many times). – D'Nabre Jan 06 '19 at 16:01