MCPcopy Create free account
hub / github.com/F-Stack/f-stack / selrecord

Function selrecord

freebsd/kern/sys_generic.c:1786–1831  ·  view source on GitHub ↗

* Record a select request. */

Source from the content-addressed store, hash-verified

1784 * Record a select request.
1785 */
1786void
1787selrecord(struct thread *selector, struct selinfo *sip)
1788{
1789 struct selfd *sfp;
1790 struct seltd *stp;
1791 struct mtx *mtxp;
1792
1793 stp = selector->td_sel;
1794 /*
1795 * Don't record when doing a rescan.
1796 */
1797 if (stp->st_flags & SELTD_RESCAN)
1798 return;
1799 /*
1800 * Grab one of the preallocated descriptors.
1801 */
1802 sfp = NULL;
1803 if ((sfp = stp->st_free1) != NULL)
1804 stp->st_free1 = NULL;
1805 else if ((sfp = stp->st_free2) != NULL)
1806 stp->st_free2 = NULL;
1807 else
1808 panic("selrecord: No free selfd on selq");
1809 mtxp = sip->si_mtx;
1810 if (mtxp == NULL)
1811 mtxp = mtx_pool_find(mtxpool_select, sip);
1812 /*
1813 * Initialize the sfp and queue it in the thread.
1814 */
1815 sfp->sf_si = sip;
1816 sfp->sf_mtx = mtxp;
1817 STAILQ_INSERT_TAIL(&stp->st_selq, sfp, sf_link);
1818 /*
1819 * Now that we've locked the sip, check for initialization.
1820 */
1821 mtx_lock(mtxp);
1822 if (sip->si_mtx == NULL) {
1823 sip->si_mtx = mtxp;
1824 TAILQ_INIT(&sip->si_tdlist);
1825 }
1826 /*
1827 * Add this thread to the list of selfds listening on this selinfo.
1828 */
1829 TAILQ_INSERT_TAIL(&sip->si_tdlist, sfp, sf_threads);
1830 mtx_unlock(sip->si_mtx);
1831}
1832
1833/* Wake up a selecting thread. */
1834void

Callers 15

mlfk_ipl.cFile · 0.85
audit_pipe_pollFunction · 0.85
ti_pruss_irq_pollFunction · 0.85
ptsdev_pollFunction · 0.85
logpollFunction · 0.85
ttydev_pollFunction · 0.85
kqueue_pollFunction · 0.85
mqf_pollFunction · 0.85
eventfd_pollFunction · 0.85
pipe_pollFunction · 0.85
devpollFunction · 0.85
vn_pollrecordFunction · 0.85

Calls 4

mtx_pool_findFunction · 0.85
panicFunction · 0.70
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected