summaryrefslogtreecommitdiff
path: root/ace/CLASSIX/CLASSIX_OS.cpp
blob: c93b7432d771ec477725667f3e8b35a5c351d82b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//     ace
// 
// = FILENAME
//     CLASSIX_OS.cpp
//
// = AUTHOR(S)
//     Nokia Telecommunications
// 
// ============================================================================

#include "ace/CLASSIX/CLASSIX_OS.h"

#if !defined (__ACE_INLINE__)
#include "ace/CLASSIX/CLASSIX_OS.i"
#endif /* __ACE_INLINE__ */

#include "ace/CLASSIX/CLASSIX_Reactor.h"

/* ------------------------------------------------------------------------- */

ACE_ALLOC_HOOK_DEFINE(ACE_CLASSIX_OS)
ACE_ALLOC_HOOK_DEFINE(ACE_CLASSIX_Msg)

#if 0
ACE_ALLOC_HOOK_DEFINE(ACE_CLASSIX_Mgr)
ACE_CLASSIX_Mgr::ACE_CLASSIX_Mgr(void)
{
}

ACE_CLASSIX_Mgr::~ACE_CLASSIX_Mgr(void)
{
}

ACE_SYNCH_RECURSIVE_MUTEXT&
ACE_CLASSIX_Mgr::ref_lock(void) const;
{
    return port_lock_;
}
#endif
/* ------------------------------------------------------------------------- */
KnUniqueId ACE_CLASSIX_OS::null_KnUniqueId_;
ACE_Recursive_Thread_Mutex ACE_CLASSIX_OS::lock_;

ACE_CLASSIX_OS::ACE_CLASSIX_OS(void)
{
    ACE_Reactor *r = 
	ACE_Reactor::instance
	(new ACE_Reactor(new ACE_CLASSIX_Select_Reactor(), 1), 1);

    // Fills in a null KnUniqueId so that it can be referenced when required
    this->null_KnUniqueId_.uiHead = this->null_KnUniqueId_.uiTail = 0;
}

ssize_t
ACE_CLASSIX_OS::convert_io_error(ssize_t theOriginal)
{
    switch (theOriginal)
    {
    case K_EFULL:
	return ENOBUFS;

    case K_EINVAL:
	return EFTYPE;

    case K_EFAULT:
	return EFAULT;

    case K_ETOOMUCH:
	return EMSGSIZE;

    case K_EUNKNOWN:
	return EBADF;

    case K_ENOPORT:
	return EBADF;

    case K_ETIMEOUT:
	return ETIMEOUT;

    case K_EABORT:
	return EINTR;

    default:
	ACE_DEBUG((LM_DEBUG, "unknonw error: %d\n", theOriginal));
	return EFAULT;
    }
}



/* ------------------------------------------------------------------------- */

void
ACE_CLASSIX_Msg::dump(void) const
{
    ACE_DEBUG ((LM_INFO, ACE_BEGIN_DUMP, this));

    char s[100];
    ACE_OS::sprintf (s, "flag = %x\n"
		     "body size = %d\t addr = %x\n"
		     "annex addr = %x\n"
		     "seq no = %d\n",
		     this->msg_.flags,
		     this->msg_.bodySize, this->msg_.bodyAddr,
		     this->msg_.annexAddr,
		     this->msg_.seqNum);
    ACE_DEBUG ((LM_INFO, "%s", s));
    ACE_DEBUG ((LM_INFO, ACE_END_DUMP));    
}