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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6413b417b806eb28 X-Google-Attributes: gid103376,public From: mike@nospam Subject: Re: Linux Kernel in Ada. Repost Date: 1999/04/10 Message-ID: <7ep9p3$9fm@drn.newsguy.com>#1/1 X-Deja-AN: 465014743 References: <7eg43i$d3b$1@nnrp1.dejanews.com> <370CC730.4C6112DB@utech.net> <370D7007.2D3AD58B@rocketmail.com> <7el9so$geb@drn.newsguy.com> <7elrg5$egk2@ftp.kvaerner.com> <7emjk8$rp3@drn.newsguy.com> <7ep6uj$o97$1@nnrp1.dejanews.com> Organization: Newsguy News Service [http://www.newsguy.com] Newsgroups: comp.lang.ada Date: 1999-04-10T00:00:00+00:00 List-Id: In article <7ep6uj$o97$1@nnrp1.dejanews.com>, Robert says... > > > >In article <7emjk8$rp3@drn.newsguy.com>, > bill_@nospam wrote: >> It is kind'a hard to write Linux or Unix stuff in Ada, >> becuase the Posix >> Ada binding do not seem to work well or even documented. >> The Posix Ada >> bindings for linux (there is now even an RPM for these >> for Linux!) do not >> have an API document to tell one how to use them to write >> the sort of stuff >> you are talking about. > > >First, of course there is documentation on how to use >the Posix interface, this is an IEEE standard, just as >for Ada you go to the RM, you go to the Posix standard >for details on the Ada binding to Posix. > There is no free Ada/Posix binding document. one must buy it. Something like $60 or $100 I hear? Do you know of a free one we can download? >Second, I see no particular reason to use these bindings. >Might as well call any services that you want directly. I >see no point in involving the Posix stuff here. > >As for it being "kind'a hard to write .. Unix stuff [in >Ada]" that makes no sense, it is quite straightforward >in Ada to call any system services or other functions >that you need. > Some calls are easy, but some that takes in a pointer to some complicated C structure, might not be, you need to map an Ada record to match the C struct correctly. >I am not at all clear that it is desirable to use something >as thick as the Posix bindings at the OS kernel level >anyway, that does not make any sense. The more reasonable >view of the Posix bindings is that they bind to the >kernel you are writing! > But the above poster was responding to someone saying to write Linux UTILTIES and Linux daemons type of applications in Ada, i.e. stuff that runs in user mode, not kernel mode. Inside the kernel, one does not make system calls. >In any case, the existing Posix interface is completely >irrelevant to this project. You are trying to write a >kernel in Ada, Again, the repsonse was for the claim that writing Linux system type utilities in Ada was easy. (not to write the kernel itself). For example, If I want to write a system resource monitoring utility for Linux. Most of the time, the application will be making C system service calls to the system, and making heavy use of Linux defined C structs that contains such information. Just an example, making a stat() call, will require one to pass in such a struct (define in sys/stat.h ) struct stat { dev_t st_dev; /* device */ ino_t st_ino; /* inode */ mode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of owner */ gid_t st_gid; /* group ID of owner */ dev_t st_rdev; /* device type (if inode device) */ off_t st_size; /* total size, in bytes */ unsigned long st_blksize; /* blocksize for filesystem I/O */ unsigned long st_blocks; /* number of blocks allocated */ time_t st_atime; /* time of last access */ time_t st_mtime; /* time of last modification */ time_t st_ctime; /* time of last change */ }; Now, an Ada application that needs to call stat(), will have to pass a pointer to a piece of memory that maps to the above layout. I have to figure how to make my Ada record to be same size as above, with correct field sizes. I have to figure the size of each field, etc.. There are zillion (well, many) other such C structs, and many constants defined in those C header files, used. All of these need to have Ada equivelent. This is a waste of time for me having to do this everytime I encounter a new struct, and having each Ada programmer do the same becuase there is no common Ada/Posix binding to use that allready did all this work for us. >what on earth is the relevance of a binding >from Ada to the corresponding C kernel?? > I agree. If one is writing the kernel in Ada, offocurse the Posix binding is not needed. But the posix binding is helpfull to write user level Unix applications in Ada. (then one will need a C binding to the Ada kernel. This sounds so nice!) Lets face it, it is so much easier to write all of this Unix stuff in C than in Ada, unless a fully Ada working Unix binding exist to make it easier for programmers to use Ada on Unix/Linux, C will remain the prefered language of use on Unix for developing system applications. Mike