~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_lockmem.c

  • Committer: Jay Pipes
  • Date: 2008-07-17 21:15:06 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080717211506-1nntrb8v42ojjgdo
Phase 5 - Remove DBUG from mysys

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
  uint pagesize=sysconf(_SC_PAGESIZE);
38
38
  uchar *ptr;
39
39
  struct st_mem_list *element;
40
 
  DBUG_ENTER("my_malloc_lock");
41
40
 
42
41
  size=((size-1) & ~(pagesize-1))+pagesize;
43
42
  if (!(ptr=memalign(pagesize,size)))
44
43
  {
45
44
    if (MyFlags & (MY_FAE+MY_WME))
46
45
      my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
47
 
    DBUG_RETURN(0);
 
46
    return(0);
48
47
  }
49
48
  success = mlock((uchar*) ptr,size);
50
49
  if (success != 0 && geteuid() == 0)
51
50
  {
52
 
    DBUG_PRINT("warning",("Failed to lock memory. errno %d\n",
53
 
                          errno));
54
51
    fprintf(stderr, "Warning: Failed to lock memory. errno %d\n",
55
52
            errno);
56
53
  }
61
58
    {
62
59
      VOID(munlock((uchar*) ptr,size));
63
60
      free(ptr);
64
 
      DBUG_RETURN(0);
 
61
      return(0);
65
62
    }
66
63
    element->list.data=(uchar*) element;
67
64
    element->page=ptr;
70
67
    mem_list=list_add(mem_list,&element->list);
71
68
    pthread_mutex_unlock(&THR_LOCK_malloc);
72
69
  }
73
 
  DBUG_RETURN(ptr);
 
70
  return(ptr);
74
71
}
75
72
 
76
73