Lines Matching refs:fd
45 int i, fd; local
48 fd = open(console_name[i], O_RDWR);
49 if (fd >= 0) {
51 if (!ioctl(fd, KDGKBTYPE, &arg)) return fd;
52 close(fd);
57 for (fd = 0; fd < 3; fd++) {
59 if (0 == ioctl(fd, KDGKBTYPE, &arg)) return fd;
65 int xvtnum(int fd) in xvtnum() argument
69 ret = ioctl(fd, VT_OPENQRY, (int *)&TT.vt_num); in xvtnum()
77 int fd, vt_fd, ret = 0; in openvt_main() local
83 for (fd = 0; fd < 3; fd++) in openvt_main()
84 if (!ioctl(fd, VT_GETSTATE, &vstate)) { in openvt_main()
85 ret = xvtnum(fd); in openvt_main()
91 fd = xopen("/dev/console", O_RDONLY | O_NONBLOCK); in openvt_main()
92 xioctl(fd, VT_GETSTATE, &vstate); in openvt_main()
93 xvtnum(fd); in openvt_main()
98 fd = open_console(); in openvt_main()
99 xioctl(fd, VT_GETSTATE, &vstate); in openvt_main()
126 ioctl(fd, VT_ACTIVATE, vstate.v_active); in openvt_main()
127 ioctl(fd, VT_WAITACTIVE, vstate.v_active); in openvt_main()
129 xioctl(fd, VT_DISALLOCATE, (void *)(ptrdiff_t)TT.vt_num); in openvt_main()
137 int fd; in deallocvt_main() local
141 if ((fd = open_console()) < 0) error_exit("can't open console"); in deallocvt_main()
142 xioctl(fd, VT_DISALLOCATE, (void *)vt_num); in deallocvt_main()
143 if (CFG_TOYBOX_FREE) close(fd); in deallocvt_main()