Skip to content

Commit ed695a3

Browse files
committed
Update Solaris build.
1 parent 90bcdc0 commit ed695a3

File tree

6 files changed

+30
-37
lines changed

6 files changed

+30
-37
lines changed

amio.ambuild

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def Configure(binary):
7878
]
7979
elif builder.target_platform == 'solaris':
8080
binary.sources += [
81-
'solaris/amio-solaris.cc',
82-
'solaris/amio-solaris-devpoll.cc',
83-
'solaris/amio-solaris-port.cc',
81+
'solaris/solaris-utils.cc',
82+
'solaris/solaris-devpoll.cc',
83+
'solaris/solaris-port.cc',
8484
]
8585
return binary
8686

solaris/amio-solaris-devpoll.cc renamed to solaris/solaris-devpoll.cc

+7-10
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// The AlliedModders I/O library is licensed under the GNU General Public
88
// License, version 3 or higher. For more information, see LICENSE.txt
99
//
10-
#include "posix/amio-posix-errors.h"
11-
#include "solaris/amio-solaris-devpoll.h"
10+
#include "posix/posix-errors.h"
11+
#include "solaris/solaris-devpoll.h"
1212
#include <sys/types.h>
1313
#include <sys/stat.h>
1414
#include <fcntl.h>
@@ -58,7 +58,7 @@ DevPollImpl::Shutdown()
5858

5959
for (size_t i = 0; i < fds_.length(); i++) {
6060
if (fds_[i].transport)
61-
fds_[i].transport->detach();
61+
detach_for_shutdown_locked(fds_[i].transport);
6262
}
6363

6464
AMIO_RETRY_IF_EINTR(close(dp_));
@@ -108,7 +108,7 @@ DevPollImpl::attach_locked(PosixTransport *transport, StatusListener *listener,
108108
return nullptr;
109109
}
110110

111-
void
111+
PassRef<StatusListener>
112112
DevPollImpl::detach_locked(PosixTransport *transport)
113113
{
114114
int fd = transport->fd();
@@ -117,12 +117,9 @@ DevPollImpl::detach_locked(PosixTransport *transport)
117117

118118
WriteDevPoll(dp_, fd, kTransportNoFlags);
119119

120-
// Just for safety, we detach here in case the assignment below drops the
121-
// last ref to the transport.
122-
transport->detach();
123-
124120
fds_[fd].transport = nullptr;
125121
fds_[fd].modified = generation_;
122+
return transport->detach();
126123
}
127124

128125
PassRef<IOError>
@@ -170,9 +167,9 @@ DevPollImpl::handleEvent(int fd)
170167
AutoMaybeUnlock unlock(lock_);
171168

172169
if (inFlag == kTransportReading)
173-
listener->OnReadReady(transport);
170+
listener->OnReadReady();
174171
else if (inFlag == kTransportWriting)
175-
listener->OnWriteReady(transport);
172+
listener->OnWriteReady();
176173
}
177174

178175
PassRef<IOError>

solaris/amio-solaris-devpoll.h renamed to solaris/solaris-devpoll.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
#define _include_amio_solaris_devpoll_pump_h_
1212

1313
#include "include/amio.h"
14-
#include "include/amio-posix.h"
15-
#include "shared/amio-shared-pollbuf.h"
16-
#include "posix/amio-posix-transport.h"
17-
#include "posix/amio-posix-base-poller.h"
14+
#include "shared/shared-pollbuf.h"
15+
#include "posix/posix-transport.h"
16+
#include "posix/posix-base-poller.h"
1817
#include <sys/time.h>
1918
#include <sys/types.h>
2019
#include <poll.h>
@@ -43,7 +42,7 @@ class DevPollImpl : public PosixPoller
4342
PosixTransport *transport,
4443
StatusListener *listener,
4544
TransportFlags flags) override;
46-
void detach_locked(PosixTransport *transport) override;
45+
PassRef<StatusListener> detach_locked(PosixTransport *transport) override;
4746
PassRef<IOError> change_events_locked(PosixTransport *transport, TransportFlags flags) override;
4847

4948
private:

solaris/amio-solaris-port.cc renamed to solaris/solaris-port.cc

+8-10
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// The AlliedModders I/O library is licensed under the GNU General Public
88
// License, version 3 or higher. For more information, see LICENSE.txt
99
//
10-
#include "posix/amio-posix-errors.h"
11-
#include "solaris/amio-solaris-port.h"
10+
#include "posix/posix-errors.h"
11+
#include "solaris/solaris-port.h"
1212
#include <sys/types.h>
1313
#include <sys/stat.h>
1414
#include <fcntl.h>
@@ -50,7 +50,7 @@ PortImpl::Shutdown()
5050

5151
for (size_t i = 0; i < fds_.length(); i++) {
5252
if (fds_[i].transport)
53-
fds_[i].transport->detach();
53+
detach_for_shutdown_locked(fds_[i].transport);
5454
}
5555

5656
AMIO_RETRY_IF_EINTR(close(port_));
@@ -75,14 +75,15 @@ PortImpl::attach_locked(PosixTransport *transport, StatusListener *listener, Tra
7575
transport->setUserData(slot);
7676

7777
if (Ref<IOError> error = change_events_locked(transport, flags)) {
78+
// Note: we're not fully attached, so no need to notify any proxies.
7879
detach_locked(transport);
7980
return error;
8081
}
8182

8283
return nullptr;
8384
}
8485

85-
void
86+
PassRef<StatusListener>
8687
PortImpl::detach_locked(PosixTransport *transport)
8788
{
8889
int fd = transport->fd();
@@ -93,13 +94,10 @@ PortImpl::detach_locked(PosixTransport *transport)
9394
if (transport->flags() & kTransportArmed)
9495
port_dissociate(port_, PORT_SOURCE_FD, fd);
9596

96-
// Just for safety, we detach here in case the assignment below drops the
97-
// last ref to the transport.
98-
transport->detach();
99-
10097
fds_[slot].transport = nullptr;
10198
fds_[slot].modified = generation_;
10299
free_slots_.append(slot);
100+
return transport->detach();
103101
}
104102

105103
PassRef<IOError>
@@ -150,9 +148,9 @@ PortImpl::handleEvent(size_t slot)
150148
AutoMaybeUnlock unlock(lock_);
151149

152150
if (outFlag == kTransportReading)
153-
listener->OnReadReady(transport);
151+
listener->OnReadReady();
154152
else if (outFlag == kTransportWriting)
155-
listener->OnWriteReady(transport);
153+
listener->OnWriteReady();
156154
}
157155

158156
// Don't re-arm if the fd changed or the port is already re-armed.

solaris/amio-solaris-port.h renamed to solaris/solaris-port.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
#define _include_amio_solaris_port_pump_h_
1212

1313
#include "include/amio.h"
14-
#include "include/amio-posix.h"
15-
#include "shared/amio-shared-pollbuf.h"
16-
#include "posix/amio-posix-transport.h"
17-
#include "posix/amio-posix-base-poller.h"
14+
#include "shared/shared-pollbuf.h"
15+
#include "posix/posix-transport.h"
16+
#include "posix/posix-base-poller.h"
1817
#include <sys/time.h>
1918
#include <sys/types.h>
2019
#include <port.h>
@@ -49,7 +48,7 @@ class PortImpl : public PosixPoller
4948
PosixTransport *transport,
5049
StatusListener *listener,
5150
TransportFlags flags) override;
52-
void detach_locked(PosixTransport *transport) override;
51+
PassRef<StatusListener> detach_locked(PosixTransport *transport) override;
5352
PassRef<IOError> change_events_locked(PosixTransport *transport, TransportFlags flags) override;
5453

5554
private:

solaris/amio-solaris.cc renamed to solaris/solaris-utils.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// License, version 3 or higher. For more information, see LICENSE.txt
99
//
1010
#include "include/amio.h"
11-
#include "posix/amio-posix-transport.h"
12-
#include "posix/amio-posix-errors.h"
13-
#include "solaris/amio-solaris-devpoll.h"
14-
#include "solaris/amio-solaris-port.h"
11+
#include "posix/posix-transport.h"
12+
#include "posix/posix-errors.h"
13+
#include "solaris/solaris-devpoll.h"
14+
#include "solaris/solaris-port.h"
1515
#include <string.h>
1616
#include <stdlib.h>
1717
#include <sys/utsname.h>

0 commit comments

Comments
 (0)