static void PrintConstants(const Proto* f) { int i,n=f->sizek; printf("constants (%d) for %p:\n",n,VOID(f)); for (i=0; i<n; i++) { printf("\t%d\t",i+1); PrintConstant(f,i); printf("\n"); } }
static int w_search(register N_INFO *info, register N_KEYDEF *keyinfo, uchar *key, ulong page, uchar *father_buff, uchar *father_keypos, ulong father_page) { int error,flag; uint comp_flag,nod_flag; uchar *temp_buff,*keypos; uchar keybuff[N_MAX_KEY_BUFF]; DBUG_ENTER("w_search"); DBUG_PRINT("enter",("page: %ld",page)); if (page == NI_POS_ERROR) DBUG_RETURN(1); /* No key, make new */ if (keyinfo->base.flag & HA_SORT_ALLOWS_SAME) comp_flag=SEARCH_BIGGER; /* Put after same key */ else if (keyinfo->base.flag & HA_NOSAME) comp_flag=SEARCH_FIND; /* No dupplicates */ else comp_flag=SEARCH_SAME; /* Keys in rec-pos order */ if (!(temp_buff= (uchar*) my_alloca((uint) keyinfo->base.block_length+ N_MAX_KEY_BUFF))) DBUG_RETURN(-1); if (!_nisam_fetch_keypage(info,keyinfo,page,temp_buff,0)) goto err; flag=(*keyinfo->bin_search)(info,keyinfo,temp_buff,key,0,comp_flag,&keypos, keybuff); nod_flag=test_if_nod(temp_buff); if (flag == 0) { my_errno=HA_ERR_FOUND_DUPP_KEY; /* get position to record with dupplicated key */ VOID((*keyinfo->get_key)(keyinfo,nod_flag,&keypos,keybuff)); info->dupp_key_pos=_nisam_dpos(info,test_if_nod(temp_buff),keypos); my_afree((byte*) temp_buff); DBUG_RETURN(-1); } if ((error=w_search(info,keyinfo,key,_nisam_kpos(nod_flag,keypos), temp_buff,keypos,page)) >0) { error=_nisam_insert(info,keyinfo,key,temp_buff,keypos,keybuff,father_buff, father_keypos,father_page); if (_nisam_write_keypage(info,keyinfo,page,temp_buff)) goto err; } my_afree((byte*) temp_buff); DBUG_RETURN(error); err: my_afree((byte*) temp_buff); DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_RETURN (-1); } /* w_search */
void _nisam_log_command(enum nisam_log_commands command, N_INFO *info, const byte *buffert, uint length, int result) { char buff[9]; int error,old_errno; ulong pid=(ulong) GETPID(); old_errno=my_errno; buff[0]=(char) command; int2store(buff+1,info->dfile); int4store(buff+3,pid); int2store(buff+7,result); pthread_mutex_lock(&THR_LOCK_isam); error=my_lock(nisam_log_file,F_WRLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE)); VOID(my_write(nisam_log_file,buff,sizeof(buff),MYF(0))); if (buffert) VOID(my_write(nisam_log_file,buffert,length,MYF(0))); if (!error) error=my_lock(nisam_log_file,F_UNLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE)); pthread_mutex_unlock(&THR_LOCK_isam); my_errno=old_errno; }
//------------------------------------------------------------------------ VOID CEGTrayIcon::ShowCoolTip(TCHAR * pszTitle, TCHAR * pszText, UINT nTime) { if( !m_bRegistered ) return; m_IconData.uFlags |= NIF_INFO; _tcsncpy(m_IconData.szInfo, pszText, 256); _tcsncpy(m_IconData.szInfoTitle, pszTitle, 64); m_IconData.dwInfoFlags = NIIF_INFO; m_IconData.uTimeout = nTime; Shell_NotifyIcon( NIM_MODIFY, &m_IconData ); return VOID(); }
static SCM expand_eval_when (SCM expr, SCM env) { ASSERT_SYNTAX (scm_ilength (expr) >= 3, s_bad_expression, expr); ASSERT_SYNTAX (scm_ilength (CADR (expr)) > 0, s_bad_expression, expr); if (scm_is_true (scm_memq (sym_eval, CADR (expr))) || scm_is_true (scm_memq (sym_load, CADR (expr)))) return expand_sequence (CDDR (expr), env); else return VOID (scm_source_properties (expr)); }
int main(int argc,char **argv) { int status,wait_ret; uint i; N_KEYDEF keyinfo[10]; N_RECINFO recinfo[10]; MY_INIT(argv[0]); get_options(argc,argv); keyinfo[0].seg[0].base.start=0; keyinfo[0].seg[0].base.length=8; keyinfo[0].seg[0].base.type=HA_KEYTYPE_TEXT; keyinfo[0].seg[0].base.flag=HA_SPACE_PACK; keyinfo[0].seg[1].base.type=0; keyinfo[0].base.flag = (uint8) HA_PACK_KEY; keyinfo[1].seg[0].base.start=8; keyinfo[1].seg[0].base.length=sizeof(uint32); keyinfo[1].seg[0].base.type=HA_KEYTYPE_LONG_INT; keyinfo[1].seg[0].base.flag=0; keyinfo[1].seg[1].base.type=0; keyinfo[1].base.flag =HA_NOSAME; recinfo[0].base.type=0; recinfo[0].base.length=sizeof(record.id); recinfo[1].base.type=0; recinfo[1].base.length=sizeof(record.nr); recinfo[2].base.type=0; recinfo[2].base.length=sizeof(record.text); recinfo[3].base.type=FIELD_LAST; puts("- Creating isam-file"); my_delete(filename,MYF(0)); /* Remove old locks under gdb */ if (nisam_create(filename,2,&keyinfo[0],&recinfo[0],10000,0,0,0,0L)) exit(1); rnd_init(0); printf("- Starting %d processes\n",forks); fflush(stdout); for (i=0 ; i < forks; i++) { if (!fork()) { start_test(i+1); sleep(1); return 0; } VOID(rnd(1)); } for (i=0 ; i < forks ; i++) while ((wait_ret=wait(&status)) && wait_ret == -1); return 0; }
void CTobject ( GPUbuffer * VO , GLuint vertices , glm::vec4 * points , glm::vec4 * colors , glm::vec2 * textures ) { size_t offset = 0; size_t size_points = sizeof(glm::vec4)*vertices; size_t size_colors = sizeof(glm::vec4)*vertices; size_t size_textures = sizeof(glm::vec2)*vertices; currentShader(shaders[shader_texture]); glGenBuffers(1,&VO->VBO); glBindBuffer(GL_ARRAY_BUFFER,VO->VBO); glBufferData( GL_ARRAY_BUFFER, size_points+size_colors+size_textures, NULL, GL_STATIC_DRAW ); glBufferSubData(GL_ARRAY_BUFFER,offset,size_points ,VOID(points)); offset += size_points; glBufferSubData(GL_ARRAY_BUFFER,offset,size_colors ,VOID(colors)); offset += size_colors; glBufferSubData(GL_ARRAY_BUFFER,offset,size_textures,VOID(textures)); offset += size_textures; offset = 0; glGenVertexArrays(1,&VO->VAO); glBindVertexArray(VO->VAO); glEnableVertexAttribArray(shaderPositions[shader_texture]); glEnableVertexAttribArray(shaderColors[shader_texture]); glEnableVertexAttribArray(CTvTexture); glVertexAttribPointer(shaderPositions[shader_texture],4,GL_FLOAT,GL_FALSE,0,VOID(offset)); offset += size_points; glVertexAttribPointer(shaderColors[shader_texture] ,4,GL_FLOAT,GL_FALSE,0,VOID(offset)); offset += size_colors; glVertexAttribPointer(CTvTexture ,2,GL_FLOAT,GL_FALSE,0,VOID(offset)); offset += size_textures; }
int nisam_is_changed(N_INFO *info) { int result; DBUG_ENTER("nisam_is_changed"); #ifndef NO_LOCKING if (_nisam_readinfo(info,F_RDLCK,1)) DBUG_RETURN(-1); VOID(_nisam_writeinfo(info,0)); #endif result=(int) info->data_changed; info->data_changed=0; DBUG_PRINT("exit",("result: %d",result)); DBUG_RETURN(result); }
void _nisam_log_record(enum nisam_log_commands command, N_INFO *info, const byte *record, ulong filepos, int result) { char buff[17],*pos; int error,old_errno; uint length; ulong pid=(ulong) GETPID(); old_errno=my_errno; if (!info->s->base.blobs) length=info->s->base.reclength; else length=info->s->base.reclength+ _calc_total_blob_length(info,record); buff[0]=(char) command; int2store(buff+1,info->dfile); int4store(buff+3,pid); int2store(buff+7,result); int4store(buff+9,filepos); int4store(buff+13,length); pthread_mutex_lock(&THR_LOCK_isam); error=my_lock(nisam_log_file,F_WRLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE)); VOID(my_write(nisam_log_file,buff,sizeof(buff),MYF(0))); VOID(my_write(nisam_log_file,(byte*) record,info->s->base.reclength,MYF(0))); if (info->s->base.blobs) { N_BLOB *blob,*end; for (end=info->blobs+info->s->base.blobs, blob= info->blobs; blob != end ; blob++) { bmove(&pos,record+blob->offset+blob->pack_length,sizeof(char*)); VOID(my_write(nisam_log_file,pos,blob->length,MYF(0))); } } if (!error) error=my_lock(nisam_log_file,F_UNLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE)); pthread_mutex_unlock(&THR_LOCK_isam); my_errno=old_errno; }
void wait_for_free_space(const char *filename, int errors) { if (errors == 0) my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE)) my_printf_error(EE_DISK_FULL, "Retry in %d secs. Message reprinted in %d secs", MYF(ME_BELL | ME_NOREFRESH), MY_WAIT_FOR_USER_TO_FIX_PANIC, MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC ); VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC)); }
static SCM expand_if (SCM expr, SCM env SCM_UNUSED) { const SCM cdr_expr = CDR (expr); const long length = scm_ilength (cdr_expr); ASSERT_SYNTAX (length == 2 || length == 3, s_expression, expr); return CONDITIONAL (scm_source_properties (expr), expand (CADR (expr), env), expand (CADDR (expr), env), ((length == 3) ? expand (CADDDR (expr), env) : VOID (SCM_BOOL_F))); }
my_string my_path(my_string to, const char *progname, const char *own_pathname_part) { my_string start,end,prog; DBUG_ENTER("my_path"); start=to; /* Return this */ if (progname && (dirname_part(to, progname) || find_file_in_path(to,progname) || ((prog=getenv("_")) != 0 && dirname_part(to,prog)))) { VOID(intern_filename(to,to)); if (!test_if_hard_path(to)) { if (!my_getwd(curr_dir,FN_REFLEN,MYF(0))) bchange(to,0,curr_dir, (uint) strlen(curr_dir), (uint) strlen(to)+1); } } else { if ((end = getenv("MY_BASEDIR_VERSION")) == 0 && (end = getenv("MY_BASEDIR")) == 0) { #ifdef DEFAULT_BASEDIR end= (char*) DEFAULT_BASEDIR; #else end= (char*) "/my/"; #endif } VOID(intern_filename(to,end)); to=strend(to); if (to != start && to[-1] != FN_LIBCHAR) *to++ = FN_LIBCHAR; VOID(strmov(to,own_pathname_part)); } DBUG_PRINT("exit",("to: '%s'",start)); DBUG_RETURN(start); } /* my_path */
int _nisam_delete_static_record(N_INFO *info) { uchar temp[5]; /* 1+sizeof(uint32) */ info->s->state.del++; info->s->state.empty+=info->s->base.reclength; temp[0]= '\0'; /* Mark that record is deleted */ int4store(temp+1,info->s->state.dellink); info->s->state.dellink = info->lastpos; info->rec_cache.seek_not_done=1; VOID(my_seek(info->dfile,info->lastpos,MY_SEEK_SET,MYF(0))); return (my_write(info->dfile,(byte*) temp,(uint) sizeof(temp), MYF(MY_NABP)) != 0); }
int myrg_close(MYRG_INFO *info) { int error=0,new_error; MYRG_TABLE *file; DBUG_ENTER("myrg_close"); /* Assume that info->children_attached means that this is called from direct use of MERGE, not from a MySQL server. In this case the children must be closed and info->rec_per_key_part is part of the 'info' multi_alloc. If info->children_attached is false, this is called from a MySQL server. Children are closed independently but info->rec_per_key_part must be freed. Just in case of a server panic (myrg_panic()) info->children_attached might be true. We would close the children though they should be closed independently and info->rec_per_key_part is not freed. This should be acceptable for a panic. In case of a MySQL server and no children, children_attached is always true. In this case no rec_per_key_part has been allocated. So it is correct to use the branch where an empty list of tables is (not) closed. */ if (info->children_attached) { for (file= info->open_tables; file != info->end_table; file++) { /* purecov: begin inspected */ if ((new_error= mi_close(file->table))) error= new_error; else file->table= NULL; /* purecov: end */ } } else my_free((uchar*) info->rec_per_key_part, MYF(MY_ALLOW_ZERO_PTR)); delete_queue(&info->by_key); pthread_mutex_lock(&THR_LOCK_open); myrg_open_list=list_delete(myrg_open_list,&info->open_list); pthread_mutex_unlock(&THR_LOCK_open); VOID(pthread_mutex_destroy(&info->mutex)); my_free((uchar*) info,MYF(0)); if (error) { DBUG_RETURN(my_errno=error); } DBUG_RETURN(0); }
static SCM expand_cond_clauses (SCM clause, SCM rest, int elp, int alp, SCM env) { SCM test; const long length = scm_ilength (clause); ASSERT_SYNTAX (length >= 1, s_bad_cond_clause, clause); test = CAR (clause); if (scm_is_eq (test, scm_sym_else) && elp) { const int last_clause_p = scm_is_null (rest); ASSERT_SYNTAX (length >= 2, s_bad_cond_clause, clause); ASSERT_SYNTAX (last_clause_p, s_misplaced_else_clause, clause); return expand_sequence (CDR (clause), env); } if (scm_is_null (rest)) rest = VOID (SCM_BOOL_F); else rest = expand_cond_clauses (CAR (rest), CDR (rest), elp, alp, env); if (length >= 2 && scm_is_eq (CADR (clause), scm_sym_arrow) && alp) { SCM tmp = scm_gensym (scm_from_locale_string ("cond ")); SCM new_env = scm_acons (tmp, tmp, env); ASSERT_SYNTAX (length > 2, s_missing_recipient, clause); ASSERT_SYNTAX (length == 3, s_extra_expression, clause); return LET (SCM_BOOL_F, scm_list_1 (tmp), scm_list_1 (tmp), scm_list_1 (expand (test, env)), CONDITIONAL (SCM_BOOL_F, LEXICAL_REF (SCM_BOOL_F, tmp, tmp), CALL (SCM_BOOL_F, expand (CADDR (clause), new_env), scm_list_1 (LEXICAL_REF (SCM_BOOL_F, tmp, tmp))), rest)); } /* FIXME length == 1 case */ else return CONDITIONAL (SCM_BOOL_F, expand (test, env), expand_sequence (CDR (clause), env), rest); }
void hp_clear(HP_SHARE *info) { DBUG_ENTER("hp_clear"); if (info->block.levels) VOID(hp_free_level(&info->block,info->block.levels,info->block.root, (byte*) 0)); info->block.levels=0; hp_clear_keys(info); info->records= info->deleted= 0; info->data_length= 0; info->blength=1; info->changed=0; info->del_link=0; DBUG_VOID_RETURN; }
void thr_lock_init(THR_LOCK *lock) { DBUG_ENTER("thr_lock_init"); bzero((char*) lock,sizeof(*lock)); VOID(pthread_mutex_init(&lock->mutex,MY_MUTEX_INIT_FAST)); lock->read.last= &lock->read.data; lock->read_wait.last= &lock->read_wait.data; lock->write_wait.last= &lock->write_wait.data; lock->write.last= &lock->write.data; pthread_mutex_lock(&THR_LOCK_lock); /* Add to locks in use */ lock->list.data=(void*) lock; thr_lock_thread_list=list_add(thr_lock_thread_list,&lock->list); pthread_mutex_unlock(&THR_LOCK_lock); DBUG_VOID_RETURN; }
int myrg_create(const char *name, const char **table_names, uint insert_method, my_bool fix_names) { int save_errno; uint errpos; File file; char buff[FN_REFLEN],*end; DBUG_ENTER("myrg_create"); errpos=0; if ((file = my_create(fn_format(buff,name,"",MYRG_NAME_EXT,4),0, O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) goto err; errpos=1; if (table_names) { for ( ; *table_names ; table_names++) { strmov(buff,*table_names); if (fix_names) fn_same(buff,name,4); *(end=strend(buff))='\n'; end[1]=0; if (my_write(file,buff,(uint) (end-buff+1), MYF(MY_WME | MY_NABP))) goto err; } } if (insert_method != MERGE_INSERT_DISABLED) { end=strxmov(buff,"#INSERT_METHOD=", get_type(&merge_insert_method,insert_method-1),"\n",NullS); if (my_write(file,buff,(uint) (end-buff),MYF(MY_WME | MY_NABP))) goto err; } if (my_close(file,MYF(0))) goto err; DBUG_RETURN(0); err: save_errno=my_errno ? my_errno : -1; switch (errpos) { case 1: VOID(my_close(file,MYF(0))); } DBUG_RETURN(my_errno=save_errno); } /* myrg_create */
static inline void free_all_read_locks(THR_LOCK *lock, bool using_concurrent_insert) { THR_LOCK_DATA *data=lock->read_wait.data; check_locks(lock,"before freeing read locks",1); /* move all locks from read_wait list to read list */ (*lock->read.last)=data; data->prev=lock->read.last; lock->read.last=lock->read_wait.last; /* Clear read_wait list */ lock->read_wait.last= &lock->read_wait.data; do { pthread_cond_t *cond=data->cond; if ((int) data->type == (int) TL_READ_NO_INSERT) { if (using_concurrent_insert) { /* We can't free this lock; Link lock away from read chain back into read_wait chain */ if (((*data->prev)=data->next)) data->next->prev=data->prev; else lock->read.last=data->prev; *lock->read_wait.last= data; data->prev= lock->read_wait.last; lock->read_wait.last= &data->next; continue; } lock->read_no_write_count++; } DBUG_PRINT("lock",("giving read lock to thread: %ld", data->owner->info->thread_id)); data->cond=0; /* Mark thread free */ VOID(pthread_cond_signal(cond)); } while ((data=data->next)); *lock->read_wait.last=0; if (!lock->read_wait.data) lock->write_lock_count=0; check_locks(lock,"after giving read locks",0); }
int main(int argc, char **argv) { int error,i,first; ulong total_count,total_error,total_recover; MY_INIT(argv[0]); log_filename=myisam_log_filename; get_options(&argc,&argv); /* Nr of isam-files */ max_files=(set_maximum_open_files(min(max_files,8))-6)/2; if (update) printf("Trying to %s MyISAM files according to log '%s'\n", (recover ? "recover" : "update"),log_filename); error= examine_log(log_filename,argv); if (update && ! error) puts("Tables updated successfully"); total_count=total_error=total_recover=0; for (i=first=0 ; command_name[i] ; i++) { if (com_count[i][0]) { if (!first++) { if (verbose || update) puts(""); puts("Commands Used count Errors Recover errors"); } printf("%-12s%9ld%10ld%17ld\n",command_name[i],com_count[i][0], com_count[i][1],com_count[i][2]); total_count+=com_count[i][0]; total_error+=com_count[i][1]; total_recover+=com_count[i][2]; } } if (total_count) printf("%-12s%9ld%10ld%17ld\n","Total",total_count,total_error, total_recover); if (re_open_count) printf("Had to do %d re-open because of too few possibly open files\n", re_open_count); VOID(mi_panic(HA_PANIC_CLOSE)); my_end(test_info ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); exit(error); return 0; /* No compiler warning */ } /* main */
int my_getwd(my_string buf, uint size, myf MyFlags) { my_string pos; DBUG_ENTER("my_getwd"); DBUG_PRINT("my",("buf: 0x%lx size: %d MyFlags %d", buf,size,MyFlags)); #if ! defined(MSDOS) if (curr_dir[0]) /* Current pos is saved here */ VOID(strmake(buf,&curr_dir[0],size-1)); else #endif { #if defined(HAVE_GETCWD) if (!getcwd(buf,size-2) && MyFlags & MY_WME) { my_errno=errno; my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); return(-1); } #elif defined(HAVE_GETWD) { char pathname[MAXPATHLEN]; getwd(pathname); strmake(buf,pathname,size-1); } #elif defined(VMS) if (!getcwd(buf,size-2,1) && MyFlags & MY_WME) { my_errno=errno; my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); return(-1); } intern_filename(buf,buf); #else #error "No way to get current directory" #endif if (*((pos=strend(buf))-1) != FN_LIBCHAR) /* End with FN_LIBCHAR */ { pos[0]= FN_LIBCHAR; pos[1]=0; } (void) strmake(&curr_dir[0],buf,(size_s) (FN_REFLEN-1)); } DBUG_RETURN(0); } /* my_getwd */
static void PrintHeader(const Proto *f) { const char *s = getstr(f->source); if (*s == '@' || *s == '=') s++; else if (*s == LUA_SIGNATURE[0]) s = "(bstring)"; else s = "(string)"; printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n", (f->linedefined == 0) ? "main" : "function", s, f->linedefined, f->lastlinedefined, S(f->sizecode), f->sizecode * Sizeof(Instruction), VOID(f)); printf("%d%s param%s, %d slot%s, %d upvalue%s, ", f->numparams, f->is_vararg ? "+" : "", SS(f->numparams), S(f->maxstacksize), S(f->nups)); printf("%d local%s, %d constant%s, %d function%s\n", S(f->sizelocvars), S(f->sizek), S(f->sizep)); }
static void PrintHeader(const LuaProto* f) { const char* s=f->source ? f->source->c_str() : "=?"; if (*s=='@' || *s=='=') s++; else if (*s==LUA_SIGNATURE[0]) s="(bstring)"; else s="(string)"; printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n", (f->linedefined==0)?"main":"function",s, f->linedefined,f->lastlinedefined, S(f->instructions_.size()),VOID(f)); printf("%d%s param%s, %d slot%s, %d upvalue%s, ", (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams), S(f->maxstacksize),S(f->upvalues.size())); printf("%d local%s, %d constant%s, %d function%s\n", S(f->locvars.size()),S(f->constants.size()),S(f->subprotos_.size())); }
byte *my_malloc_lock(uint size,myf MyFlags) { int success; uint pagesize=sysconf(_SC_PAGESIZE); byte *ptr; struct st_mem_list *element; DBUG_ENTER("my_malloc_lock"); size=((size-1) & ~(pagesize-1))+pagesize; if (!(ptr=memalign(pagesize,size))) { if (MyFlags & (MY_FAE+MY_WME)) my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size); DBUG_RETURN(0); } success = mlock((byte*) ptr,size); if (success != 0 && geteuid() == 0) { DBUG_PRINT("warning",("Failed to lock memory. errno %d\n", errno)); fprintf(stderr, "Warning: Failed to lock memory. errno %d\n", errno); } else { /* Add block in a list for munlock */ if (!(element=(struct st_mem_list*) my_malloc(sizeof(*element),MyFlags))) { VOID(munlock((byte*) ptr,size)); free(ptr); DBUG_RETURN(0); } element->list.data=(byte*) element; element->page=ptr; element->size=size; pthread_mutex_lock(&THR_LOCK_malloc); mem_list=list_add(mem_list,&element->list); pthread_mutex_unlock(&THR_LOCK_malloc); } DBUG_RETURN(ptr); }
void SexePrintHeader(const Proto* f) { const char* s=f->source ? getstr(f->source) : "=?"; if (*s=='@' || *s=='=' || *s == '#') s++; else if (*s==SEXE_SIGNATURE[0]) s="(bstring)"; else s="(string)"; printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n", (f->linedefined==0)?"main":"function",s, f->linedefined,f->lastlinedefined, S(f->sizecode),VOID(f)); printf("%d%s param%s, %d slot%s, %d upvalue%s, ", (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams), S(f->maxstacksize),S(f->sizeupvalues)); printf("%d local%s, %d constant%s, %d function%s\n", S(f->sizelocvars),S(f->sizek),S(f->sizep)); }
void my_free_lock(byte *ptr,myf Myflags __attribute__((unused))) { LIST *list; struct st_mem_list *element=0; pthread_mutex_lock(&THR_LOCK_malloc); for (list=mem_list ; list ; list=list->next) { element=(struct st_mem_list*) list->data; if (ptr == element->page) { /* Found locked mem */ VOID(munlock((byte*) ptr,element->size)); mem_list=list_delete(mem_list,list); break; } } pthread_mutex_unlock(&THR_LOCK_malloc); if (element) my_free((gptr) element,MYF(0)); free(ptr); /* Free even if not locked */ }
// When the firmware is built as not Standalone, the secondary cores need to wait the firmware // entirely written into DRAM. It is the firmware from DRAM which will wake up the secondary cores. VOID NonSecureWaitForFirmware ( VOID ) { VOID (*secondary_start)(VOID); // The secondary cores will execute the firmware once wake from WFI. secondary_start = (VOID (*)())PcdGet32(PcdFvBaseAddress); ArmCallWFI(); // Acknowledge the interrupt and send End of Interrupt signal. ArmGicAcknowledgeInterrupt (PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase), NULL, NULL); // Jump to secondary core entry point. secondary_start (); // PEI Core should always load and never return ASSERT (FALSE); }
static int tcache_flush_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { int ret; tcache_t *tcache; VOID(); tcache = TCACHE_GET(); if (tcache == NULL) { ret = 0; goto RETURN; } tcache_destroy(tcache); TCACHE_SET(NULL); ret = 0; RETURN: return (ret); }
int _mi_test_if_changed(register MI_INFO *info) { MYISAM_SHARE *share=info->s; if (share->state.process != share->last_process || share->state.unique != info->last_unique || share->state.update_count != info->last_loop) { /* Keyfile has changed */ DBUG_PRINT("info",("index file changed")); if (share->state.process != share->this_process) VOID(flush_key_blocks(share->kfile,FLUSH_RELEASE)); share->last_process=share->state.process; info->last_unique= share->state.unique; info->last_loop= share->state.update_count; info->update|= HA_STATE_WRITTEN; /* Must use file on next */ info->data_changed= 1; /* For mi_is_changed */ return 1; } return (!(info->update & HA_STATE_AKTIV) || (info->update & (HA_STATE_WRITTEN | HA_STATE_DELETED | HA_STATE_KEY_CHANGED))); } /* _mi_test_if_changed */
int mi_rsame(MI_INFO *info, uchar *record, int inx) { DBUG_ENTER("mi_rsame"); if (inx != -1 && ! mi_is_key_active(info->s->state.key_map, inx)) { DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX); } if (info->lastpos == HA_OFFSET_ERROR || info->update & HA_STATE_DELETED) { DBUG_RETURN(my_errno=HA_ERR_KEY_NOT_FOUND); /* No current record */ } info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); /* Read row from data file */ if (fast_mi_readinfo(info)) DBUG_RETURN(my_errno); if (inx >= 0) { info->lastinx=inx; info->lastkey_length=_mi_make_key(info,(uint) inx,info->lastkey,record, info->lastpos); if (info->s->concurrent_insert) rw_rdlock(&info->s->key_root_lock[inx]); VOID(_mi_search(info,info->s->keyinfo+inx,info->lastkey, USE_WHOLE_KEY, SEARCH_SAME, info->s->state.key_root[inx])); if (info->s->concurrent_insert) rw_unlock(&info->s->key_root_lock[inx]); } if (!(*info->read_record)(info,info->lastpos,record)) DBUG_RETURN(0); if (my_errno == HA_ERR_RECORD_DELETED) my_errno=HA_ERR_KEY_NOT_FOUND; DBUG_RETURN(my_errno); } /* mi_rsame */