mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-13 20:58:20 +00:00
committed by
Christian Helmuth
parent
da5d182ad3
commit
4cdfb9bc2f
@ -19,6 +19,7 @@
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/platform_env.h>
|
||||
#include <base/internal/native_connection_state.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
/* base-internal includes */
|
||||
#include <base/internal/socket_descriptor_registry.h>
|
||||
#include <base/internal/native_thread.h>
|
||||
#include <base/internal/native_connection_state.h>
|
||||
|
||||
/* Linux includes */
|
||||
#include <linux_syscalls.h>
|
||||
@ -452,12 +453,6 @@ void Ipc_ostream::_prepare_next_send()
|
||||
}
|
||||
|
||||
|
||||
void Ipc_ostream::_send()
|
||||
{
|
||||
PRAW("unexpected call to %s (%p)", __PRETTY_FUNCTION__, this);
|
||||
}
|
||||
|
||||
|
||||
Ipc_ostream::Ipc_ostream(Native_capability dst, Msgbuf_base *snd_msg):
|
||||
Ipc_marshaller(snd_msg->buf, snd_msg->size()), _snd_msg(snd_msg), _dst(dst)
|
||||
{ }
|
||||
@ -477,12 +472,6 @@ void Ipc_istream::_prepare_next_receive()
|
||||
}
|
||||
|
||||
|
||||
void Ipc_istream::_wait()
|
||||
{
|
||||
PRAW("unexpected call to %s (%p)", __PRETTY_FUNCTION__, this);
|
||||
}
|
||||
|
||||
|
||||
Ipc_istream::Ipc_istream(Msgbuf_base *rcv_msg)
|
||||
:
|
||||
Ipc_unmarshaller(rcv_msg->buf, rcv_msg->size()),
|
||||
@ -491,32 +480,7 @@ Ipc_istream::Ipc_istream(Msgbuf_base *rcv_msg)
|
||||
{ }
|
||||
|
||||
|
||||
Ipc_istream::~Ipc_istream()
|
||||
{
|
||||
/*
|
||||
* The association of the capability (client) socket must be invalidated on
|
||||
* server destruction. We implement it here as the IPC server currently has
|
||||
* no destructor. We have the plan to remove Ipc_istream and Ipc_ostream
|
||||
* in the future and, then, move this into the server destructor.
|
||||
*
|
||||
* IPC clients have -1 as client_sd and need no disassociation.
|
||||
*/
|
||||
if (_rcv_cs.client_sd != -1) {
|
||||
Genode::ep_sd_registry()->disassociate(_rcv_cs.client_sd);
|
||||
|
||||
/*
|
||||
* Reset thread role to non-server such that we can enter 'sleep_forever'
|
||||
* without getting a warning.
|
||||
*/
|
||||
Thread_base *thread = Thread_base::myself();
|
||||
if (thread)
|
||||
thread->native_thread().is_ipc_server = false;
|
||||
}
|
||||
|
||||
destroy_server_socket_pair(_rcv_cs);
|
||||
_rcv_cs.client_sd = -1;
|
||||
_rcv_cs.server_sd = -1;
|
||||
}
|
||||
Ipc_istream::~Ipc_istream() { }
|
||||
|
||||
|
||||
/****************
|
||||
@ -629,10 +593,11 @@ void Ipc_server::_reply_wait()
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::Ipc_server(Msgbuf_base *snd_msg, Msgbuf_base *rcv_msg)
|
||||
Ipc_server::Ipc_server(Native_connection_state &cs,
|
||||
Msgbuf_base *snd_msg, Msgbuf_base *rcv_msg)
|
||||
:
|
||||
Ipc_istream(rcv_msg),
|
||||
Ipc_ostream(Native_capability(), snd_msg), _reply_needed(false)
|
||||
Ipc_ostream(Native_capability(), snd_msg), _reply_needed(false), _rcv_cs(cs)
|
||||
{
|
||||
Thread_base *thread = Thread_base::myself();
|
||||
|
||||
@ -660,3 +625,21 @@ Ipc_server::Ipc_server(Msgbuf_base *snd_msg, Msgbuf_base *rcv_msg)
|
||||
|
||||
_prepare_next_reply_wait();
|
||||
}
|
||||
|
||||
|
||||
Ipc_server::~Ipc_server()
|
||||
{
|
||||
Genode::ep_sd_registry()->disassociate(_rcv_cs.client_sd);
|
||||
|
||||
/*
|
||||
* Reset thread role to non-server such that we can enter 'sleep_forever'
|
||||
* without getting a warning.
|
||||
*/
|
||||
Thread_base *thread = Thread_base::myself();
|
||||
if (thread)
|
||||
thread->native_thread().is_ipc_server = false;
|
||||
|
||||
destroy_server_socket_pair(_rcv_cs);
|
||||
_rcv_cs.client_sd = -1;
|
||||
_rcv_cs.server_sd = -1;
|
||||
}
|
||||
|
@ -20,7 +20,10 @@
|
||||
#include <base/thread_state.h>
|
||||
#include <cpu_session/cpu_session.h>
|
||||
|
||||
/* Core includes */
|
||||
/* base-internal includes */
|
||||
#include <base/internal/native_connection_state.h>
|
||||
|
||||
/* core includes */
|
||||
#include <pager.h>
|
||||
|
||||
namespace Genode {
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* \brief Connection state of incoming RPC request
|
||||
* \author Norman Feske
|
||||
* \date 2016-03-03
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 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__INTERNAL__NATIVE_CONNECTION_STATE_H_
|
||||
#define _INCLUDE__BASE__INTERNAL__NATIVE_CONNECTION_STATE_H_
|
||||
|
||||
#include <base/stdint.h>
|
||||
|
||||
namespace Genode { struct Native_connection_state; }
|
||||
|
||||
|
||||
struct Genode::Native_connection_state
|
||||
{
|
||||
int server_sd = -1;
|
||||
int client_sd = -1;
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__BASE__INTERNAL__NATIVE_CONNECTION_STATE_H_ */
|
Reference in New Issue
Block a user