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>

next in thread | raw e-mail | index | archive | help

--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tiocsctty.c"

#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);
}

--bg08WKrSYDhXBjb5--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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