More information on the tevent library is available at
We look at the code patch at the start of the smbd process. We start in main().
The function which opens sockets and adds the necessary tevents required to handle socket communication
On the parent processes, the process loops waiting for events to be handled.
A new incoming request triggers the tevent context for the fd which has the handling function set to
The parent process at this point forks a child process which is used to handle the new client. The parent process continues looping in main().
With multichannel support, we can have multiple connections connected to the same client. We do not consider multichannel in this document.
The new connection represented by struct smbXsrv_connection xconn is now connected to the client.
The tevent handler for this socket is now changed to smbd_server_connection_handler().
The child smbd process is now attached to a single client connection. It loops in smbd_process()
Any new data now sent to this socket will trigger the event handler smbd_server_connection_handler().
The call is then processed by the samba server as needed in process_smb.