[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: missing features.h
> -----Original Message-----
> From: Hans-Peter Nilsson [mailto:firstname.lastname@example.org]
> Sent: woensdag 23 oktober 2002 19:34
> To: email@example.com
> Cc: firstname.lastname@example.org
> Subject: Re: missing features.h
> > From: Pieter Grimmerink <email@example.com>
> > Date: Wed, 23 Oct 2002 12:28:10 +0200
> > On my workstation, features.h defines __USE_MISC for me (when I specify
> > _BSD_SOURCE).
> > and features.h is included by almost every header in
> /usr/include, so as long
> > as I specify _BSD_SOURCE, I can use CRTSCTS when including <termios.h>
> > Now with cris, the include files that replace files in
> /usr/include do not
> > include features.h,
> No, features.h *is* included. If not, I'm surprised __USE_MISC
> has any effect.
Well, this is the piece that defines CRTSCTS, in
# define CIBAUD 002003600000 /* input baud rate (not used) */
# define CRTSCTS 020000000000 /* flow control */
So just specifying __USE_MISC *does* work.
> Don't use __USE_MISC. Use _BSD_SOURCE or _GNU_SOURCE.
I use _BSD_SOURCE, and because __USE_MISC is not defined eventually,
I can only conclude features.h is not included, since features.h contains:
#if defined _BSD_SOURCE || defined _SVID_SOURCE
# define __USE_MISC 1
BTW, I don't see how _GNU_SOURCE should cause __USE_MISC to be defined,
just _BSD_SOURCE and _SVID_SOURCE do the job it seems to me.
> Did you install glibc correctly?
I installed the cris-dist-1.22 rpm, I guess glibc is included?
(at least, everything seems to work apart from my __USE_MISC ;-)
> An example program would help understanding what's wrong.
This (below) should do (specify -D_BSD_SOURCE and -D_XOPEN_SOURCE=500 in
Everything works except CRTSCTS.
Thanks and best regards,
int main(int /*argc*/, char */*argv*/)
struct termios term;
fd = open("/dev/ttyS0",O_RDWR | O_NOCTTY);
if (fd < 0) return;
term.c_lflag &= ~(ICANON | ECHO | ISIG | XCASE);
term.c_cflag |= (CLOCAL | CREAD);
term.c_cflag &= ~CRTSCTS;
term.c_iflag &= ~(INPCK | ISTRIP | IUCLC); //don't use parity, dont strip
term.c_iflag &= ~(IXON | IXOFF | IXANY);
term.c_cflag &= ~CSIZE;
term.c_cflag |= CS8;
term.c_oflag &= ~OPOST;
term.c_cc[VMIN] = 1;
term.c_cc[VTIME] = 0;