🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by urabe Wed, 18 Nov 1992 02:32
ioctl does not work in gcc 2.3.1
#1420
Author: urabe
Date: Wed, 18 Nov 1992 02:32
87 lines
3134 bytes
	I encountered the problem using gcc 2.3.1 on SS2 SUNOS 4.1.2.
	I compiled the folowing program using gcc2.3.1 and cc and run
	under the Openwindow2.0's comannd tool. I expected
	the result is the same, but not.

% cat ttt.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sgtty.h>


#define EXIT_OK 0
#define EXIT_FAILURE 1


main()
{
    struct sgttyb arg;

    if (!isatty(fileno(stdin))) {
        fprintf(stderr, "stdin is not tty\n") ;
        exit(EXIT_FAILURE);
    }
    fprintf(stderr, "tty name is %s\n", ttyname(fileno(stdin))) ;
    if (ioctl(fileno(stdin), TIOCGETP, (char *)&arg) < 0) {
        perror("ioctl - TIOCGETP");
        exit(EXIT_FAILURE);
    }
    fprintf(stderr, "We can do ioctl\n") ;
    exit(EXIT_OK);
}

	The config.status of gcc is the following.

% cat config.status
#!/bin/sh
# GCC was configured as follows:
./configure --target=sparc-sun-sunos4.1 --prefix=/usr/gnu
echo host=sparc-sun-sunos4.1 target=sparc-sun-sunos4.1 build=sparc-sun-sunos4.1

	And the script of the result is the following.

% gcc -v -o ttt.gcc ttt.c
Reading specs from /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/specs
gcc version 2.3.1
 /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/cpp -lang-c -v -undef -D__GNUC__=2 -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix ttt.c /tmp/cca11931.i
GNU CPP version 2.3.1 (sparc)
 /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/cc1 /tmp/cca11931.i -quiet -dumpbase ttt.c -version -o /tmp/cca11931.s
GNU C version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
 as -o /tmp/cca119311.o /tmp/cca11931.s
 /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/ld -e start -dc -dp -o ttt.gcc /lib/crt0.o -L/usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1 -L/usr/gnu/lib /tmp/cca119311.o -lgcc -lc -lgcc

% ttt.gcc
tty name is /dev/ttyp4
ioctl - TIOCGETP: Inappropriate ioctl for device

	And the result of the default SUN cc is the following.

% cc -v -o ttt.cc ttt.c
/lib/cpp -undef -Dunix -Dsun -Dsparc ttt.c >/tmp/cpp.11939.0.i
/lib/ccom - </tmp/cpp.11939.0.i >/tmp/ccom.11939.1.s
rm /tmp/cpp.11939.0.i
/bin/as -o ttt.o -Q /tmp/ccom.11939.1.s
rm /tmp/ccom.11939.1.s
/bin/ld -dc -dp -e start -X -o ttt.cc /usr/lib/crt0.o ttt.o -lc
rm ttt.o

% ttt.cc
tty name is /dev/ttyp4
We can do ioctl


	I hope this information is useful to you.


				701 Development Group
				NA Development Department
				Advanced Technology Development Center	
				Research and Development Group
				RICOH Co. Ltd.

					Akio Urabe

				urabe@ttc.rdc.ricoh.co.jp
				tel +81-45-593-3411 ext 3021    
				FAX 81-45-593-3487 (G3)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads