android binder机制实现
2010-05-31 14:30:00 来源:WEB开发网#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, int)
#define BINDER_THREAD_EXIT _IOW('b', 8, int)
#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, int64_t) #define BINDER_SET_MAX_THREADS _IOW('b', 5, size_t) #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, int) #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, int) #define BINDER_THREAD_EXIT _IOW('b', 8, int) #define BINDER_VERSION _IOWR('b', 9, struct binder_version)
BR_XXX等宏为BinderDriverReturnProtocol,表示Binder驱动返回协议。
BC_XXX等宏为BinderDriverCommandProtocol,表示Binder驱动命令协议。
binder_thread是Binder驱动程序中使用的另外一个重要的数据结构,数据结构的定义如下所示:
Java代码 < width="14" height="15" src="http://mintelong.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer">
struct binder_thread {
struct binder_proc *proc;
struct rb_node rb_node;
int pid;
int looper;
struct binder_transaction *transaction_stack;
struct list_head todo;
uint32_t return_error;
uint32_t return_error2;
wait_queue_head_t wait;
struct binder_stats stats;
};
struct binder_thread { struct binder_proc *proc; struct rb_node rb_node; int pid; int looper; struct binder_transaction *transaction_stack; struct list_head todo; uint32_t return_error; uint32_t return_error2; wait_queue_head_t wait; struct binder_stats stats; };
binder_thread 的各个成员信息是从rb_node中得出。
BINDER_WRITE_READ是最重要的ioctl,它使用一个数据结构binder_write_read定义读写的数据。
Java代码 < width="14" height="15" src="http://mintelong.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf"
更多精彩
赞助商链接