comp.lang.ada
 help / color / mirror / Atom feed
* Ada/Linux/select() problem
@ 1997-04-02  0:00 moelands j.m.
  1997-04-04  0:00 ` Simon Wright
  0 siblings, 1 reply; 2+ messages in thread
From: moelands j.m. @ 1997-04-02  0:00 UTC (permalink / raw)



I have a problem with the select() system call on linux in combination
with Ada.

The following short example program, consisting of an Ada main routine 
main.adb, an interface package sel.ad[sb] providing the interface between
Ada and C, and a file dosel.c containing the C routine calling select(), 
does run on a Unix machine (as it should, imo). However, it does not run 
under linux - the result is a core dump. The call to select() seems to 
garble the stack.

I use gnat 3.09 and linux 2.0.0. Does anybody have any idea what might
cause this problem?
=======
dosel.c:
=======
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <bstring.h>
#include <sys/time.h>


int do_select(void)
{
   int channel_no = 1;
   fd_set read_mask;
   struct timeval input_timer;

   input_timer.tv_sec  = 0;
   input_timer.tv_usec = 0;
   FD_ZERO (&read_mask);
   FD_SET (channel_no, &read_mask);

   return select (32, &read_mask, NULL, NULL, &input_timer);
}

=======
sel.ads:
=======
package Sel is

procedure My_Select;

end Sel;

=======
sel.adb:
=======
package body Sel is

procedure Do_Select;
pragma Interface (C, Do_Select);

procedure My_Select is
begin
   Do_Select;
end My_Select;

end Sel;
========
main.adb:
========
with Sel; 

procedure Main is
begin
  Sel.My_Select;
end Main;
======


Jeroen Moelands (moelands@nlr.nl)




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Ada/Linux/select() problem
  1997-04-02  0:00 Ada/Linux/select() problem moelands j.m.
@ 1997-04-04  0:00 ` Simon Wright
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Wright @ 1997-04-04  0:00 UTC (permalink / raw)



"moelands j.m." <moelands@nlr.nl> writes:

> I have a problem with the select() system call on linux in combination
> with Ada.
> 
> The following short example program, consisting of an Ada main routine 
> main.adb, an interface package sel.ad[sb] providing the interface between
> Ada and C, and a file dosel.c containing the C routine calling select(), 
> does run on a Unix machine (as it should, imo). However, it does not run 
> under linux - the result is a core dump. The call to select() seems to 
> garble the stack.
> 
> I use gnat 3.09 and linux 2.0.0. Does anybody have any idea what might
> cause this problem?

Works fine here (2.0.29). What system library versions are you using?

pogner[26]$ ldd main
        libgnat.so => /usr/lib/libgnat.so.3.09
        libc.so.5 => /lib/libc.so.5.4.17
        libpthreads.so.1 => /usr/lib/libpthreads.so.1.60.4
        libm.so.5 => /lib/libm.so.5.0.7

-Simon




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-04-04  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-02  0:00 Ada/Linux/select() problem moelands j.m.
1997-04-04  0:00 ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox