Bug 37945 - GNAT Sockaddr and Sockaddr_In does not match c-structures on RTEMS
Summary: GNAT Sockaddr and Sockaddr_In does not match c-structures on RTEMS
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-28 21:16 UTC by Petri Rokka
Modified: 2012-05-26 14:34 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-11-05 20:38:03


Attachments
adds RTEMS specific g-socthi* (6.64 KB, patch)
2008-11-05 20:35 UTC, Joel Sherrill
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petri Rokka 2008-10-28 21:16:07 UTC
RTEMS has FreeBSD style structures:

Sockaddr and Sockaddr_In should have the 8bit Len and Family variable instead of
16 family in gcc/ada/socthi.ads.

Bug prevents at least binding local address to socket, connecting tcp socket or sending udp data.

diff g-socthi.ads g-socthi-rtems.ads
145c145,146
<       Sa_Family : C.unsigned_short;
---
>       Sa_Len    : C.unsigned_char;
>       Sa_Family : C.unsigned_char;
156c157,158
<       Sin_Family : C.unsigned_short      := Constants.AF_INET;
---
>       Sin_Len    : C.unsigned_char       := 0;
>       Sin_Family : C.unsigned_char       := Constants.AF_INET;


diff g-socthi.adb g-socthi-rtems.adb
451c451
<       Sin.Sin_Family := C.unsigned_short (Family);
---
>       Sin.Sin_Family := C.unsigned_char (Family);
Comment 1 Joel Sherrill 2008-10-28 22:00:11 UTC
This does not impact the SVN trunk.  

This requires adding g-socthi-rtems.ads and corresponding Makefile.in change. I will prepare and test a complete patch.

We wondered if this is broken for FreeBSD as well.  We use the FreeBSD TCP/IP stack in RTEMS and it should be broken the same way.  Can someone confirm that?
Comment 2 Joel Sherrill 2008-11-05 20:35:58 UTC
Created attachment 16626 [details]
adds RTEMS specific g-socthi*

Fixes issue.  Not needed on head.
Comment 3 Joel Sherrill 2008-11-05 20:38:03 UTC
Please commit to 4.3 branch.  Not needed on trunk since it uses a different implementation of these files.

2008-11-05  Joel Sherrill <joel.sherrill@oarcorp.com>

  * g-socthi-rtems.ad[sb]: New files.
  * Makefile.in: Add RTEMS specific files.
Comment 4 Eric Botcazou 2009-11-10 08:24:24 UTC
Was the patch posted on gcc-patches@ at some point?
Comment 5 Joel Sherrill 2009-11-10 11:57:30 UTC
(In reply to comment #4)
> Was the patch posted on gcc-patches@ at some point?
> 

It has been over a year and I honestly don't know.  I will repost on general principal.
Comment 6 Eric Botcazou 2012-05-26 14:34:29 UTC
Obsolete.