| 1251 | } |
| 1252 | |
| 1253 | int |
| 1254 | _sx_slock_int(struct sx *sx, int opts LOCK_FILE_LINE_ARG_DEF) |
| 1255 | { |
| 1256 | struct thread *td; |
| 1257 | uintptr_t x; |
| 1258 | int error; |
| 1259 | |
| 1260 | KASSERT(kdb_active != 0 || SCHEDULER_STOPPED() || |
| 1261 | !TD_IS_IDLETHREAD(curthread), |
| 1262 | ("sx_slock() by idle thread %p on sx %s @ %s:%d", |
| 1263 | curthread, sx->lock_object.lo_name, file, line)); |
| 1264 | KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, |
| 1265 | ("sx_slock() of destroyed sx @ %s:%d", file, line)); |
| 1266 | WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER, file, line, NULL); |
| 1267 | |
| 1268 | error = 0; |
| 1269 | td = curthread; |
| 1270 | x = SX_READ_VALUE(sx); |
| 1271 | if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__acquire) || |
| 1272 | !__sx_slock_try(sx, td, &x, true LOCK_FILE_LINE_ARG))) |
| 1273 | error = _sx_slock_hard(sx, opts, x LOCK_FILE_LINE_ARG); |
| 1274 | else |
| 1275 | lock_profile_obtain_lock_success(&sx->lock_object, 0, 0, |
| 1276 | file, line); |
| 1277 | if (error == 0) { |
| 1278 | LOCK_LOG_LOCK("SLOCK", &sx->lock_object, 0, 0, file, line); |
| 1279 | WITNESS_LOCK(&sx->lock_object, 0, file, line); |
| 1280 | TD_LOCKS_INC(curthread); |
| 1281 | } |
| 1282 | return (error); |
| 1283 | } |
| 1284 | |
| 1285 | int |
| 1286 | _sx_slock(struct sx *sx, int opts, const char *file, int line) |
nothing calls this directly
no test coverage detected