lkml.org 
[lkml]   [1999]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectUnix98-pty problem

Hi,

I just try to use Unix98 PTYs and have a little problem here. I use the
kernel 2.2.3-ac1 and glibc 2.1.1

1: get master using getpt()
2: get /dev/pts/<pty-number> using ptsname(master)
3: open /dev/pts/<pty-number> to use it as slave

If I use the code in glibc for getting a PTY I get an I/O Error at step 3.

It's the test code
/*******************************************************/
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>

main()
{
int master, slave;
char *line;

master = getpt();
if(master >=0) {
line = (char *)ptsname(master);
if(!line) {
fprintf(stderr, "Get slave name error\n");
close(master);
exit(0);
}
slave = open(line, O_RDWR);
if(slave < 0) {
perror(line);
close(master);
exit(1);
}
printf("%s -> %s\n", ttyname(master), line);
close(slave);
close(master);
}
}
/*******************************************************/

What can I do?



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.079 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site