* uname.cc (uname): Use `wProcessorLevel' unless OS sets it wrong.

Use `dwProcessorType' then instead.
        * wincap.cc: Set flag has_valid_processorlevel appropriately.
        * wincap.h: Add flag has_valid_processorlevel.
This commit is contained in:
Corinna Vinschen 2001-10-15 09:41:18 +00:00
parent 48372ea6f1
commit 271a33443c
4 changed files with 36 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2001-10-15 Corinna Vinschen <corinna@vinschen.de>
* uname.cc (uname): Use `wProcessorLevel' unless OS sets it wrong.
Use `dwProcessorType' then instead.
* wincap.cc: Set flag has_valid_processorlevel appropriately.
* wincap.h: Add flag has_valid_processorlevel.
2001-10-14 Christopher Faylor <cgf@redhat.com> 2001-10-14 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::build_fhandler_from_name): Use PC_FULL to * dtable.cc (dtable::build_fhandler_from_name): Use PC_FULL to

View File

@ -57,13 +57,23 @@ uname (struct utsname *name)
{ {
case PROCESSOR_ARCHITECTURE_INTEL: case PROCESSOR_ARCHITECTURE_INTEL:
unsigned int ptype; unsigned int ptype;
if (sysinfo.dwProcessorType < 3) /* Shouldn't happen. */ if (wincap.has_valid_processorlevel ())
ptype = 3; {
else if (sysinfo.dwProcessorType > 9) /* P4 */ if (sysinfo.wProcessorLevel < 3) /* Shouldn't happen. */
ptype = 6; ptype = 3;
else if (sysinfo.wProcessorLevel > 9) /* P4 */
ptype = 6;
else
ptype = sysinfo.wProcessorLevel;
}
else else
ptype = sysinfo.dwProcessorType; {
if (sysinfo.dwProcessorType == PROCESSOR_INTEL_386 ||
sysinfo.dwProcessorType == PROCESSOR_INTEL_486)
ptype = sysinfo.dwProcessorType / 100;
else
ptype = PROCESSOR_INTEL_PENTIUM / 100;
}
__small_sprintf (name->machine, "i%d86", ptype); __small_sprintf (name->machine, "i%d86", ptype);
break; break;
case PROCESSOR_ARCHITECTURE_ALPHA: case PROCESSOR_ARCHITECTURE_ALPHA:

View File

@ -43,6 +43,7 @@ static NO_COPY wincaps wincap_unknown = {
has_negative_pids:false, has_negative_pids:false,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_valid_processorlevel:false,
}; };
static NO_COPY wincaps wincap_95 = { static NO_COPY wincaps wincap_95 = {
@ -77,6 +78,7 @@ static NO_COPY wincaps wincap_95 = {
has_negative_pids:true, has_negative_pids:true,
has_unreliable_pipes:true, has_unreliable_pipes:true,
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_valid_processorlevel:false,
}; };
static NO_COPY wincaps wincap_95osr2 = { static NO_COPY wincaps wincap_95osr2 = {
@ -111,6 +113,7 @@ static NO_COPY wincaps wincap_95osr2 = {
has_negative_pids:true, has_negative_pids:true,
has_unreliable_pipes:true, has_unreliable_pipes:true,
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_valid_processorlevel:false,
}; };
static NO_COPY wincaps wincap_98 = { static NO_COPY wincaps wincap_98 = {
@ -145,6 +148,7 @@ static NO_COPY wincaps wincap_98 = {
has_negative_pids:true, has_negative_pids:true,
has_unreliable_pipes:true, has_unreliable_pipes:true,
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_valid_processorlevel:true,
}; };
static NO_COPY wincaps wincap_98se = { static NO_COPY wincaps wincap_98se = {
@ -179,6 +183,7 @@ static NO_COPY wincaps wincap_98se = {
has_negative_pids:true, has_negative_pids:true,
has_unreliable_pipes:true, has_unreliable_pipes:true,
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_valid_processorlevel:true,
}; };
static NO_COPY wincaps wincap_me = { static NO_COPY wincaps wincap_me = {
@ -213,6 +218,7 @@ static NO_COPY wincaps wincap_me = {
has_negative_pids:true, has_negative_pids:true,
has_unreliable_pipes:true, has_unreliable_pipes:true,
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_valid_processorlevel:true,
}; };
static NO_COPY wincaps wincap_nt3 = { static NO_COPY wincaps wincap_nt3 = {
@ -247,6 +253,7 @@ static NO_COPY wincaps wincap_nt3 = {
has_negative_pids:false, has_negative_pids:false,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_valid_processorlevel:true,
}; };
static NO_COPY wincaps wincap_nt4 = { static NO_COPY wincaps wincap_nt4 = {
@ -281,6 +288,7 @@ static NO_COPY wincaps wincap_nt4 = {
has_negative_pids:false, has_negative_pids:false,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_try_enter_critical_section:true, has_try_enter_critical_section:true,
has_valid_processorlevel:true,
}; };
static NO_COPY wincaps wincap_nt4sp4 = { static NO_COPY wincaps wincap_nt4sp4 = {
@ -315,6 +323,7 @@ static NO_COPY wincaps wincap_nt4sp4 = {
has_negative_pids:false, has_negative_pids:false,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_try_enter_critical_section:true, has_try_enter_critical_section:true,
has_valid_processorlevel:true,
}; };
static NO_COPY wincaps wincap_2000 = { static NO_COPY wincaps wincap_2000 = {
@ -349,6 +358,7 @@ static NO_COPY wincaps wincap_2000 = {
has_negative_pids:false, has_negative_pids:false,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_try_enter_critical_section:true, has_try_enter_critical_section:true,
has_valid_processorlevel:true,
}; };
static NO_COPY wincaps wincap_xp = { static NO_COPY wincaps wincap_xp = {
@ -383,6 +393,7 @@ static NO_COPY wincaps wincap_xp = {
has_negative_pids:false, has_negative_pids:false,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_try_enter_critical_section:true, has_try_enter_critical_section:true,
has_valid_processorlevel:true,
}; };
wincapc NO_COPY wincap; wincapc NO_COPY wincap;

View File

@ -44,6 +44,7 @@ struct wincaps
unsigned has_negative_pids : 1; unsigned has_negative_pids : 1;
unsigned has_unreliable_pipes : 1; unsigned has_unreliable_pipes : 1;
unsigned has_try_enter_critical_section : 1; unsigned has_try_enter_critical_section : 1;
unsigned has_valid_processorlevel : 1;
}; };
class wincapc class wincapc
@ -92,6 +93,7 @@ public:
bool IMPLEMENT (has_negative_pids) bool IMPLEMENT (has_negative_pids)
bool IMPLEMENT (has_unreliable_pipes) bool IMPLEMENT (has_unreliable_pipes)
bool IMPLEMENT (has_try_enter_critical_section) bool IMPLEMENT (has_try_enter_critical_section)
bool IMPLEMENT (has_valid_processorlevel)
#undef IMPLEMENT #undef IMPLEMENT
}; };