mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	Kernel: Prepare Socket for becoming a File.
Make the Socket functions take a FileDescriptor& rather than a socket role throughout the code. Also change threads to block on a FileDescriptor, rather than either an fd index or a Socket.
This commit is contained in:
		
							parent
							
								
									9f633a1871
								
							
						
					
					
						commit
						03da7046bd
					
				
					 14 changed files with 118 additions and 115 deletions
				
			
		|  | @ -11,9 +11,9 @@ | |||
| #include <AK/Vector.h> | ||||
| 
 | ||||
| class Alarm; | ||||
| class FileDescriptor; | ||||
| class Process; | ||||
| class Region; | ||||
| class Socket; | ||||
| 
 | ||||
| enum class ShouldUnblockThread { No = 0, Yes }; | ||||
| 
 | ||||
|  | @ -86,12 +86,13 @@ public: | |||
| 
 | ||||
|     void sleep(dword ticks); | ||||
|     void block(Thread::State); | ||||
|     void block(Thread::State, FileDescriptor&); | ||||
|     void unblock(); | ||||
| 
 | ||||
|     void set_wakeup_time(qword t) { m_wakeup_time = t; } | ||||
|     qword wakeup_time() const { return m_wakeup_time; } | ||||
|     void snooze_until(Alarm&); | ||||
|     KResult wait_for_connect(Socket&); | ||||
|     KResult wait_for_connect(FileDescriptor&); | ||||
| 
 | ||||
|     const FarPtr& far_ptr() const { return m_far_ptr; } | ||||
| 
 | ||||
|  | @ -116,8 +117,6 @@ public: | |||
|     bool has_used_fpu() const { return m_has_used_fpu; } | ||||
|     void set_has_used_fpu(bool b) { m_has_used_fpu = b; } | ||||
| 
 | ||||
|     void set_blocked_socket(Socket*); | ||||
| 
 | ||||
|     void set_default_signal_dispositions(); | ||||
|     void push_value_on_stack(dword); | ||||
|     void make_userspace_stack_for_main_thread(Vector<String> arguments, Vector<String> environment); | ||||
|  | @ -148,10 +147,9 @@ private: | |||
|     void* m_kernel_stack { nullptr }; | ||||
|     void* m_kernel_stack_for_signal_handler { nullptr }; | ||||
|     pid_t m_waitee_pid { -1 }; | ||||
|     int m_blocked_fd { -1 }; | ||||
|     RetainPtr<FileDescriptor> m_blocked_descriptor; | ||||
|     timeval m_select_timeout; | ||||
|     SignalActionData m_signal_action_data[32]; | ||||
|     RetainPtr<Socket> m_blocked_socket; | ||||
|     Region* m_signal_stack_user_region { nullptr }; | ||||
|     Alarm* m_snoozing_alarm { nullptr }; | ||||
|     Vector<int> m_select_read_fds; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling