Lines Matching defs:fd

23 #define GET_PROT_CLASS(fd)             fcntl((fd), F_GETPROTECTIONCLASS)
24 #define SET_PROT_CLASS(fd, prot_class) fcntl((fd), F_SETPROTECTIONCLASS, (prot_class))
354 int fd = -1;
420 fd = open(filepath, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC);
422 if (fd == -1)
432 old_prot_class = GET_PROT_CLASS(fd);
441 if (SET_PROT_CLASS(fd, new_prot_class))
449 if (SET_PROT_CLASS(fd, PROTECTION_CLASS_D))
463 if (!SET_PROT_CLASS(fd, PROTECTION_CLASS_A))
477 if (SET_PROT_CLASS(fd, PROTECTION_CLASS_A))
484 close(fd);
485 fd = open(filepath, O_RDWR | O_CLOEXEC);
487 if (fd == -1)
500 local_result = pwrite(fd, &wr_buffer[current_byte], CPT_IO_SIZE - current_byte, current_byte);
516 local_result = pread(fd, &rd_buffer[current_byte], CPT_IO_SIZE - current_byte, current_byte);
535 if (pread(fd, rd_buffer, CPT_IO_SIZE, 0) > 0)
542 if (pwrite(fd, wr_buffer, CPT_IO_SIZE, 0) > 0)
549 if (!SET_PROT_CLASS(fd, PROTECTION_CLASS_D))
557 close(fd);
558 fd = open(filepath, O_RDWR | O_TRUNC | O_CLOEXEC);
560 if (fd != -1)
568 fd = open(filepath, O_RDWR | O_CLOEXEC);
570 if (fd != -1)
584 fd = open(filepath, O_RDWR | O_CLOEXEC);
586 if (fd == -1)
593 if (SET_PROT_CLASS(fd, PROTECTION_CLASS_D))
607 if (SET_PROT_CLASS(fd, PROTECTION_CLASS_B))
619 local_result = pwrite(fd, &wr_buffer[current_byte], CPT_IO_SIZE - current_byte, current_byte);
635 local_result = pread(fd, &rd_buffer[current_byte], CPT_IO_SIZE - current_byte, current_byte);
648 close(fd);
649 fd = open(filepath, O_RDWR | O_CLOEXEC);
651 if (fd != -1)
731 fd = open(filepath, O_CREAT | O_EXCL | O_CLOEXEC);
733 if (fd == -1)
740 local_result = GET_PROT_CLASS(fd);
755 close(fd);
781 fd = open(filepath, O_CREAT | O_EXCL | O_CLOEXEC);
783 if (fd != -1)
809 fd = open(filepath, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC);
811 if (fd == -1)
818 local_result = GET_PROT_CLASS(fd);
896 close(fd);