mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 03:06:39 +00:00
Add 'socket' member to 'Native_capability::Dst'
In the final version, the 'socket' will be the only member to remain in the 'Dst' time. In the transition phase, we store both the old 'tid' and the 'socket'.
This commit is contained in:
parent
c09cd2d1a7
commit
1c3b9a6f68
@ -56,7 +56,7 @@ namespace Genode {
|
||||
static IF *deref(Capability<IF> cap)
|
||||
{
|
||||
/* check if this is a pseudo capability */
|
||||
if (cap.dst() != 0 || !cap.local_name())
|
||||
if (cap.dst().tid != 0 || !cap.local_name())
|
||||
throw Non_local_capability();
|
||||
|
||||
/*
|
||||
@ -81,7 +81,8 @@ namespace Genode {
|
||||
template <typename IF>
|
||||
static Capability<IF> capability(IF *interface)
|
||||
{
|
||||
return reinterpret_cap_cast<IF>(Native_capability(0, (long)interface));
|
||||
typedef Native_capability::Dst Dst;
|
||||
return reinterpret_cap_cast<IF>(Native_capability(Dst(), (long)interface));
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -95,9 +95,20 @@ namespace Genode {
|
||||
return (t1.tid != t2.tid) || (t1.pid != t2.pid); }
|
||||
|
||||
struct Cap_dst_policy {
|
||||
typedef long Dst;
|
||||
static bool valid(Dst id) { return id != 0; }
|
||||
static Dst invalid() { return 0; }
|
||||
|
||||
struct Dst
|
||||
{
|
||||
long tid; /* XXX to be removed once the transition to SCM rights
|
||||
is completed */
|
||||
int socket;
|
||||
|
||||
Dst() : tid(0), socket(-1) { }
|
||||
|
||||
Dst(long tid, int socket) : tid(tid), socket(socket) { }
|
||||
};
|
||||
|
||||
static bool valid(Dst id) { return id.tid != 0; }
|
||||
static Dst invalid() { return Dst(); }
|
||||
static void copy(void* dst, Native_capability_tpl<Cap_dst_policy>* src);
|
||||
};
|
||||
|
||||
|
@ -327,7 +327,9 @@ namespace Genode {
|
||||
long local_name = _get_env_ulong("parent_local_name");
|
||||
|
||||
/* produce typed capability manually */
|
||||
return reinterpret_cap_cast<Parent>(Native_capability(tid, local_name));
|
||||
typedef Native_capability::Dst Dst;
|
||||
return reinterpret_cap_cast<Parent>(Native_capability(Dst(tid, -1),
|
||||
local_name));
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,7 +93,7 @@ void Ipc_istream::_wait()
|
||||
|
||||
Ipc_istream::Ipc_istream(Msgbuf_base *rcv_msg)
|
||||
: Ipc_unmarshaller(rcv_msg->buf, rcv_msg->size()),
|
||||
Native_capability(lx_gettid(), 0),
|
||||
Native_capability(Dst(lx_gettid(), -1), 0),
|
||||
_rcv_msg(rcv_msg)
|
||||
{ }
|
||||
|
||||
@ -109,7 +109,7 @@ void Ipc_client::_prepare_next_call()
|
||||
{
|
||||
/* prepare next request in buffer */
|
||||
long local_name = Ipc_ostream::_dst.local_name();
|
||||
long tid = Native_capability::dst();
|
||||
long tid = Native_capability::dst().tid;
|
||||
|
||||
_write_offset = 0;
|
||||
_write_to_buf(local_name);
|
||||
@ -123,7 +123,7 @@ void Ipc_client::_prepare_next_call()
|
||||
void Ipc_client::_call()
|
||||
{
|
||||
if (Ipc_ostream::_dst.valid()) {
|
||||
lx_call(Ipc_ostream::_dst.dst(),
|
||||
lx_call(Ipc_ostream::_dst.dst().tid,
|
||||
_snd_msg->buf, _write_offset,
|
||||
_rcv_msg->buf, _rcv_msg->size());
|
||||
}
|
||||
@ -152,7 +152,7 @@ void Ipc_server::_prepare_next_reply_wait()
|
||||
long tid = 0;
|
||||
if (_reply_needed) {
|
||||
_read_from_buf(tid);
|
||||
Ipc_ostream::_dst = Native_capability(tid, 0); /* only _tid member is used */
|
||||
Ipc_ostream::_dst = Native_capability(Dst(tid, -1), 0); /* only _tid member is used */
|
||||
}
|
||||
|
||||
/* prepare next reply */
|
||||
|
@ -116,7 +116,7 @@ const char *Process::_priv_pd_args(Parent_capability parent_cap,
|
||||
enum { ENV_STR_LEN = 256 };
|
||||
static char envbuf[5][ENV_STR_LEN];
|
||||
Genode::snprintf(envbuf[0], ENV_STR_LEN, "parent_tid=%ld",
|
||||
parent_cap.dst());
|
||||
parent_cap.dst().tid);
|
||||
Genode::snprintf(envbuf[1], ENV_STR_LEN, "parent_local_name=%lu",
|
||||
parent_cap.local_name());
|
||||
Genode::snprintf(envbuf[2], ENV_STR_LEN, "DISPLAY=%s",
|
||||
|
Loading…
Reference in New Issue
Block a user