Lines Matching refs:state

44 // Thread-specific state for the non-reentrant functions.
125 stubs_state_t* state = static_cast<stubs_state_t*>(ptr);
126 free(state);
151 static passwd* android_iinfo_to_passwd(stubs_state_t* state,
153 snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/");
154 snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/system/bin/sh");
156 passwd* pw = &state->passwd_;
160 pw->pw_dir = state->dir_buffer_;
161 pw->pw_shell = state->sh_buffer_;
174 static passwd* android_id_to_passwd(stubs_state_t* state, unsigned id) {
177 return android_iinfo_to_passwd(state, android_ids + n);
183 static passwd* android_name_to_passwd(stubs_state_t* state, const char* name) {
186 return android_iinfo_to_passwd(state, android_ids + n);
296 static passwd* app_id_to_passwd(uid_t uid, stubs_state_t* state) {
297 passwd* pw = &state->passwd_;
307 print_app_name_from_appid_userid(appid, userid, state->app_name_buffer_,
308 sizeof(state->app_name_buffer_));
311 snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/");
313 snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/data");
316 snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/system/bin/sh");
318 pw->pw_name = state->app_name_buffer_;
319 pw->pw_dir = state->dir_buffer_;
320 pw->pw_shell = state->sh_buffer_;
329 static group* app_id_to_group(gid_t gid, stubs_state_t* state) {
335 print_app_name_from_uid(gid, state->group_name_buffer_,
336 sizeof(state->group_name_buffer_));
338 group* gr = &state->group_;
339 gr->gr_name = state->group_name_buffer_;
348 stubs_state_t* state = __stubs_state();
349 if (state == NULL) {
353 passwd* pw = android_id_to_passwd(state, uid);
357 return app_id_to_passwd(uid, state);
361 stubs_state_t* state = __stubs_state();
362 if (state == NULL) {
366 passwd* pw = android_name_to_passwd(state, login);
370 return app_id_to_passwd(app_id_from_name(login), state);
389 stubs_state_t* state = __stubs_state();
390 if (state == NULL) {
394 group* gr = android_id_to_group(&state->group_, gid);
399 return app_id_to_group(gid, state);
403 stubs_state_t* state = __stubs_state();
404 if (state == NULL) {
408 if (android_name_to_group(&state->group_, name) != 0) {
409 return &state->group_;
412 return app_id_to_group(app_id_from_name(name), state);