From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,5edee74b13d8e50a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: The "black magic" of ioctl Date: Sun, 24 Oct 2010 19:36:34 +0100 Organization: A noiseless patient Spider Message-ID: References: <74b46743-fb81-48cc-a478-ffd069db2fc6@k22g2000yqh.googlegroups.com> <877hh8lkok.fsf@mid.deneb.enyo.de> <87fwvv4gpg.fsf@mid.deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx01.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="22205"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/zxShx6TanRaNIcZ/LIt/2ml7iNwJwp4=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:3zlnrd04w6eF6VQTu1oLZ9xSlME= sha1:OEGg9Kvkkpf2W0kmQSRPM/ZGz9g= Xref: g2news1.google.com comp.lang.ada:14721 Date: 2010-10-24T19:36:34+01:00 List-Id: Florian Weimer writes: > * Frank J. Lhota: > >> Actually, you can call a varargs function such as ioctl from >> Ada. Declare each ioctl profile that you need, e.g. > > Perhaps it seems to work for you, but this is not portable. There are > popular targets where the varargs calling convention is markedly > different from the non-varargs calling convention, such as amd64. It > might still work by accident, but all bets are off, really. I hadn't realised this: but a quick scan of the GNAT sources confirms: in socket.c, * Wrapper for ioctl(2), which is a variadic function */ int __gnat_socket_ioctl (int fd, int req, int *arg) { #if defined (_WIN32) return ioctlsocket (fd, req, arg); #else return ioctl (fd, req, arg); #endif }