[GRASS-dev] compilation of grass on AIX 7.1

Glynn Clements glynn at gclements.plus.com
Wed Apr 10 04:51:45 PDT 2013


Markus Neteler wrote:

> > Is the struct winsize definition guarded by #if/#ifdef?
> 
> Yes:
> 
> #ifdef _ALL_SOURCE
> /* Common ioctl's for all disciplines which are handled in ttiocom */
> enum tty_ioctl {
> ...
> union txname {                          /* used with TXGETCD */
> ...
> /*
>  * window size structure used with TXSETWIN and TXGETWIN.  This is
>  * exactly the same as the Berkeley structure and can be used with
>  * TIOCSWINSZ and TIOCGWINSZ -- in fact they are defined to be the
>  * same.
>  */
> struct winsize {
>         unsigned short  ws_row;                 /* rows, in characters */
>         unsigned short  ws_col;                 /* columns, in characters */
>         unsigned short  ws_xpixel;              /* horizontal size, pixels */
>         unsigned short  ws_ypixel;              /* vertical size, pixels */
> };
> #endif /* _ALL_SOURCE */
> 
> So, I see only the #if/#ifdef which we want to avoid to use...

Right. But TIOCGWINSZ isn't similarly guarded.

Based upon the comment maybe there's another version of that structure
which is guarded differently?

Otherwise, the "#ifdef TIOCGWINSZ" in lib/gis/ls.c may need to be
replaced with:

	#if defined(TIOCGWINSZ) && !defined(_AIX)

Or maybe we should just get rid of that code and stick with a
hard-coded width of 80 columns. It doesn't seem worth the risk of a
compilation failure in lib/gis (and thus a link failure in everything
else).

ioctl(TIOCGWINSZ) isn't specified by POSIX. In fact, ioctl() itself is
only specified in conjuction with the STREAMS API; all other uses are
implementation-dependent. GRASS 7 doesn't use ioctl() other than for
TIOCGWINSZ; GRASS 6.x may use TCGETA or TIOCGETC if tcgetattr() isn't
available.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list