unix环境下测试 是否是流设备
我在虚拟机上使用ubuntu操作系统,用下面的代码测试/dev/tty ,发现不是 流设备 ,最近在看unix环境下高级编程,上面的怎么测得 /dev/tty 是流设备。。
#include <stdio.h>; #include <stdlib.h>; int main(int argc, char *argv[]) { int fds; int i; if((fds = open("/dev/tty","r")) < 0) printf("open error\n"); if(isastream(fds) == 1) printf("this dev is a stream dev\n"); else printf("no\n"); return 0; }UNIMPLEMENTED(2) Linux Programmer’s Manual UNIMPLEMENTED(2)NAME afs_syscall, break, fattach, fdetach, ftime, getmsg, getpmsg, gtty, isastream, lock, mpx, multiplexer, prof, profil, putmsg, putpmsg, security, stty, ulimit, vserver - unimplemented system callsSYNOPSIS Unimplemented system calls.DESCRIPTION These system calls are not implemented in the Linux 2.4 kernel.RETURN VALUE These system calls always return -1 and set errno to ENOSYS.NOTES Note that ftime(3), profil(3) and ulimit(3) are implemented as library functions. Some system calls, like alloc_hugepages(2), free_hugepages(2), ioperm(2), iopl(2), and vm86(2) only exist on certain architectures. Some system calls, like ipc(2), create_module(2), init_module(2), and delete_module(2) only exist when the Linux kernel was built with support for them.SEE ALSO obsolete(2)Linux 2.4 2003-02-28 UNIMPLEMENTED(2)