Lines Matching refs:fdt
662 void alloc_std_fd(struct fd_table_s *fdt) in alloc_std_fd() argument
664 fdt->ft_fds[STDIN_FILENO].sysFd = STDIN_FILENO; in alloc_std_fd()
665 fdt->ft_fds[STDOUT_FILENO].sysFd = STDOUT_FILENO; in alloc_std_fd()
666 fdt->ft_fds[STDERR_FILENO].sysFd = STDERR_FILENO; in alloc_std_fd()
667 FD_SET(STDIN_FILENO, fdt->proc_fds); in alloc_std_fd()
668 FD_SET(STDOUT_FILENO, fdt->proc_fds); in alloc_std_fd()
669 FD_SET(STDERR_FILENO, fdt->proc_fds); in alloc_std_fd()
724 struct fd_table_s *fdt; in alloc_fd_table() local
727 fdt = LOS_MemAlloc(m_aucSysMem0, sizeof(struct fd_table_s)); in alloc_fd_table()
728 if (!fdt) in alloc_fd_table()
732 fdt->max_fds = numbers; in alloc_fd_table()
735 fdt->ft_fds = NULL; in alloc_fd_table()
736 fdt->proc_fds = NULL; in alloc_fd_table()
737 fdt->cloexec_fds = NULL; in alloc_fd_table()
738 return fdt; in alloc_fd_table()
745 fdt->ft_fds = data; in alloc_fd_table()
749 fdt->ft_fds[i].sysFd = -1; in alloc_fd_table()
758 fdt->proc_fds = (fd_set *)data; in alloc_fd_table()
759 fdt->cloexec_fds = (fd_set *)((uintptr_t)data + sizeof(fd_set)); in alloc_fd_table()
761 alloc_std_fd(fdt); in alloc_fd_table()
763 (void)sem_init(&fdt->ft_sem, 0, 1); in alloc_fd_table()
765 return fdt; in alloc_fd_table()
768 (VOID)LOS_MemFree(m_aucSysMem0, fdt->ft_fds); in alloc_fd_table()
770 (VOID)LOS_MemFree(m_aucSysMem0, fdt); in alloc_fd_table()
791 files->fdt = alloc_fd_table(NR_OPEN_DEFAULT); in alloc_files()
792 if (!files->fdt) in alloc_files()
814 if((old_files == NULL) || (old_files->fdt == NULL) || (old_files->fdt->max_fds == 0)) in dup_fd()
832 old_fdt = old_files->fdt; in dup_fd()
841 files->fdt = new_fdt; in dup_fd()
875 if (files->fdt == NULL) in delete_files()
880 for (int i = 0; i < files->fdt->max_fds; i++) in delete_files()
882 if (FD_ISSET(i, files->fdt->proc_fds)) in delete_files()
890 (VOID)sem_destroy(&files->fdt->ft_sem); in delete_files()
891 (VOID)LOS_MemFree(m_aucSysMem0, files->fdt->ft_fds); in delete_files()
892 (VOID)LOS_MemFree(m_aucSysMem0, files->fdt->proc_fds); in delete_files()
893 (VOID)LOS_MemFree(m_aucSysMem0, files->fdt); in delete_files()
904 if ((old_files == NULL) || (old_files->fdt == NULL) || (old_files->fdt->max_fds == 0)) in create_files_snapshot()
922 old_fdt = old_files->fdt; in create_files_snapshot()
931 files->fdt = new_fdt; in create_files_snapshot()
950 if (files->fdt == NULL) in delete_files_snapshot()
955 (VOID)sem_destroy(&files->fdt->ft_sem); in delete_files_snapshot()
956 (VOID)LOS_MemFree(m_aucSysMem0, files->fdt->ft_fds); in delete_files_snapshot()
957 (VOID)LOS_MemFree(m_aucSysMem0, files->fdt->proc_fds); in delete_files_snapshot()
958 (VOID)LOS_MemFree(m_aucSysMem0, files->fdt); in delete_files_snapshot()