android - recvmsg return error(EBADF) when communicate between two processes using socketpair? -
i'm developing program ipc's call between 2 processes.i create 2 socket fd using socketpair:
int fds[2] = {-1,-1}; if (socketpair(af_local, sock_stream, 0, fds)) { return null; }
in process a(with system permission), send integer(handle) send (using fd[0]) function:
int sock_send_all(int sock_fd, const uint8_t* buf, int len) { int s = len; int ret = send(sock_fd, buf, s, 0); ... }
in process b(with user permission), wait receive handle recvmsg (using fd[1]):
ret = recvmsg(fd, &msg, msg_nosignal);
problem occurs in here: recvmsg return -1 errorno equals 9(ebadf)!
i have surfed web long time try find answer no helpful information. have hints or suggestions? thanks!
is issue process privilege level? or should use setsockopt set something?
unless there ibinder don't know, handles in 1 process aren't valid in process. why can't keep using original socket?
Comments
Post a Comment