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: 103376,5edee74b13d8e50a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!k22g2000yqh.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: The "black magic" of ioctl Date: Thu, 21 Oct 2010 03:20:23 -0700 (PDT) Organization: http://groups.google.com Message-ID: <74b46743-fb81-48cc-a478-ffd069db2fc6@k22g2000yqh.googlegroups.com> References: NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1287656424 911 127.0.0.1 (21 Oct 2010 10:20:24 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 21 Oct 2010 10:20:24 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k22g2000yqh.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.6) Gecko/2009012111 Red Hat/3.0.6-1.el5 Firefox/3.0.6,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:15617 Date: 2010-10-21T03:20:23-07:00 List-Id: Francesco Piraneo Giuliano wrote: > In linux we have the ioctl function that allows to control or get > informations about an open device. > > Questions: > > - I have not clear if the ioctl is a function of POSIX compliant os'es > so it can be handled by ADA libflorist or is a linux-specific function > that we have to import in ADA with a PRAGMA IMPORT; > > - In the case that ioctl is a standard POSIX function, I'm very glad > if someone can address me to the right function in libflorist... I've > not found anything similar. The title of your post is quite correct; ioctl is indeed black magic :) POSIX[1] defines this function, as "obsolescent" mind you, along with several values of the request parameter but most operating systems add nonstandard values to the standard ones. Most of these values are appropriate only for certain kinds of device. Depending on the value of the request parameter, ioctl performs entirely different things and takes a different arg parameter; it is a variadic function which has no equivalent in Ada. So, calls to ioctl are sometimes portable (if request has one of the standard values), sometimes non-portable across operating systems, sometimes non-portable across devices on a single machine, and always obsolescent! Therefore, a thick Ada binding would not expose ioctl directly but instead offer a different subprogram (with the appropriate parameters) for each supported value of the request parameter. This may explain why Florist has no binding to ioctl. GNAT.Sockets has one in the body off the package but it is used for only one specific value of the request parameter. So I suggest you create a binding only for the specific purpose you need ioctl for and use that. [1] http://www.opengroup.org/onlinepubs/9699919799/ > - Thank you very much to the guy that called "florist" a library for > interfacing ADA with POSIX compliant os'es!! So when I google about it > I get lot of flower's sellers called "Ada"... all around the world! I normally look in the sources themselves, since the specs are the most comprehensive, up-to-date and correct documentation. > - Thank also to the guy that thought to call Ada language ... "Ada"! > May be better something like "Lovelace" or "Byron"? Just to avoid the > tons of porn related material about the various "Ada" showgirls.... :- > ( (Thank you google to index also the porns...) "+Ada +POSIX +Florist" gives good results in combination. > - I can understand also the guys that reading my post will thought: > "Hey, man!! You MUST know everything about POSIX and ADA and C and > LINUX and IEEE standard and ISO standards and...{put what you want}" - > Yeah guy! You have reason, but not everyone has so strong knowledge of > all this materials... is for that reason a nice and FOCUSED > documentation about libflorist would be interesting... saying "You > must already know" is not a nice reason to avoid to write > documentations! I work in automatic machines and the documentation is > compared as a SAFETY FEATURE of the machine itself... just to tell you > how a well written document is very important to avoid troubles... > (very often with LEGAL - i.e. -> JAIL - implications... ;-))) See [1] above for the official documentation of POSIX. The additional, non-standard values of "request" along with the parameter profiles are in the ioctl_list(2) man page installed on your machine. See that and despair... HTH -- Ludovic Brenta.