我有一个文件描述符存储在变量 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 (仍然保存打开的描述符)是否仍然有效。有任何 API 吗?