Merge from trunk.

This commit is contained in:
David Given 2016-10-16 00:06:14 +02:00
commit 32c53a452d
2 changed files with 18 additions and 8 deletions

11
plat/linux/libsys/ioctl.c Normal file
View file

@ -0,0 +1,11 @@
#include "libsys.h"
/*
* The usual prototype is ioctl(int, unsigned long, ...). We use a
* different prototype to easily get argp, and we don't include any
* header file that would declare the usual prototype.
*/
int ioctl(int fd, unsigned long request, void *argp)
{
return _syscall(__NR_ioctl, fd, request, argp);
}

View file

@ -1,13 +1,12 @@
/* $Source: /cvsroot/tack/Ack/plat/linux386/libsys/isatty.c,v $
* $State: Exp $
* $Revision: 1.1 $
/*
* XXX - can't #include <sys/ioctl.h> because libcc.ansi and libsys
* both provide it, and we might find the wrong one.
*/
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#define TIOCGETD 0x5424
int ioctl(int fd, unsigned long, ...);
int isatty(int fd)
{
return 0;
int line_disc;
return 0 <= ioctl(fd, TIOCGETD, &line_disc);
}