Answer the question
In order to leave comments, you need to log in
Strange behavior of TIOCEXCL on Solaris?
First, let me explain what I need to do. I want to set the serial port I'm working on to exclusive mode, i.e. so that no one else can access it while I work with it. Of course, root can get access, and I will say right away that I am not working as root.
So, to implement this, I use the following code:
int fd;<br/>
fd = open(portName, O_RDWR | O_NOCTTY | O_NDELAY);<br/>
if(fd != -1){<br/>
ioctl(fd, TIOCEXCL);<br/>
int flags = fcntl(fd, F_GETFL, 0);<br/>
flags &= ~O_NDELAY;<br/>
fcntl(fd, F_SETFL, flags);<br/>
}<br/>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question