--- old/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c Thu Jun 4 11:45:20 2009 +++ new/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c Thu Jun 4 11:45:16 2009 @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -645,6 +646,58 @@ return (0); } +int +s10_sysinfo(sysret_t *rv, int command, char *buf, long count) +{ + char *value; + int err, len; + + /* + * We must interpose on the sysinfo(2) commands SI_RELEASE and + * SI_VERSION; all others get passed to the native sysinfo(2) + * command. + */ + switch (command) { + case SI_RELEASE: + value = S10_UTS_RELEASE; + break; + + case SI_VERSION: + value = S10_UTS_VERSION; + break; + + default: + /* + * The default action is to pass the command to the + * native sysinfo(2) syscall. + */ + if ((err = __systemcall(rv, SYS_systeminfo + 1024, + command, buf, count)) != 0) + return (err); + + return (0); + } + + len = strlen(value) + 1; + if (count > 0) { + if (s10_uucopystr(value, buf, count) != 0) + return (EFAULT); + + /* Assure NULL termination of buf as s10_uucopystr() doesn't. */ + if (len > count && s10_uucopy("\0", buf + (count - 1), 1) != 0) + return (EFAULT); + } + + /* + * On success, sysinfo(2) returns the size of buffer required to hold + * the complete value plus its terminating NULL byte. + */ + rv->sys_rval1 = len; + rv->sys_rval2 = 0; + S10_TRUSS_POINT_3(rv, SYS_systeminfo, 0, command, buf, count); + return (0); +} + /* * If the emul_global_zone flag is set then emulate some aspects of the * zone system call. In particular, emulate the global zone ID on the @@ -1131,7 +1184,7 @@ NOSYS, /* 136 */ NOSYS, /* 137 */ NOSYS, /* 138 */ - NOSYS, /* 139 */ + EMULATE(s10_sysinfo, 3 | RV_DEFAULT), /* 139 */ NOSYS, /* 140 */ NOSYS, /* 141 */ NOSYS, /* 142 */