This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Add C wrapper for ioctl(2) for sockets binding

This change introduces a C wrapper for use at places where the GNAT sockets
binding invokes the ioctl(2) system call. This is required because ioctl(2)
is a variadic C function, and on some platforms (most notably x86_64) such
functions cannot be directly called from Ada code.

The following program must compile cleanly and display "PASS":

with GNAT.Sockets; use GNAT.Sockets;
with Ada.Text_IO;
with Interfaces.C;

procedure Simple_NB_Sock is
   NON_BLOCKING_REQUEST : GNAT.Sockets.Request_Type :=
                            (Name    => GNAT.Sockets.Non_Blocking_IO,
                             Enabled => True);
   Server   : Socket_Type;
            Socket  => Server,
            Request => NON_BLOCKING_REQUEST);
end Simple_NB_Sock;

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-06-19  Thomas Quinot  <>

	* socket.c, g-socthi-vms.adb,, g-socthi-vxworks.adb,, g-socthi-mingw.adb,,
	g-socthi.adb,, g-socket.adb,
	(GNAT.Sockets.Thin.C_Ioctl): Rename to Socket_Ioctl.
	(GNAT.Sockets.Thin.Socket_Ioctl): Use new function
	(GNAT.Sockets.Thin_Common.Socket_Ioctl): Binding to new C wrapper
	(__gnat_socket_ioctl): Wrapper for ioctl(2) called with a single int*
	argument after the file descriptor and request code.

Attachment: difs
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]