how to identify the status of serial port ("Port Already Opened") from a C program

view full story

http://www.linuxquestions.org – Dear All, I am writing some application in C, which will access a serial port device (RS232). My application is working good. But if any other application is already opened the port, I couldn't able to identify that. In windows VB program, while accessing comport through mscomm control, i am receiving an error as "Port Already Opened". But in Linux environment, through C program how can i get that? I am accessing comport 1 as follows fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_SYNC); Thanks in advance for your valuable suggestions. Regards, Rajmohan. (HowTos)