1------------------------------------------------------------------------------
2--                                                                          --
3--                GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS               --
4--                                                                          --
5--                          S Y S T E M .  L I N U X                        --
6--                                                                          --
7--                                  S p e c                                 --
8--                                                                          --
9--            Copyright (C) 2014, Free Software Foundation, Inc.            --
10--                                                                          --
11-- GNARL is free software; you can  redistribute it  and/or modify it under --
12-- terms of the  GNU General Public License as published  by the Free Soft- --
13-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
17--                                                                          --
18-- As a special exception under Section 7 of GPL version 3, you are granted --
19-- additional permissions described in the GCC Runtime Library Exception,   --
20-- version 3.1, as published by the Free Software Foundation.               --
21--                                                                          --
22-- In particular,  you can freely  distribute your programs  built with the --
23-- GNAT Pro compiler, including any required library run-time units,  using --
24-- any licensing terms  of your choosing.  See the AdaCore Software License --
25-- for full details.                                                        --
26--                                                                          --
27--                                                                          --
28------------------------------------------------------------------------------
29
30--  This is the Android version of this package
31
32--  This package encapsulates cpu specific differences between implementations
33--  of GNU/Linux, in order to share s-osinte-linux.ads.
34
35--  PLEASE DO NOT add any with-clauses to this package or remove the pragma
36--  Preelaborate. This package is designed to be a bottom-level (leaf) package
37
38with Interfaces.C;
39
40package System.Linux is
41   pragma Preelaborate;
42
43   ----------
44   -- Time --
45   ----------
46
47   subtype long        is Interfaces.C.long;
48   subtype suseconds_t is Interfaces.C.long;
49   subtype time_t      is Interfaces.C.long;
50   subtype clockid_t   is Interfaces.C.int;
51
52   type timespec is record
53      tv_sec  : time_t;
54      tv_nsec : long;
55   end record;
56   pragma Convention (C, timespec);
57
58   type timeval is record
59      tv_sec  : time_t;
60      tv_usec : suseconds_t;
61   end record;
62   pragma Convention (C, timeval);
63
64   -----------
65   -- Errno --
66   -----------
67
68   EAGAIN    : constant := 11;
69   EINTR     : constant := 4;
70   EINVAL    : constant := 22;
71   ENOMEM    : constant := 12;
72   EPERM     : constant := 1;
73   ETIMEDOUT : constant := 110;
74
75   -------------
76   -- Signals --
77   -------------
78
79   SIGHUP     : constant := 1; --  hangup
80   SIGINT     : constant := 2; --  interrupt (rubout)
81   SIGQUIT    : constant := 3; --  quit (ASCD FS)
82   SIGILL     : constant := 4; --  illegal instruction (not reset)
83   SIGTRAP    : constant := 5; --  trace trap (not reset)
84   SIGIOT     : constant := 6; --  IOT instruction
85   SIGABRT    : constant := 6; --  used by abort, replace SIGIOT in the  future
86   SIGFPE     : constant := 8; --  floating point exception
87   SIGKILL    : constant := 9; --  kill (cannot be caught or ignored)
88   SIGBUS     : constant := 7; --  bus error
89   SIGSEGV    : constant := 11; --  segmentation violation
90   SIGPIPE    : constant := 13; --  write on a pipe with no one to read it
91   SIGALRM    : constant := 14; --  alarm clock
92   SIGTERM    : constant := 15; --  software termination signal from kill
93   SIGUSR1    : constant := 10; --  user defined signal 1
94   SIGUSR2    : constant := 12; --  user defined signal 2
95   SIGCLD     : constant := 17; --  alias for SIGCHLD
96   SIGCHLD    : constant := 17; --  child status change
97   SIGPWR     : constant := 30; --  power-fail restart
98   SIGWINCH   : constant := 28; --  window size change
99   SIGURG     : constant := 23; --  urgent condition on IO channel
100   SIGPOLL    : constant := 29; --  pollable event occurred
101   SIGIO      : constant := 29; --  I/O now possible (4.2 BSD)
102   SIGLOST    : constant := 29; --  File lock lost
103   SIGSTOP    : constant := 19; --  stop (cannot be caught or ignored)
104   SIGTSTP    : constant := 20; --  user stop requested from tty
105   SIGCONT    : constant := 18; --  stopped process has been continued
106   SIGTTIN    : constant := 21; --  background tty read attempted
107   SIGTTOU    : constant := 22; --  background tty write attempted
108   SIGVTALRM  : constant := 26; --  virtual timer expired
109   SIGPROF    : constant := 27; --  profiling timer expired
110   SIGXCPU    : constant := 24; --  CPU time limit exceeded
111   SIGXFSZ    : constant := 25; --  filesize limit exceeded
112   SIGUNUSED  : constant := 31; --  unused signal (GNU/Linux)
113   SIGSTKFLT  : constant := 16; --  coprocessor stack fault (Linux)
114   SIGLTHRRES : constant := 32; --  GNU/LinuxThreads restart signal
115   SIGLTHRCAN : constant := 33; --  GNU/LinuxThreads cancel signal
116   SIGLTHRDBG : constant := 34; --  GNU/LinuxThreads debugger signal
117
118   --  struct_sigaction offsets
119
120   sa_handler_pos : constant := 0;
121   sa_mask_pos    : constant := Standard'Address_Size / 8;
122   sa_flags_pos   : constant := 4 + sa_mask_pos;
123
124   SA_SIGINFO  : constant := 16#00000004#;
125   SA_ONSTACK  : constant := 16#08000000#;
126   SA_RESTART  : constant := 16#10000000#;
127   SA_NODEFER  : constant := 16#40000000#;
128
129end System.Linux;
130