mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-15 21:58:24 +00:00
Unify 'ipc.h' and 'ipc_generic.h' across platforms
The distinction between 'ipc.h' and 'ipc_generic.h' is no more. The only use case for platform-specific extensions of the IPC support was the marshalling of capabilities. However, this case is accommodated by a function interface ('_marshal_capability', '_unmarshal_capability'). By moving the implementation of these functions from the headers into the respective ipc libraries, we can abandon the platform-specific 'ipc.h' headers.
This commit is contained in:
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* \brief Linux-specific supplements to the IPC framework
|
||||
* \author Norman Feske
|
||||
* \date 2012-07-26
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__BASE__IPC_H_
|
||||
#define _INCLUDE__BASE__IPC_H_
|
||||
|
||||
#include <base/ipc_generic.h>
|
||||
|
||||
|
||||
inline void Genode::Ipc_ostream::_marshal_capability(Genode::Native_capability const &cap)
|
||||
{
|
||||
if (cap.valid()) {
|
||||
_write_to_buf(cap.local_name());
|
||||
|
||||
_snd_msg->append_cap(cap.dst().socket);
|
||||
} else {
|
||||
_write_to_buf(-1L);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void Genode::Ipc_istream::_unmarshal_capability(Genode::Native_capability &cap)
|
||||
{
|
||||
long local_name = 0;
|
||||
_read_from_buf(local_name);
|
||||
|
||||
if (local_name == -1) {
|
||||
|
||||
/* construct invalid capability */
|
||||
cap = Genode::Native_capability();
|
||||
|
||||
} else {
|
||||
|
||||
/* construct valid capability */
|
||||
int const socket = _rcv_msg->read_cap();
|
||||
cap = Native_capability(Cap_dst_policy::Dst(socket), local_name);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__BASE__IPC_H_ */
|
Reference in New Issue
Block a user