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!l8g2000yql.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: The "black magic" of ioctl Date: Thu, 21 Oct 2010 05:04:47 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3ac70a0f-ada2-4e8b-bd68-85cd72c91202@l8g2000yql.googlegroups.com> References: <74b46743-fb81-48cc-a478-ffd069db2fc6@k22g2000yqh.googlegroups.com> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1287662687 21370 127.0.0.1 (21 Oct 2010 12:04:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 21 Oct 2010 12:04:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l8g2000yql.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:15622 Date: 2010-10-21T05:04:47-07:00 List-Id: Francesco Piraneo Giuliano wrote on comp.lang.ada: >> The title of your post is quite correct; ioctl is indeed black >> magic :) > >> POSIX[1] defines this function, as "obsolescent" mind you, along with >> {a big cut - save your bandwidth!} You cut a bit too much... > Ok Ludovic, thank you for your great answer! > > So, please don't use ioctl -> black magic -> forbidden! :-) That's not what I wrote or meant. > But my application still need to be written and has to run under linux > so to collect some data about linux' framebuffer I have to use ioctl; > the only solution is to write all low level interfacing (open the > device, get informations about, map it into memory) in C then write > the upper level in Ada? No; I wrote: >> 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. >> [...] So I suggest you create a binding only for the specific >> purpose you need ioctl for and use that. What I meant by this is: function Fixed_Info (Framebuffer : in POSIX.IO.File_Descriptor) return Fixed_Framebuffer_Info is function ioctl (Framebuffer : in POSIX.IO.File_Descriptor; Request : in Interfaces.C.int; Result : access Fixed_Framebuffer_Info) return Interfaces.C.int; -- local, specific-purpose binding pragma Import (C, ioctl, "ioctl"); Result : aliased Fixed_Framebuffer_Info; begin if ioctl (Framebuffer, FBIOGET_FSCREENINFO, Result'Access) /= 0 then raise Ioctl_Error; end if; return Result; end Fixed_Info; > Just one question to you: Normally which OS you use with Ada? I use Debian GNU/Linux and occasionally Debian GNU/kFreeBSD. > Moreover, there is a more suited os to be driven with Ada programs? Not that I know, except maybe an OS written in Ada like Lovelace or MaRTE OS. > Merci! ;-) De rien :) -- Ludovic Brenta.