diff --git a/base-linux/include/base/local_interface.h b/base-linux/include/base/local_interface.h index 6864f33eaf..8f935e817f 100644 --- a/base-linux/include/base/local_interface.h +++ b/base-linux/include/base/local_interface.h @@ -56,7 +56,7 @@ namespace Genode { static IF *deref(Capability 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 static Capability capability(IF *interface) { - return reinterpret_cap_cast(Native_capability(0, (long)interface)); + typedef Native_capability::Dst Dst; + return reinterpret_cap_cast(Native_capability(Dst(), (long)interface)); }; }; } diff --git a/base-linux/include/base/native_types.h b/base-linux/include/base/native_types.h index fdb53a8e06..d305269458 100644 --- a/base-linux/include/base/native_types.h +++ b/base-linux/include/base/native_types.h @@ -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* src); }; diff --git a/base-linux/include/base/platform_env.h b/base-linux/include/base/platform_env.h index 8daf7b64a4..1bdcb17838 100644 --- a/base-linux/include/base/platform_env.h +++ b/base-linux/include/base/platform_env.h @@ -327,7 +327,9 @@ namespace Genode { long local_name = _get_env_ulong("parent_local_name"); /* produce typed capability manually */ - return reinterpret_cap_cast(Native_capability(tid, local_name)); + typedef Native_capability::Dst Dst; + return reinterpret_cap_cast(Native_capability(Dst(tid, -1), + local_name)); } diff --git a/base-linux/src/base/ipc/ipc.cc b/base-linux/src/base/ipc/ipc.cc index 61673358b3..9abf1a6518 100644 --- a/base-linux/src/base/ipc/ipc.cc +++ b/base-linux/src/base/ipc/ipc.cc @@ -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 */ diff --git a/base-linux/src/base/process/process.cc b/base-linux/src/base/process/process.cc index a354d1b9ef..07f94ec2c6 100644 --- a/base-linux/src/base/process/process.cc +++ b/base-linux/src/base/process/process.cc @@ -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",