Lines Matching refs:fd
46 int i, fd; local
49 fd = open(console_name[i], O_RDWR);
50 if (fd >= 0) {
52 if (!ioctl(fd, KDGKBTYPE, &arg)) return fd;
53 close(fd);
58 for (fd = 0; fd < 3; fd++) {
60 if (0 == ioctl(fd, KDGKBTYPE, &arg)) return fd;
66 int xvtnum(int fd) in xvtnum() argument
70 ret = ioctl(fd, VT_OPENQRY, (int *)&TT.vt_num); in xvtnum()
78 int fd, vt_fd, ret = 0; in openvt_main() local
84 for (fd = 0; fd < 3; fd++) in openvt_main()
85 if (!ioctl(fd, VT_GETSTATE, &vstate)) { in openvt_main()
86 ret = xvtnum(fd); in openvt_main()
92 fd = xopen("/dev/console", O_RDONLY | O_NONBLOCK); in openvt_main()
93 xioctl(fd, VT_GETSTATE, &vstate); in openvt_main()
94 xvtnum(fd); in openvt_main()
99 fd = open_console(); in openvt_main()
100 xioctl(fd, VT_GETSTATE, &vstate); in openvt_main()
127 ioctl(fd, VT_ACTIVATE, vstate.v_active); in openvt_main()
128 ioctl(fd, VT_WAITACTIVE, vstate.v_active); in openvt_main()
130 xioctl(fd, VT_DISALLOCATE, (void *)(ptrdiff_t)TT.vt_num); in openvt_main()
138 int fd; in deallocvt_main() local
142 if ((fd = open_console()) < 0) error_exit("can't open console"); in deallocvt_main()
143 xioctl(fd, VT_DISALLOCATE, (void *)vt_num); in deallocvt_main()
144 if (CFG_TOYBOX_FREE) close(fd); in deallocvt_main()