Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jul 2001 18:50:48 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        current@FreeBSD.org
Subject:   TIOCSCTTY
Message-ID:  <20010702185048.A21809@sunbay.com>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hi!

Could someone please explain why the following code snippet
does not work anymore with the "/dev/console" argument?

# ./tiocsctty /dev/console
tiocsctty: ioctl(/dev/console, TIOCSCTTY): Operation not permitted


Thanks,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

[-- Attachment #2 --]
#include <sys/ioctl.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[])
{
	int fd;

	if (argc != 2)
		errx(1, "missing argument");
	if ((fd = open(argv[1], O_RDWR)) == -1)
		err(1, "open %s", argv[1]);
	if (daemon(1, 1) == -1)
		err(1, "daemon");
        if (ioctl(fd, TIOCSCTTY) == -1)
		err(1, "ioctl(%s, TIOCSCTTY)", argv[1]);

	exit(0);
}
help

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