Skip to content

Commit

Permalink
fixed the incorrect returning value of an interrupted ioctl call, whi…
Browse files Browse the repository at this point in the history
…ch otherwise would upset the apps when the device is suspended. Also adjust the slob buffer allocation size, so the vending app could allocate a buffer sized a little less than 128k. The buffer allocation method is not optimal at the moment - quite a bit of unused memory wasted, which needs to be improved
  • Loading branch information
rong1129 committed Mar 2, 2012
1 parent 1ef4af6 commit cf75513
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions module/new/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1324,8 +1324,8 @@ static int bcmd_write_free_buffer(struct binder_proc *proc, struct binder_thread

bucket = fast_slob_bucket(proc->slob, sbuf);
if (bucket < 0 || (sbuf->uaddr_data != (unsigned long)uaddr)) {
printk("binder: pid %d (tid %d) trying to free an invalid buffer %p, bucket %d, %lu\n",
proc->pid, thread->pid, uaddr, bucket, sbuf->uaddr_data);
printk("binder: pid %d (tid %d) trying to free an invalid buffer %p, bucket %d, sbuf %p\n",
proc->pid, thread->pid, uaddr, bucket, sbuf);
return -1;
}

Expand Down Expand Up @@ -1899,11 +1899,8 @@ static long binder_thread_read(struct binder_proc *proc, struct binder_thread *t
break;

n = _bcmd_read_msg(q, &msg);
if (n < 0) {
if (n == -ERESTARTSYS) // compat
n = -EINTR;
if (n < 0)
goto clean_up;
}

if (proc_looper) {
atomic_dec(&proc->proc_loopers);
Expand Down Expand Up @@ -2202,7 +2199,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
if (size < 512 * 1024)
proc->slob = fast_slob_create(size, 16 * 1024, 4, 2);
else
proc->slob = fast_slob_create(size, 64 * 1024, 3, 4);
proc->slob = fast_slob_create(size, 128 * 1024, 3, 4);
if (!proc->slob)
return -ENOMEM;

Expand Down

0 comments on commit cf75513

Please sign in to comment.