Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Apr 2005 01:09:13 +0300 (EEST)
From:      Vladimir Kushnir <vkushnir@i.kiev.ua>
To:        current@freebsd.org
Subject:   -CURRENT and ptsname() again
Message-ID:  <20050411004706.I2914@kushnir1.kiev.ua>

next in thread | raw e-mail | index | archive | help
Hello,
It definitely looks like posix_openpt (perhaps) and ptsname/grantpt 
(most probably) do not work as they should under -CURRENT. Examples:  mc 
(misc/mc) reports:

subshell.c: couldn't open master side of pty
pty_open_master: Permission denied

KDE (at least CVS, but it's pty handling did not change recently) 
complaints about chown

The simplest example:

#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

main() {
 	int pty_master;
 	char *master_name, *slave_name;
 	struct stat sb;

 	pty_master = posix_openpt(O_RDWR | O_NOCTTY);
 	fstat(pty_master, &sb);
         if (grantpt (pty_master) < 0) {
 		printf("Fail: grantpt\n");
 	}
 	if (unlockpt (pty_master) < 0) {
 		printf("Fail: unlocktpt\n");
 	}
 	master_name = devname(sb.st_rdev, S_IFCHR);
 	slave_name = ptsname (pty_master);

 	printf("Open master: /dev/%s, slave: %s\n", master_name, slave_name);
 	close (pty_master);
 	return 0;
}

gives an absurd output:

~> ./ptytest
Fail: grantpt
Open master: /dev/ptyp0, slave: /dev/ttysu
                                 ^^^^^^^^^^
grantpt() here also fails.

This is fairly recent -CURRENT:
FreeBSD kushnir1.kiev.ua 6.0-CURRENT FreeBSD 6.0-CURRENT #6: Sat Apr  9 
23:17:34 EEST 2005     root@:/usr/obj/usr/src/sys/KUSHNIR  i386

Sorry, cannot fix it myself
Redards,
Vladimir



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050411004706.I2914>