Title: sr_open()


sr_open() examines the minor number of the message (the DEVICE field, more specifically; this will reflect which file was opened - for example, if the DEVICE field is equal to 4, /dev/udp0 was opened) and copies the sr_fd_table[] element whose index corresponds to this minor number to the first unused entry of the table (thereby opening a channel). sr_open() sets the element's flag to SFF_INUSE and then calls the protocol specific open function (e.g., udp_open()) for the channel (a pointer to this function is found in the srf_open field of the element). This function's return value sets the element's file descriptor field (srf_fd). Finally sr_open() returns the index of the new element.