Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Nov 2002 14:58:28 +0100
From:      Boris Nikolaus <boris@cs.tu-berlin.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/45293: kevent denies to observe /dev/tty
Message-ID:  <20021114135828.GB13558@fiesta.cs.tu-berlin.de>

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

>Number:         45293
>Category:       kern
>Synopsis:       kevent denies to observe /dev/tty
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 14 06:00:04 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Boris Nikolaus
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD XXXXXX 4.7-STABLE FreeBSD 4.7-STABLE #43: Tue Oct 22 20:25:44 CEST 2002 root@XXXXXX:/usr/src/sys/compile/BORIS i386
>Description:
kevent(2) denies to observe /dev/tty, it returns EPERM when trying to add
an EVFILT_READ event for it. (Just for info: Using STDIN_FILENO works fine.)
>How-To-Repeat:
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

int main() {
    int qfd;
    int ret;
    int fd;
    struct kevent kev[1];

    qfd = kqueue();

    fd = open("/dev/tty", O_RDWR);
    if (fd < 0)
	exit(1);
    EV_SET(&kev[0], fd, EVFILT_READ, EV_ADD, 0, 0, NULL);

    ret = kevent(qfd, kev, 1, NULL, 0, NULL);
    printf("kevent returned %d\n", ret);
    if (ret < 0)
        printf("errno = %d (%s)\n", errno, strerror(errno));

    close(qfd);

    return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:

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




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