Cygwin: wincap: make capability flags readonly
So far the capability bits were stored in the .cygwin_dll_common
R/W section because we overwrite the is_server bit. Just don't.
Move the bit to class wincapc instead and define all wincaps
bitfields const.
Fixes: 8937c103ed
("* wincap.cc (all wincaps): Store in .cygwin_dll_common section same as wincap. Add comment to explain why.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
0e1c0a02cf
commit
e7d0f0eb41
|
@ -16,7 +16,6 @@ struct wincaps
|
||||||
/* The bitfields must be 8 byte aligned on x86_64, otherwise the bitfield
|
/* The bitfields must be 8 byte aligned on x86_64, otherwise the bitfield
|
||||||
ops generated by gcc are off by 4 bytes. */
|
ops generated by gcc are off by 4 bytes. */
|
||||||
struct __attribute__ ((aligned (8))) {
|
struct __attribute__ ((aligned (8))) {
|
||||||
unsigned is_server : 1;
|
|
||||||
unsigned has_new_pebteb_region : 1;
|
unsigned has_new_pebteb_region : 1;
|
||||||
unsigned has_unprivileged_createsymlink : 1;
|
unsigned has_unprivileged_createsymlink : 1;
|
||||||
unsigned has_precise_interrupt_time : 1;
|
unsigned has_precise_interrupt_time : 1;
|
||||||
|
@ -41,7 +40,8 @@ class wincapc
|
||||||
SYSTEM_INFO system_info;
|
SYSTEM_INFO system_info;
|
||||||
RTL_OSVERSIONINFOEXW version;
|
RTL_OSVERSIONINFOEXW version;
|
||||||
char osnam[40];
|
char osnam[40];
|
||||||
void *caps;
|
const void *caps;
|
||||||
|
bool _is_server;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init ();
|
void init ();
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
{
|
{
|
||||||
return DEFAULT_GUARD_PAGE_COUNT * page_size ();
|
return DEFAULT_GUARD_PAGE_COUNT * page_size ();
|
||||||
}
|
}
|
||||||
bool IMPLEMENT (is_server)
|
bool is_server () const { return _is_server; }
|
||||||
bool IMPLEMENT (has_new_pebteb_region)
|
bool IMPLEMENT (has_new_pebteb_region)
|
||||||
bool IMPLEMENT (has_unprivileged_createsymlink)
|
bool IMPLEMENT (has_unprivileged_createsymlink)
|
||||||
bool IMPLEMENT (has_precise_interrupt_time)
|
bool IMPLEMENT (has_precise_interrupt_time)
|
||||||
|
|
|
@ -13,15 +13,8 @@ details. */
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
#include "memory_layout.h"
|
#include "memory_layout.h"
|
||||||
|
|
||||||
/* CV, 2008-10-23: All wincapc's have to be in the .cygwin_dll_common section,
|
static const wincaps wincap_8_1 = {
|
||||||
same as wincap itself. Otherwise the capability changes made in
|
|
||||||
wincapc::init() are not propagated to any subsequently started process
|
|
||||||
in the same session. I'm only writing this longish comment because I'm
|
|
||||||
puzzled that this has never been noticed before... */
|
|
||||||
|
|
||||||
wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:false,
|
has_new_pebteb_region:false,
|
||||||
has_unprivileged_createsymlink:false,
|
has_unprivileged_createsymlink:false,
|
||||||
has_precise_interrupt_time:false,
|
has_precise_interrupt_time:false,
|
||||||
|
@ -41,9 +34,8 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_10_1507 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:false,
|
has_new_pebteb_region:false,
|
||||||
has_unprivileged_createsymlink:false,
|
has_unprivileged_createsymlink:false,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -63,9 +55,8 @@ wincaps wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_10_1607 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:false,
|
has_new_pebteb_region:false,
|
||||||
has_unprivileged_createsymlink:false,
|
has_unprivileged_createsymlink:false,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -85,9 +76,8 @@ wincaps wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared))
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_10_1703 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:true,
|
has_new_pebteb_region:true,
|
||||||
has_unprivileged_createsymlink:true,
|
has_unprivileged_createsymlink:true,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -107,9 +97,8 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_10_1709 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:true,
|
has_new_pebteb_region:true,
|
||||||
has_unprivileged_createsymlink:true,
|
has_unprivileged_createsymlink:true,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -129,9 +118,8 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_10_1803 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:true,
|
has_new_pebteb_region:true,
|
||||||
has_unprivileged_createsymlink:true,
|
has_unprivileged_createsymlink:true,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -151,9 +139,8 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_10_1809 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:true,
|
has_new_pebteb_region:true,
|
||||||
has_unprivileged_createsymlink:true,
|
has_unprivileged_createsymlink:true,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -173,9 +160,8 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_10_1903 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:true,
|
has_new_pebteb_region:true,
|
||||||
has_unprivileged_createsymlink:true,
|
has_unprivileged_createsymlink:true,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -195,9 +181,8 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_10_2004 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_10_2004 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:true,
|
has_new_pebteb_region:true,
|
||||||
has_unprivileged_createsymlink:true,
|
has_unprivileged_createsymlink:true,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -217,9 +202,8 @@ wincaps wincap_10_2004 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
wincaps wincap_11 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
static const wincaps wincap_11 = {
|
||||||
{
|
{
|
||||||
is_server:false,
|
|
||||||
has_new_pebteb_region:true,
|
has_new_pebteb_region:true,
|
||||||
has_unprivileged_createsymlink:true,
|
has_unprivileged_createsymlink:true,
|
||||||
has_precise_interrupt_time:true,
|
has_precise_interrupt_time:true,
|
||||||
|
@ -284,7 +268,7 @@ wincapc::init ()
|
||||||
caps = & wincap_10_1507;
|
caps = & wincap_10_1507;
|
||||||
}
|
}
|
||||||
|
|
||||||
((wincaps *)caps)->is_server = (version.wProductType != VER_NT_WORKSTATION);
|
_is_server = (version.wProductType != VER_NT_WORKSTATION);
|
||||||
|
|
||||||
__small_sprintf (osnam, "NT-%d.%d", version.dwMajorVersion,
|
__small_sprintf (osnam, "NT-%d.%d", version.dwMajorVersion,
|
||||||
version.dwMinorVersion);
|
version.dwMinorVersion);
|
||||||
|
|
Loading…
Reference in New Issue