SIG33 : constant := 33; -- glibc internal signal
SIG34 : constant := 34; -- glibc internal signal
- -- struct_sigaction offsets
-
- -- sa_flags come first on aarch64-android (sa_flags, sa_handler, sa_mask)
-
- sa_flags_pos : constant := 0;
- sa_handler_pos : constant := sa_flags_pos + Interfaces.C.int'Size / 8;
- sa_mask_pos : constant := sa_handler_pos + Standard'Address_Size / 8;
+ -- struct_sigaction
+
+ generic
+ type sigset_t is private;
+ package Android_Sigaction is
+ type struct_sigaction is record
+ sa_flags : Interfaces.C.int;
+ sa_handler : System.Address;
+ sa_mask : sigset_t;
+ sa_restorer : System.Address;
+ end record;
+ pragma Convention (C, struct_sigaction);
+ end Android_Sigaction;
SA_SIGINFO : constant := 16#00000004#;
SA_ONSTACK : constant := 16#08000000#;
SIG33 : constant := 33; -- glibc internal signal
SIG34 : constant := 34; -- glibc internal signal
- -- struct_sigaction offsets
-
- sa_handler_pos : constant := 0;
- sa_mask_pos : constant := Standard'Address_Size / 8;
- sa_flags_pos : constant := 4 + sa_mask_pos;
+ -- struct_sigaction
+
+ generic
+ type sigset_t is private;
+ package Android_Sigaction is
+ type struct_sigaction is record
+ sa_handler : System.Address;
+ sa_mask : sigset_t;
+ sa_flags : Interfaces.C.int;
+ sa_restorer : System.Address;
+ end record;
+ pragma Convention (C, struct_sigaction);
+ end Android_Sigaction;
SA_SIGINFO : constant := 16#00000004#;
SA_ONSTACK : constant := 16#08000000#;
-- Not clear why these two signals are reserved. Perhaps they are not
-- supported by this version of GNU/Linux ???
- type sigset_t is private;
+ -- struct sigaction fields are of different sizes and come in different
+ -- order on ARM vs aarch64. As this source is shared by the two
+ -- configurations, fetch the type definition through System.Linux, which
+ -- is specialized.
+
+ type sigset_t is
+ array (0 .. OS_Constants.SIZEOF_sigset - 1) of Interfaces.C.unsigned_char;
+ pragma Convention (C, sigset_t);
+ for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment;
+
+ package Android_Sigaction is new
+ System.Linux.Android_Sigaction (sigset_t => sigset_t);
+
+ type struct_sigaction is new Android_Sigaction.struct_sigaction;
function sigaddset (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigaddset, "_sigaddset");
end record;
pragma Convention (C, siginfo_t);
- type struct_sigaction is record
- sa_handler : System.Address;
- sa_mask : sigset_t;
- sa_flags : Interfaces.C.int;
- sa_restorer : System.Address;
- end record;
- pragma Convention (C, struct_sigaction);
-
type struct_sigaction_ptr is access all struct_sigaction;
SA_SIGINFO : constant := System.Linux.SA_SIGINFO;
private
- type sigset_t is
- array (0 .. OS_Constants.SIZEOF_sigset - 1) of unsigned_char;
- pragma Convention (C, sigset_t);
- for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment;
-
- pragma Warnings (Off);
- for struct_sigaction use record
- sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1;
- sa_mask at Linux.sa_mask_pos
- range 0 .. OS_Constants.SIZEOF_sigset * 8 - 1;
- sa_flags at Linux.sa_flags_pos
- range 0 .. Interfaces.C.int'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;
type time_t is range -2 ** (System.Parameters.time_t_bits - 1)