Bug 14195 - Suggestion for System.OS_Interface.struct_sigaction
Summary: Suggestion for System.OS_Interface.struct_sigaction
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-18 16:31 UTC by oliver.kellogg
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: -
Target: i386-linux
Build: -
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oliver.kellogg 2004-02-18 16:31:18 UTC
This is a wish, not a bug.
It applies to all recent versions of GNAT up to and including GNU
CVS mainline of 2004/02/18.

The type struct_sigaction in package System.OS_Interface is
defined as follows:

   type struct_sigaction is record
      sa_handler : System.Address;
      sa_mask    : sigset_t;
      sa_flags   : int;
   end record;
   pragma Convention (C, struct_sigaction);

I suggest making the sa_mask component aliased, i.e.

      sa_mask    : aliased sigset_t;

Reason: The common use case is to create a sigset_t using the

   function sigemptyset (set : access sigset_t) return int;

or other function from the same package.
If the sa_mask component in struct_sigaction is made aliased
then the usage is simplified:

   declare
      sa : struct_sigaction;
      retval : int := sigemptyset (sa.sa_mask'access);
   begin
      ...
   end;

Without the aliasing, it is necessary to use a separate
temporary variable for the sigset_t:

   declare
      temp_sigset : aliased sigset_t;
      sa : struct_sigaction;
      retval : int := sigemptyset (temp_sigset'access);
   begin
      sa.sa_mask := temp_sigset;
   end;


Thanks.
Comment 1 Arnaud Charlet 2004-02-18 16:59:14 UTC
That would indeed allow some clean ups in various gnat run time files.
Feel free so submit a patch to that effect.

Arno
Comment 2 oliver.kellogg 2004-02-20 11:26:57 UTC
After talking to Arno, it seems that this change would require to
fully retest all signal handling related functions that take a
struct_sigaction on all supported platforms.
That is something I cannot do and I therefore retire the request.