comp.lang.ada
 help / color / mirror / Atom feed
From: "moelands j.m." <moelands@nlr.nl>
Subject: Ada/Linux/select() problem
Date: 1997/04/02
Date: 1997-04-02T00:00:00+00:00	[thread overview]
Message-ID: <334281E6.2781@nlr.nl> (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)




             reply	other threads:[~1997-04-02  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-02  0:00 moelands j.m. [this message]
1997-04-04  0:00 ` Ada/Linux/select() problem Simon Wright
replies disabled

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