tcsetpgrp() and tcgetpgrp() are actually defined in unistd.h, not termios.h.

Implemented them and moved them to unistd/terminal.c - not yet tested, though,
but should work. As a side effect, the TTY should now send signals.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12034 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-03-26 14:41:30 +00:00
parent d6ec927ff1
commit e5fd0bde4a
4 changed files with 36 additions and 34 deletions
+4 -5
View File
@@ -1,6 +1,7 @@
/* /*
** Distributed under the terms of the Haiku License. * Copyright 2004-2005, Haiku Inc. All Rights Reserved.
*/ * Distributed under the terms of the MIT License.
*/
#ifndef _TERMIOS_H_ #ifndef _TERMIOS_H_
#define _TERMIOS_H_ #define _TERMIOS_H_
@@ -210,8 +211,6 @@ extern int tcsendbreak(int fd, int duration);
extern int tcdrain(int fd); extern int tcdrain(int fd);
extern int tcflow(int fd, int action); extern int tcflow(int fd, int action);
extern int tcflush(int fd, int queueSelector); extern int tcflush(int fd, int queueSelector);
extern int tcsetpgrp(int fd, pid_t pgrpid);
extern pid_t tcgetpgrp(int fd);
#ifdef __cplusplus #ifdef __cplusplus
} }
+4 -3
View File
@@ -1,6 +1,7 @@
/* /*
** Distributed under the terms of the Haiku License. * Copyright 2004-2005, Haiku Inc. All Rights Reserved.
*/ * Distributed under the terms of the MIT License.
*/
#ifndef _UNISTD_H_ #ifndef _UNISTD_H_
#define _UNISTD_H_ #define _UNISTD_H_
+6 -22
View File
@@ -1,8 +1,9 @@
/* /*
** Copyright 2003, Daniel Reinhold, [email protected]. All rights reserved. * Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003, Daniel Reinhold, [email protected]. All rights reserved.
** Distributed under the terms of the Haiku License. *
*/ * Distributed under the terms of the MIT License.
*/
#include <termios.h> #include <termios.h>
@@ -134,20 +135,3 @@ cfsetospeed(struct termios *termios, speed_t speed)
return 0; return 0;
} }
int
tcsetpgrp(int fd, pid_t pgrpid)
{
// ToDo: Implement!
errno = EINVAL;
return -1;
}
pid_t
tcgetpgrp(int fd)
{
// ToDo: Implement!
errno = EINVAL;
return -1;
}
+22 -4
View File
@@ -1,7 +1,7 @@
/* /*
** Copyright 2003-2004, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2005, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the Haiku License. * Distributed under the terms of the MIT License.
*/ */
#include <stdio.h> #include <stdio.h>
@@ -42,3 +42,21 @@ ctermid(char *s)
return strcpy(s, name ? name : ""); return strcpy(s, name ? name : "");
} }
int
tcsetpgrp(int fd, pid_t pgrpid)
{
return ioctl(fd, TIOCSPGRP, &pgrpid);
}
pid_t
tcgetpgrp(int fd)
{
pid_t foregroundProcess;
int status = ioctl(fd, TIOCGPGRP, &foregroundProcess);
if (status == 0)
return foregroundProcess;
return -1;
}