/DragonOS/user/apps/test_filemap/ |
H A D | main.c | 12 int fd = open("example.txt", O_RDWR | O_CREAT | O_TRUNC, 0777); in main() local 14 if (fd == -1) in main() 20 write(fd, "HelloWorld!", 11); in main() 23 close(fd); in main() 25 fd = open("example.txt", O_RDWR); in main() 26 read(fd, buf, 11); in main() 30 void *map = mmap(NULL, 11, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in main() 34 close(fd); in main() 56 fd = open("example.txt", O_RDWR); in main() 57 read(fd, buf, 11); in main()
|
/DragonOS/user/apps/test_uart/ |
H A D | main.c | 8 int fd = open("/dev/char/uart:1088", O_WRONLY | O_NONBLOCK); in main() local 13 n = read(fd, buf, 1); in main() 14 close(fd); in main() 15 fd = open("/dev/char/uart:1088", O_WRONLY | O_NONBLOCK); in main() 23 printf("fd: %d", fd); in main() 26 int len = write(fd, str, strlen(str)); in main() 29 close(fd); in main()
|
/DragonOS/user/apps/test_dup3/ |
H A D | main.c | 6 int fd = open("/history_commands.txt", O_RDONLY); in main() local 7 if (fd < 0) { in main() 13 int rt = dup3(fd, new_fd, O_CLOEXEC); in main() 27 close(fd); in main()
|
/DragonOS/user/apps/test_fstat/ |
H A D | main.c | 9 int fd = open("/bin/about.elf", O_RDONLY); in main() local 10 if (fd == -1) in main() 12 printf("fd = %d\n", fd); in main() 14 fstat(fd, st); in main()
|
/DragonOS/user/apps/test_fstatfs/ |
H A D | main.c | 7 int fd = open("/bin/about.elf", O_RDONLY); in main() local 8 if (fd == -1) in main() 10 printf("fd = %d\n", fd); in main() 14 fstatfs(fd, &diskInfo); in main()
|
/DragonOS/user/apps/http_server/ |
H A D | main.c | 76 int fd = open(path, 0); in send_file() local 77 if (fd == -1) in send_file() 85 int content_length = lseek(fd, 0, SEEK_END); in send_file() 88 lseek(fd, 0, SEEK_SET); in send_file() 97 readSize = read(fd, &buffer, to_read); in send_file() 107 close(fd); in send_file() 115 close(fd); in send_file()
|
/DragonOS/kernel/src/net/ |
H A D | syscall.rs | 52 let fd = fd_table_guard.alloc_fd(f, None).map(|x| x as usize); in socket() localVariable 54 return fd; in socket() 106 fd: usize, in setsockopt() 112 .get_socket(fd as i32) in setsockopt() 129 fd: usize, in getsockopt() 138 .get_socket(fd as i32) in getsockopt() 197 pub fn connect(fd: usize, addr: *const SockAddr, addrlen: usize) -> Result<usize, SystemError> { in connect() 200 .get_socket(fd as i32) in connect() 214 pub fn bind(fd: usize, addr: *const SockAddr, addrlen: usize) -> Result<usize, SystemError> { in bind() 217 .get_socket(fd as i32) in bind() [all …]
|
/DragonOS/kernel/src/filesystem/vfs/ |
H A D | syscall.rs | 522 pub fn close(fd: usize) -> Result<usize, SystemError> { in close() 525 let _file = fd_table_guard.drop_fd(fd as i32)?; in close() 537 pub fn ioctl(fd: usize, cmd: u32, data: usize) -> Result<usize, SystemError> { in ioctl() 542 .get_file_by_fd(fd as i32) in ioctl() 558 pub fn read(fd: i32, buf: &mut [u8]) -> Result<usize, SystemError> { in read() 562 let file = fd_table_guard.get_file_by_fd(fd); in read() 580 pub fn write(fd: i32, buf: &[u8]) -> Result<usize, SystemError> { in write() 585 .get_file_by_fd(fd) in write() 600 pub fn lseek(fd: i32, offset: i64, seek: u32) -> Result<usize, SystemError> { in lseek() 612 .get_file_by_fd(fd) in lseek() [all …]
|
H A D | file.rs | 676 for fd in &self.fds { in fd_open_count() 677 if fd.is_some() { in fd_open_count() 690 pub fn validate_fd(fd: i32) -> bool { in validate_fd() 691 return !(fd < 0 || fd as usize > FileDescriptorVec::PROCESS_MAX_FD); in validate_fd() 705 pub fn alloc_fd(&mut self, file: File, fd: Option<i32>) -> Result<i32, SystemError> { in alloc_fd() 706 if let Some(new_fd) = fd { in alloc_fd() 731 pub fn get_file_by_fd(&self, fd: i32) -> Option<Arc<File>> { in get_file_by_fd() 732 if !FileDescriptorVec::validate_fd(fd) { in get_file_by_fd() 735 self.fds[fd as usize].clone() in get_file_by_fd() 743 pub fn drop_fd(&mut self, fd: i32) -> Result<Arc<File>, SystemError> { in drop_fd() [all …]
|
H A D | open.rs | 150 .map(|fd| fd as usize); in do_sys_openat2()
|
/DragonOS/kernel/src/net/event_poll/ |
H A D | mod.rs | 84 fd: i32, field 93 fd: i32, in new() 99 fd, in new() 116 pub fn fd(&self) -> i32 { in fd() method 117 self.fd in fd() 209 for fd in fds { in close() 213 .get_file_by_fd(fd); in close() 219 epoll.ep_items.remove(&fd); in close() 266 let fd = fd_table_guard.alloc_fd(ep_file, None)?; in do_create_epoll() localVariable 268 Ok(fd as usize) in do_create_epoll() [all …]
|
H A D | syscall.rs | 66 pub fn epoll_ctl(epfd: i32, op: usize, fd: i32, event: VirtAddr) -> Result<usize, SystemError> { in epoll_ctl() 87 return EventPoll::do_epoll_ctl(epfd, op, fd, &mut epds, false); in epoll_ctl()
|
/DragonOS/kernel/src/syscall/ |
H A D | mod.rs | 141 let fd = args[0]; in handle() localVariable 142 Self::close(fd) in handle() 145 let fd = args[0] as i32; in handle() localVariable 153 Self::read(fd, user_buf) in handle() 156 let fd = args[0] as i32; in handle() localVariable 164 Self::write(fd, user_buf) in handle() 168 let fd = args[0] as i32; in handle() localVariable 172 Self::lseek(fd, offset, whence) in handle() 176 let fd = args[0] as i32; in handle() localVariable 184 Self::pread(fd, buf, len, offset) in handle() [all …]
|
/DragonOS/tools/ |
H A D | run-qemu.sh | 180 sudo ${QEMU} -bios arch/x86_64/efi/OVMF-pure-efi.fd ${QEMU_ARGUMENT} 182 sudo ${QEMU} -bios arch/i386/efi/OVMF-pure-efi.fd ${QEMU_ARGUMENT}
|
/DragonOS/kernel/src/ipc/ |
H A D | syscall.rs | 51 pub fn pipe2(fd: *mut i32, flags: FileMode) -> Result<usize, SystemError> { in pipe2() 59 let mut user_buffer = UserBufferWriter::new(fd, core::mem::size_of::<[c_int; 2]>(), true)?; in pipe2() 60 let fd = user_buffer.buffer::<i32>(0)?; in pipe2() localVariable 90 fd[0] = read_fd; in pipe2() 91 fd[1] = write_fd; in pipe2()
|
/DragonOS/kernel/src/virt/kvm/ |
H A D | kvm_dev.rs | 195 .map(|fd| fd as usize); in kvm_dev_ioctl_create_vm()
|
H A D | vm_dev.rs | 231 .map(|fd| fd as usize); in kvm_vm_ioctl_create_vcpu()
|
/DragonOS/kernel/src/filesystem/ |
H A D | eventfd.rs | 265 let fd = fd_table_guard.alloc_fd(file, None).map(|x| x as usize); in sys_eventfd() localVariable 266 return fd; in sys_eventfd()
|
/DragonOS/kernel/src/mm/ |
H A D | syscall.rs | 304 fd: i32, in mmap() 343 fd, in mmap()
|
H A D | ucontext.rs | 327 fd: i32, in file_mapping() 361 let file = fd_table_guard.get_file_by_fd(fd); in file_mapping()
|
/DragonOS/kernel/src/process/ |
H A D | mod.rs | 906 pub fn get_socket(&self, fd: i32) -> Option<Arc<SocketInode>> { in get_socket() 910 let f = fd_table_guard.get_file_by_fd(fd)?; in get_socket()
|
/DragonOS/kernel/src/net/socket/ |
H A D | mod.rs | 265 EventPoll::ep_remove(&mut epoll.lock_irqsave(), epitem.fd(), None)?; in clear_epoll()
|
/DragonOS/docs/community/ChangeLog/V0.1.x/ |
H A D | V0.1.9.md | 1811 修复drop fd时,文件描述符引用不为0的问题 (#382)
|