File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ namespace tinykvm
4343 ~FileDescriptors ();
4444 void reset_to (const FileDescriptors& other);
4545
46+ // / @brief Set a new starting virtual file descriptor. This is useful
47+ // / when there exists a remote VM with its own set of virtual file
48+ // / descriptors, and we want to avoid "collisions". FDs can't be
49+ // / shared between remote VMs, but it's useful to distinguish them.
50+ // / @param vfd_start The new starting virtual file descriptor.
51+ void set_vfd_start (int vfd_start) noexcept {
52+ m_next_fd = vfd_start;
53+ }
54+
4655 // / @brief Add a file descriptor to the list of managed FDs.
4756 // / @param fd The real file descriptor.
4857 // / @param is_socket True if the file descriptor is a socket.
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ int main(int argc, char** argv)
114114 storage_vm.set_verbose_system_calls (getenv (" VERBOSE" ) != nullptr );
115115 storage_vm.set_verbose_mmap_syscalls (getenv (" VERBOSE" ) != nullptr );
116116 storage_vm.set_verbose_thread_syscalls (getenv (" VERBOSE" ) != nullptr );
117+ storage_vm.fds ().set_vfd_start (65536 ); // Avoid "collisions" with master VM
117118 storage_vm.fds ().set_open_readable_callback (
118119 [] (std::string&) -> bool {
119120 return true ;
@@ -183,7 +184,7 @@ int main(int argc, char** argv)
183184 }
184185 auto call_overhead = timed_action ([&] {
185186 for (int i = 0 ; i < 100 ; i++)
186- vm.timed_vmcall (do_it->second , 5 .0f , 21 );
187+ vm.vmcall (do_it->second , 5 .0f , 21 );
187188 }) / 100.0 ;
188189 printf (" Call overhead: %.2fus\n " , call_overhead * 1e6 );
189190
You can’t perform that action at this time.
0 commit comments