Lines Matching full:fd
208 struct pollfd fd[1];
211 fd[0].fd = open(PRINTER_FILE, O_RDWR);
212 if (fd[0].fd < 0) {
213 printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE);
214 close(fd[0].fd);
218 fd[0].events = POLLIN | POLLRDNORM;
226 retval = poll(fd, 1, 1000);
228 if (retval && (fd[0].revents & POLLRDNORM)) {
231 bytes_read = read(fd[0].fd, buf, BUF_SIZE);
235 fd[0].fd, PRINTER_FILE);
236 close(fd[0].fd);
249 close(fd[0].fd);
258 struct pollfd fd[1];
261 fd[0].fd = open (PRINTER_FILE, O_RDWR);
262 if (fd[0].fd < 0) {
263 printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE);
264 close(fd[0].fd);
268 fd[0].events = POLLOUT | POLLWRNORM;
283 retval = poll(fd, 1, 1000);
286 if (retval && (fd[0].revents & POLLWRNORM)) {
287 retval = write(fd[0].fd, buf, bytes_read);
290 fd[0].fd,
292 close(fd[0].fd);
305 fsync(fd[0].fd);
308 close(fd[0].fd);
317 int fd;
322 fd = open(PRINTER_FILE, O_RDWR|O_NONBLOCK);
323 if (fd < 0) {
324 printf("Error %d opening %s\n", fd, PRINTER_FILE);
325 close(fd);
331 bytes_read = read(fd, buf, BUF_SIZE);
342 close(fd);
352 int fd;
355 fd = open(PRINTER_FILE, O_RDWR);
356 if (fd < 0) {
357 printf("Error %d opening %s\n", fd, PRINTER_FILE);
358 close(fd);
363 retval = ioctl(fd, GADGET_GET_PRINTER_STATUS);
370 close(fd);
380 int fd;
389 fd = open(PRINTER_FILE, O_RDWR);
391 if (fd < 0) {
392 printf("Error %d opening %s\n", fd, PRINTER_FILE);
393 close(fd);
404 if (ioctl(fd, GADGET_SET_PRINTER_STATUS, (unsigned char)retval)) {
410 close(fd);