1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/*
* linux/ibcs/sysinfo.c
*
* Copyright (C) 1995 Eric Youngdale
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <asm/segment.h>
#ifndef KERNEL_DS
#include <linux/config.h>
#endif
#include <linux/mm.h>
#include <linux/errno.h>
#include <ibcs/ibcs.h>
#include <linux/utsname.h>
#ifdef IBCS_TRACE
#include <ibcs/trace.h>
#endif
#define SI_SYSNAME 1 /* return name of operating system */
#define SI_HOSTNAME 2 /* return name of node */
#define SI_RELEASE 3 /* return release of operating system */
#define SI_VERSION 4 /* return version field of utsname */
#define SI_MACHINE 5 /* return kind of machine */
#define SI_ARCHITECTURE 6 /* return instruction set arch */
#define SI_HW_SERIAL 7 /* return hardware serial number */
#define SI_HW_PROVIDER 8 /* return hardware manufacturer */
#define SI_SRPC_DOMAIN 9 /* return secure RPC domain */
int ibcs_sysinfo(int command, char * buf, long count) {
char * return_string;
static unsigned int serial_number = 0;
char buffer[16];
int error;
int slen;
return_string = NULL;
switch(command)
{
case SI_SYSNAME:
return_string = "Linux";
break;
case SI_HOSTNAME:
return_string = system_utsname.sysname;
break;
case SI_RELEASE:
return_string = system_utsname.release;
break;
case SI_MACHINE:
case SI_ARCHITECTURE:
return_string = system_utsname.machine;
break;
case SI_HW_PROVIDER:
return_string = "Intel";
break;
case SI_HW_SERIAL:
if( serial_number == 0 )
{
serial_number = 0xdeadbeef; /* Use something HW specific? */
}
sprintf(buffer,"%8.8x", serial_number);
return_string = buffer; /* We need to generate something here. */
break;
case SI_VERSION:
case SI_SRPC_DOMAIN:
break;
default:
#ifdef IBCS_TRACE
if ((ibcs_trace & TRACE_API) || ibcs_func_p->trace) {
printk(KERN_DEBUG "iBCS2: unsupported sysinfo call %d\n", command);
}
#endif
return -EINVAL;
}
if (!return_string) return 0;
error = verify_area(VERIFY_WRITE, buf, count);
if (error)
return error;
slen = (count < strlen(return_string) + 1 ? count :
strlen(return_string) + 1);
memcpy_tofs(buf, return_string, slen);
return slen;
}
|