mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 08:56:40 +00:00
Kernel+LibC: Switch isatty() to use a fcntl()
We would want it to work with only stdio pledged.
This commit is contained in:
parent
f9cffda0e0
commit
7541122206
|
@ -1845,6 +1845,8 @@ int Process::sys$fcntl(int fd, int cmd, u32 arg)
|
|||
case F_SETFL:
|
||||
description->set_file_flags(arg);
|
||||
break;
|
||||
case F_ISTTY:
|
||||
return description->is_tty();
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
#define F_SETFD 2
|
||||
#define F_GETFL 3
|
||||
#define F_SETFL 4
|
||||
#define F_ISTTY 5
|
||||
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ __BEGIN_DECLS
|
|||
#define F_SETFD 2
|
||||
#define F_GETFL 3
|
||||
#define F_SETFL 4
|
||||
#define F_ISTTY 5
|
||||
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
|
|
|
@ -413,8 +413,7 @@ int rmdir(const char* pathname)
|
|||
|
||||
int isatty(int fd)
|
||||
{
|
||||
struct termios dummy;
|
||||
return tcgetattr(fd, &dummy) == 0;
|
||||
return fcntl(fd, F_ISTTY);
|
||||
}
|
||||
|
||||
int dup(int old_fd)
|
||||
|
|
Loading…
Reference in a new issue