AndroidHolder
unread,Sep 27, 2011, 9:48:05 PM9/27/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-porting
First,to be honest,my doubt comes from the binder driver part in /
kernel/drivers/android/binder.c
// 1. register binder as a misc device
static int __init binder_init(void){
int ret;
...
ret = misc_register(&binder_miscdev);
...
}
// 2.declare fops as &binder_fops
static struct miscdevice binder_miscdev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "binder",
.fops = &binder_fops
};
// 3.binder_fops is defined as follows
static struct file_operations binder_fops = {
.owner = THIS_MODULE,
.poll = binder_poll,
.unlocked_ioctl = binder_ioctl,
.mmap = binder_mmap,
.open = binder_open,
.flush = binder_flush,
.release = binder_release,
};
Then take a look at /framework/base/cmds/servicemanager/binder.c,there
are one place where runs ioctl and another place where runs mmap.
int binder_become_context_manager(struct binder_state *bs)
{
return ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0);
}
struct binder_state *binder_open(unsigned mapsize)
{
struct binder_state *bs;
...
bs->mapped = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, bs->fd,
0);
...
}
Since above,I am not sure the relationship between ioctl() and
binder_ioctl() defined in driver ,along with the relationship between
mmap() and binder_mmap() defined in driver,could someone help me to
make it clear,thanks.