summaryrefslogtreecommitdiff
path: root/gcc/ada/s-osinte-linux.ads
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-04-08 08:43:15 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-04-08 08:43:15 +0200
commit770db697e62902a236c8cb4cf0e8b6cc52051703 (patch)
tree0e9bcf675dab91b0449162ce9f89d2a5215ca347 /gcc/ada/s-osinte-linux.ads
parent42c3898c1d9a5351eaac6ffd792a5d1aaa268435 (diff)
downloadgcc-770db697e62902a236c8cb4cf0e8b6cc52051703.tar.gz
s-osinte-linux-alpha.ads, [...]: Removed.
2008-04-08 Eric Botcazou <ebotcazou@adacore.com> Arnaud Charlet <charlet@adacore.com> * s-osinte-linux-alpha.ads, s-osinte-linux-hppa.ads: Removed. s-taspri-posix-noaltstack.ads, s-linux.ads, s-linux-alpha.ads, s-linux-hppa.ads: New files. Disable alternate stack on ia64-hpux. * s-osinte-lynxos-3.ads, (Alternate_Stack): Remove when not needed. Simplify declaration otherwise. (Alternate_Stack_Size): New constant. s-osinte-mingw.ads, s-taprop-mingw.adb: Code clean up: avoid use of 'Unrestricted_Access. * s-osinte-hpux.ads, s-osinte-solaris-posix.ads, s-osinte-aix.ads, s-osinte-lynxos.ads, s-osinte-freebsd.ads s-osinte-darwin.ads, s-osinte-tru64.ads, s-osinte-irix.ads, s-osinte-linux.ads, s-osinte-solaris.ads, s-osinte-vms.ads (SA_ONSTACK): New constant. (stack_t): New record type. (sigaltstack): New imported function. (Alternate_Stack): New imported variable. (Alternate_Stack_Size): New constant. * system-linux-x86_64.ads: (Stack_Check_Probes): Set to True. * s-taspri-lynxos.ads, s-taspri-solaris.ads, s-taspri-tru64.ads, s-taspri-hpux-dce.ads (Task_Address): New subtype of System.Address (Task_Address_Size): New constant size of System.Address (Alternate_Stack_Size): New constant. * s-taprop-posix.adb, s-taprop-linux.adb (Get_Stack_Attributes): Delete. (Enter_Task): Do not notify stack to System.Stack_Checking.Operations. Establish the alternate stack if the platform makes use of n alternate signal stack for stack overflows. (Create_Task): Take into account the alternate stack in the stack size. (Initialize): Save the address of the alternate stack into the ATCB for the environment task. (Create_Task): Fix assertions for NPTL library (vs old LinuxThreads). * s-parame.adb (Minimum_Stack_Size): Increase value to 16K to * system-linux-x86.ads: (Stack_Check_Probes): Set to True. * s-intman-posix.adb: (Initialize): Set SA_ONSTACK for SIGSEGV if the platform makes use of an alternate signal stack for stack overflows. * init.c (__gnat_adjust_context_for_raise, Linux version): On i386 and x86-64, adjust the saved value of the stack pointer if the signal was raised by a stack checking probe. (HP-UX section): Use global __gnat_alternate_stack as signal handler stack and only for SIGSEGV. (Linux section): Likewise on x86 and x86-64. [VxWorks section] (__gnat_map_signal): Now static. (__gnat_error_handler): Not static any more. (__gnat_adjust_context_for_raise): New function. Signal context adjustment for PPC && !VTHREADS && !RTP, as required by the zcx propagation circuitry. (__gnat_error_handler): Second argument of a sigaction handler is a pointer, not an int, and is unused. Adjust signal context before mapping to exception. Install signal handlers for LynxOS case. * s-taskin.ads (Common_ATCB): New field Task_Alternate_Stack. (Task_Id): Set size to Task_Address_Size (To_Task_id): Unchecked convert from Task_Address vice System.Address (To_Address): Unchecked convert to Task_Address vice System.Address * s-tassta.adb (Task_Wrapper): Define the alternate stack and save its address into the ATCB if the platform makes use of an alternate signal stack for stack overflows. (Free_Task): Add call to Finalize_Attributes_Link. Add argument Relative_Deadline to pass the value specified for the task. This is not yet used for any target. * s-tassta.ads (Create_Task): Add argument Relative_Deadline to pass the value specified for the task. From-SVN: r134004
Diffstat (limited to 'gcc/ada/s-osinte-linux.ads')
-rw-r--r--gcc/ada/s-osinte-linux.ads150
1 files changed, 84 insertions, 66 deletions
diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index bb06c01a0b8..bbaa0b4282e 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -41,8 +41,8 @@
-- Preelaborate. This package is designed to be a bottom-level (leaf) package.
with Ada.Unchecked_Conversion;
-
with Interfaces.C;
+with System.Linux;
package System.OS_Interface is
pragma Preelaborate;
@@ -67,12 +67,12 @@ package System.OS_Interface is
function errno return int;
pragma Import (C, errno, "__get_errno");
- EAGAIN : constant := 11;
- EINTR : constant := 4;
- EINVAL : constant := 22;
- ENOMEM : constant := 12;
- EPERM : constant := 1;
- ETIMEDOUT : constant := 110;
+ EAGAIN : constant := System.Linux.EAGAIN;
+ EINTR : constant := System.Linux.EINTR;
+ EINVAL : constant := System.Linux.EINVAL;
+ ENOMEM : constant := System.Linux.ENOMEM;
+ EPERM : constant := System.Linux.EPERM;
+ ETIMEDOUT : constant := System.Linux.ETIMEDOUT;
-------------
-- Signals --
@@ -82,44 +82,44 @@ package System.OS_Interface is
type Signal is new int range 0 .. Max_Interrupt;
for Signal'Size use int'Size;
- SIGHUP : constant := 1; -- hangup
- SIGINT : constant := 2; -- interrupt (rubout)
- SIGQUIT : constant := 3; -- quit (ASCD FS)
- SIGILL : constant := 4; -- illegal instruction (not reset)
- SIGTRAP : constant := 5; -- trace trap (not reset)
- SIGIOT : constant := 6; -- IOT instruction
- SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
- SIGFPE : constant := 8; -- floating point exception
- SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
- SIGBUS : constant := 7; -- bus error
- SIGSEGV : constant := 11; -- segmentation violation
- SIGPIPE : constant := 13; -- write on a pipe with no one to read it
- SIGALRM : constant := 14; -- alarm clock
- SIGTERM : constant := 15; -- software termination signal from kill
- SIGUSR1 : constant := 10; -- user defined signal 1
- SIGUSR2 : constant := 12; -- user defined signal 2
- SIGCLD : constant := 17; -- alias for SIGCHLD
- SIGCHLD : constant := 17; -- child status change
- SIGPWR : constant := 30; -- power-fail restart
- SIGWINCH : constant := 28; -- window size change
- SIGURG : constant := 23; -- urgent condition on IO channel
- SIGPOLL : constant := 29; -- pollable event occurred
- SIGIO : constant := 29; -- I/O now possible (4.2 BSD)
- SIGLOST : constant := 29; -- File lock lost
- SIGSTOP : constant := 19; -- stop (cannot be caught or ignored)
- SIGTSTP : constant := 20; -- user stop requested from tty
- SIGCONT : constant := 18; -- stopped process has been continued
- SIGTTIN : constant := 21; -- background tty read attempted
- SIGTTOU : constant := 22; -- background tty write attempted
- SIGVTALRM : constant := 26; -- virtual timer expired
- SIGPROF : constant := 27; -- profiling timer expired
- SIGXCPU : constant := 24; -- CPU time limit exceeded
- SIGXFSZ : constant := 25; -- filesize limit exceeded
- SIGUNUSED : constant := 31; -- unused signal (GNU/Linux)
- SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux)
- SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal
- SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal
- SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal
+ SIGHUP : constant := System.Linux.SIGHUP;
+ SIGINT : constant := System.Linux.SIGINT;
+ SIGQUIT : constant := System.Linux.SIGQUIT;
+ SIGILL : constant := System.Linux.SIGILL;
+ SIGTRAP : constant := System.Linux.SIGTRAP;
+ SIGIOT : constant := System.Linux.SIGIOT;
+ SIGABRT : constant := System.Linux.SIGABRT;
+ SIGFPE : constant := System.Linux.SIGFPE;
+ SIGKILL : constant := System.Linux.SIGKILL;
+ SIGBUS : constant := System.Linux.SIGBUS;
+ SIGSEGV : constant := System.Linux.SIGSEGV;
+ SIGPIPE : constant := System.Linux.SIGPIPE;
+ SIGALRM : constant := System.Linux.SIGALRM;
+ SIGTERM : constant := System.Linux.SIGTERM;
+ SIGUSR1 : constant := System.Linux.SIGUSR1;
+ SIGUSR2 : constant := System.Linux.SIGUSR2;
+ SIGCLD : constant := System.Linux.SIGCLD;
+ SIGCHLD : constant := System.Linux.SIGCHLD;
+ SIGPWR : constant := System.Linux.SIGPWR;
+ SIGWINCH : constant := System.Linux.SIGWINCH;
+ SIGURG : constant := System.Linux.SIGURG;
+ SIGPOLL : constant := System.Linux.SIGPOLL;
+ SIGIO : constant := System.Linux.SIGIO;
+ SIGLOST : constant := System.Linux.SIGLOST;
+ SIGSTOP : constant := System.Linux.SIGSTOP;
+ SIGTSTP : constant := System.Linux.SIGTSTP;
+ SIGCONT : constant := System.Linux.SIGCONT;
+ SIGTTIN : constant := System.Linux.SIGTTIN;
+ SIGTTOU : constant := System.Linux.SIGTTOU;
+ SIGVTALRM : constant := System.Linux.SIGVTALRM;
+ SIGPROF : constant := System.Linux.SIGPROF;
+ SIGXCPU : constant := System.Linux.SIGXCPU;
+ SIGXFSZ : constant := System.Linux.SIGXFSZ;
+ SIGUNUSED : constant := System.Linux.SIGUNUSED;
+ SIGSTKFLT : constant := System.Linux.SIGSTKFLT;
+ SIGLTHRRES : constant := System.Linux.SIGLTHRRES;
+ SIGLTHRCAN : constant := System.Linux.SIGLTHRCAN;
+ SIGLTHRDBG : constant := System.Linux.SIGLTHRDBG;
SIGADAABORT : constant := SIGABRT;
-- Change this if you want to use another signal for task abort.
@@ -181,12 +181,13 @@ package System.OS_Interface is
pragma Convention (C, siginfo_t);
type struct_sigaction is record
- sa_handler : System.Address;
- sa_mask : sigset_t;
- sa_flags : unsigned_long;
- sa_restorer : System.Address;
+ sa_handler : System.Address;
+ sa_mask : sigset_t;
+ sa_flags : Interfaces.C.unsigned_long;
+ sa_restorer : System.Address;
end record;
pragma Convention (C, struct_sigaction);
+
type struct_sigaction_ptr is access all struct_sigaction;
type Machine_State is record
@@ -199,7 +200,8 @@ package System.OS_Interface is
end record;
type Machine_State_Ptr is access all Machine_State;
- SA_SIGINFO : constant := 16#04#;
+ SA_SIGINFO : constant := System.Linux.SA_SIGINFO;
+ SA_ONSTACK : constant := System.Linux.SA_ONSTACK;
SIG_BLOCK : constant := 0;
SIG_UNBLOCK : constant := 1;
@@ -299,6 +301,25 @@ package System.OS_Interface is
-- Stack --
-----------
+ type stack_t is record
+ ss_sp : System.Address;
+ ss_flags : int;
+ ss_size : size_t;
+ end record;
+ pragma Convention (C, stack_t);
+
+ function sigaltstack
+ (ss : not null access stack_t;
+ oss : access stack_t) return int;
+ pragma Import (C, sigaltstack, "sigaltstack");
+
+ Alternate_Stack : aliased System.Address;
+ pragma Import (C, Alternate_Stack, "__gnat_alternate_stack");
+ -- The alternate signal stack for stack overflows
+
+ Alternate_Stack_Size : constant := 16 * 1024;
+ -- This must be in keeping with init.c:__gnat_alternate_stack
+
function Get_Stack_Base (thread : pthread_t) return Address;
pragma Inline (Get_Stack_Base);
-- This is a dummy procedure to share some GNULLI files
@@ -483,9 +504,19 @@ package System.OS_Interface is
private
- type sigset_t is array (0 .. 127) of unsigned_char;
+ type sigset_t is array (0 .. 127) of Interfaces.C.unsigned_char;
pragma Convention (C, sigset_t);
- for sigset_t'Alignment use unsigned_long'Alignment;
+ for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment;
+
+ pragma Warnings (Off);
+ for struct_sigaction use record
+ sa_handler at 0 range 0 .. Standard'Address_Size - 1;
+ sa_mask at Linux.sa_mask_pos range 0 .. 1023;
+ sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1;
+ end record;
+ -- We intentionally leave sa_restorer unspecified and let the compiler
+ -- append it after the last field, so disable corresponding warning.
+ pragma Warnings (On);
type pid_t is new int;
@@ -526,20 +557,7 @@ private
end record;
pragma Convention (C, pthread_mutexattr_t);
- type struct_pthread_fast_lock is record
- status : long;
- spinlock : int;
- end record;
- pragma Convention (C, struct_pthread_fast_lock);
-
- type pthread_mutex_t is record
- m_reserved : int;
- m_count : int;
- m_owner : System.Address;
- m_kind : int;
- m_lock : struct_pthread_fast_lock;
- end record;
- pragma Convention (C, pthread_mutex_t);
+ type pthread_mutex_t is new System.Linux.pthread_mutex_t;
type pthread_cond_t is array (0 .. 47) of unsigned_char;
pragma Convention (C, pthread_cond_t);