我有一个文件描述符存储在一个变量中,比如var.我如何在以后的阶段判断该描述符是否有效?
fdvar1= open(.....);
fdvar2 = fdvar1; // Please ignore the bad design
....
// lots of loops , conditionals and threads. It can call close(fdvar2) also.
....
if(CheckValid(fdvar1)) // How can I do this check ?
write(fdvar1, ....);
现在我想判断var1(仍然保存打开的描述符)是否仍然有效.