| 1811 | */ |
| 1812 | |
| 1813 | int |
| 1814 | sysctl_handle_opaque(SYSCTL_HANDLER_ARGS) |
| 1815 | { |
| 1816 | int error, tries; |
| 1817 | u_int generation; |
| 1818 | struct sysctl_req req2; |
| 1819 | |
| 1820 | /* |
| 1821 | * Attempt to get a coherent snapshot, by using the thread |
| 1822 | * pre-emption counter updated from within mi_switch() to |
| 1823 | * determine if we were pre-empted during a bcopy() or |
| 1824 | * copyout(). Make 3 attempts at doing this before giving up. |
| 1825 | * If we encounter an error, stop immediately. |
| 1826 | */ |
| 1827 | tries = 0; |
| 1828 | req2 = *req; |
| 1829 | retry: |
| 1830 | generation = curthread->td_generation; |
| 1831 | error = SYSCTL_OUT(req, arg1, arg2); |
| 1832 | if (error) |
| 1833 | return (error); |
| 1834 | tries++; |
| 1835 | if (generation != curthread->td_generation && tries < 3) { |
| 1836 | *req = req2; |
| 1837 | goto retry; |
| 1838 | } |
| 1839 | |
| 1840 | error = SYSCTL_IN(req, arg1, arg2); |
| 1841 | |
| 1842 | return (error); |
| 1843 | } |
| 1844 | |
| 1845 | /* |
| 1846 | * Based on on sysctl_handle_int() convert microseconds to a sbintime. |
no outgoing calls
no test coverage detected