diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-09-06 14:05:48 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-09-06 14:05:48 +0200 |
commit | 5efb89d0e1a8aa19fafd64e7c7bebde46cccdd14 (patch) | |
tree | 437a61d0a532525592027bb4c430541e36e044a7 /gcc/ada/sysdep.c | |
parent | 643827e99051c3ce6077d8bb332290741dc90571 (diff) | |
download | gcc-5efb89d0e1a8aa19fafd64e7c7bebde46cccdd14.zip gcc-5efb89d0e1a8aa19fafd64e7c7bebde46cccdd14.tar.gz gcc-5efb89d0e1a8aa19fafd64e7c7bebde46cccdd14.tar.bz2 |
[multiple changes]
2017-09-06 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch7.adb (Entity_Table_Size): Change to nearest prime number.
2017-09-06 Yannick Moy <moy@adacore.com>
* sem_warn.adb: Minor refactoring.
2017-09-06 Ed Schonberg <schonberg@adacore.com>
* einfo.ads, einfo.adb (Get_Classwwide_Pragma): New utility,
to retrieve the inherited classwide precondition/postcondition
of a subprogram.
* freeze.adb (Freeze_Entity): Use Get_Classwide_Pragma when
freezing a subprogram, to complete the generation of the
corresponding checking code.
2017-09-06 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb (Analyze_Inlined_Bodies): Remove restriction on
loading of parent body with a with clause for the main unit.
* gcc-interface/decl.c (defer_limited_with_list): Document
new usage.
(gnat_to_gnu_entity) <E_Access_Type>: Handle
completed Taft Amendment types declared in external units like
types from limited with clauses. Adjust final processing of
defer_limited_with_list accordingly.
2017-09-06 Hristian Kirtchev <kirtchev@adacore.com>
* exp_util.adb (Is_Controlled_Indexing): New routine.
(Is_Displace_Call): Use routine Strip to remove indirections.
(Is_Displacement_Of_Object_Or_Function_Result): Code clean up. Add a
missing case of controlled generalized indexing.
(Is_Source_Object): Use routine Strip to remove indirections.
(Strip): New routine.
2017-09-06 Bob Duff <duff@adacore.com>
* sysdep.c (__gnat_has_cap_sys_nice): If HAVE_CAPABILITY is defined,
we include the proper header. Otherwise, we just declare the necessary
things from the capabilities library. This is so we can build on
machines without that library, while still enabling that library.
At run time, we're using weak symbols, so __gnat_has_cap_sys_nice will
simply return 0 if the library is not present, or not included
in the link.
2017-09-06 Pierre-Marie de Rodat <derodat@adacore.com>
* exp_dbug.adb (Debug_Renaming_Declaration): Do not create an encoding
for renamings that involve function calls in prefix form.
2017-09-06 Bob Duff <duff@adacore.com>
* sem_ch3.adb (Analyze_Subtype_Declaration):
Set Has_Delayed_Freeze on a subtype of an incomplete type.
2017-09-06 Pierre-Marie de Rodat <derodat@adacore.com>
* par_sco.adb (Extend_Statement_Sequence): When the accept statement
has no parameter specification and no entry index, use the entry name
as the end of the generated SCO statement.
From-SVN: r251785
Diffstat (limited to 'gcc/ada/sysdep.c')
-rw-r--r-- | gcc/ada/sysdep.c | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index 64278fd..455a78a 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -921,16 +921,40 @@ __gnat_is_file_not_found_error (int errno_val) { #if defined (__linux__) -/* HAVE_CAPABILITY is defined if sys/capability.h exists on the system where - this is being compiled. +/* Note well: If this code is modified, it should be tested by hand, + because automated testing doesn't exercise it. +*/ + +/* HAVE_CAPABILITY is supposed to be defined if sys/capability.h exists on the + system where this is being compiled. If this macro is defined, we #include + the header. Otherwise we have the relevant declarations textually here. */ #if defined (HAVE_CAPABILITY) #include <sys/capability.h> +#else -/* Note well: If this code is modified, it should be tested by hand, - because automated testing doesn't exercise it. -*/ +/* HAVE_CAPABILITY is not defined, so sys/capability.h does might not exist. */ + +typedef struct _cap_struct *cap_t; +typedef enum { + CAP_CLEAR=0, + CAP_SET=1 +} cap_flag_value_t; +#define CAP_SYS_NICE 23 +typedef enum { + CAP_EFFECTIVE=0, /* Specifies the effective flag */ + CAP_PERMITTED=1, /* Specifies the permitted flag */ + CAP_INHERITABLE=2 /* Specifies the inheritable flag */ +} cap_flag_t; + +typedef int cap_value_t; + +extern cap_t cap_get_proc(void); +extern int cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *); +extern int cap_free(void *); + +#endif /* __gnat_has_cap_sys_nice returns 1 if the current process has the CAP_SYS_NICE capability. This capability is necessary to use the @@ -945,9 +969,12 @@ __gnat_is_file_not_found_error (int errno_val) { symbols will be 0, and __gnat_has_cap_sys_nice will return 0. */ -static cap_t cap_get_proc_weak() __attribute__ ((weakref ("cap_get_proc"))); -static int cap_get_flag_weak() __attribute__ ((weakref ("cap_get_flag"))); -static int cap_free_weak() __attribute__ ((weakref ("cap_free"))); +static cap_t cap_get_proc_weak(void) + __attribute__ ((weakref ("cap_get_proc"))); +static int cap_get_flag_weak(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *) + __attribute__ ((weakref ("cap_get_flag"))); +static int cap_free_weak(void *) + __attribute__ ((weakref ("cap_free"))); int __gnat_has_cap_sys_nice () { @@ -957,11 +984,11 @@ __gnat_has_cap_sys_nice () { return 0; cap_t caps = cap_get_proc_weak(); - cap_flag_value_t value; - if (caps == NULL) return 0; + cap_flag_value_t value; + if (cap_get_flag_weak(caps, CAP_SYS_NICE, CAP_EFFECTIVE, &value) == -1) return 0; @@ -973,20 +1000,6 @@ __gnat_has_cap_sys_nice () { return 0; } - -#else - -/* HAVE_CAPABILITY is not defined, so sys/capability.h does not exist, so - simply indicate that the current process does not have the CAP_SYS_NICE - capability. -*/ - -int -__gnat_has_cap_sys_nice () { - return 0; -} - -#endif #endif #ifdef __ANDROID__ |