MCPcopy Create free account
hub / github.com/MariaDB/server / kill_threads_callback

Function kill_threads_callback

sql/sql_parse.cc:9240–9268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9238
9239
9240static my_bool kill_threads_callback(THD *thd, kill_threads_callback_arg *arg)
9241{
9242 if (thd->security_ctx->user)
9243 {
9244 /*
9245 Check that hostname (if given) and user name matches.
9246
9247 host.str[0] == '%' means that host name was not given. See sql_yacc.yy
9248 */
9249 if (((arg->user->host.str[0] == '%' && !arg->user->host.str[1]) ||
9250 !strcmp(thd->security_ctx->host_or_ip, arg->user->host.str)) &&
9251 !strcmp(thd->security_ctx->user, arg->user->user.str))
9252 {
9253 if (!(arg->thd->security_ctx->master_access &
9254 PRIV_KILL_OTHER_USER_PROCESS) &&
9255 !arg->thd->security_ctx->user_matches(thd->security_ctx))
9256 {
9257 return MY_TEST(arg->thd->security_ctx->master_access & PROCESS_ACL);
9258 }
9259 arg->counter++;
9260 mysql_mutex_lock(&thd->LOCK_thd_kill); // Lock from delete
9261 mysql_mutex_lock(&thd->LOCK_thd_data);
9262 thd->awake_no_mutex(arg->kill_signal);
9263 mysql_mutex_unlock(&thd->LOCK_thd_data);
9264 mysql_mutex_unlock(&thd->LOCK_thd_kill);
9265 }
9266 }
9267 return 0;
9268}
9269
9270
9271static uint kill_threads_for_user(THD *thd, LEX_USER *user,

Callers

nothing calls this directly

Calls 2

user_matchesMethod · 0.80
awake_no_mutexMethod · 0.80

Tested by

no test coverage detected