[Fwd: CINT problem with ioctl()]

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Aug 23 1999 - 19:11:13 MEST


Might be of general interest.

-- Fons.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910

attached mail follows:


Dear Dirk, I'm happy to answer your question. Basically, you can not process files in /usr/include or [compilerpath]/include. Those files are made for the specific compiler. No other compiler or interpreter can read them. Cint has itsown header files in $CINTSYSDIR/include or $ROOTSYS/cint/include. This directory only contains ANSI defined header files. open() and ioctl() are not in ANSI standard. So they are not there by default. Cint supports some of POSIX.1 system calls in unistd.h (posix.dll). If you include <unistd.h> you can use open(). Unfortunately, ioctl() is missing at this moment. Here is what you can do. 1) Download cint source package, unpack and install it. 2) Go to $CINTSYSDIR/lib/posix directory 3) Edit posix.h and add ioctl() prototype 4) Run 'setup' script. $CINTSYSDIR/include/posix.dll will be updated. 5) Copy $CINTSYSDIR/include/posix.dll to $ROOTSYS/cint/include/posix.dll Please do above if you find other unsupported POSIX system calls. Thank you Masaharu Goto ======================================================= Dear Masaharu, I would like to use the functions open() and ioctl() which are declared in /usr/include/fnctl.h and /usr/include/sys/ioctl.h. These functions I want to use in a class which I will compile and then gSystem->Load() into ROOT. As a test I wrote the following ROOT macro: // aIOTest.C { gROOT->Reset(); #include <ioctls.h> // this is o.k. #include <ioctl-types.h> // this is o.k. #include <linux/ioctl.h> // this is o.k. #include <linux/kernel.h> // this is o.k. #include <stdio.h> // this is o.k. #include <stdlib.h> // this is o.k. #include <fcntl.h> // this is o.k. #include <unistd.h> // this is o.k. //#include <sys/ioctl.h> // +P/-p message appears, can't use it //#include <fcntlbits.h> // +P/-p message appears , can't use this // here only need the following definition #define O_RDWR 02 // `open()' is declared `extern' in /usr/include/fcntl.h // _IO() is decleared in /usr/include/asm/ioctl.h // ioctl() is declared `extern' in /usr/include/sys/ioctl.h Int_t fd = open("/dev/despex",O_RDWR); Int_t error = ioctl(fd, _IO('k', 3), 0); }



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET