Bug 36784

Summary: Can't fcntl(fd, F_SETFL, ...) on a pseudo-tty
Product: Base System Reporter: Murray Nesbitt <murray>
Component: kernAssignee: Jaakko Heinonen <jh>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.5-RELEASE   
Hardware: Any   
OS: Any   

Description Murray Nesbitt 2002-04-05 13:20:01 UTC
fcntl(fd, F_SETFL, arg) on a pseudo-tty fails with EAGAIN,
even if arg is the result of a call to fcntl(fd, F_GETFL);

This doesn't seem right.  FWIW, same code works on Linux and 
Solaris.

Also FWIW, this is preventing us from porting our application to FreeBSD.

How-To-Repeat: #include <fcntl.h>
#include <stdio.h>
#include <errno.h>

main()
{
int status, fd;

    fd = open("/dev/ptyp9", 2);
    fprintf(stderr, "fd: %d\n", fd);
    errno = 0;
    status = fcntl(fd, F_GETFL);
    fprintf(stderr, "status: %d, errno: %d\n", status, errno);
    errno = 0;
    status = fcntl(fd, F_SETFL, status);
    fprintf(stderr, "status: %d, errno: %d\n", status, errno);
}
Comment 1 dschultz 2002-05-06 23:29:14 UTC
I don't think you're supposed to be able to do that if the client
isn't open, but you're right that it works on Solaris.
Comment 2 Jaakko Heinonen freebsd_committer freebsd_triage 2010-03-20 09:40:31 UTC
State Changed
From-To: open->feedback

I couldn't reproduce this on 8.0-RELEASE. Is this problem still relevant 
on recent versions of FreeBSD? 


Comment 3 Jaakko Heinonen freebsd_committer freebsd_triage 2010-03-20 09:40:31 UTC
Responsible Changed
From-To: freebsd-bugs->jh

Track.
Comment 4 Jaakko Heinonen freebsd_committer freebsd_triage 2010-04-29 19:24:02 UTC
State Changed
From-To: feedback->closed

Feedback timeout.