ObjFW  Check-in [d1d1843970]

Overview
Comment:Fix non-blocking sockets on MorphOS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d1d18439707948307dc362e344341babf75238e09da6e2fdfdf0c076ce5bf968
User & Date: js on 2019-06-26 20:38:23
Other Links: manifest | tags
Context
2019-06-27
19:24
runtime: Switch MorphOS library to SysV ABI check-in: 7138892706 user: js tags: trunk
2019-06-26
20:38
Fix non-blocking sockets on MorphOS check-in: d1d1843970 user: js tags: trunk
19:25
runtime: Fix MorphOS library check-in: 153b825cdb user: js tags: trunk
Changes

Modified src/OFStream.m from [9042aa5323] to [e28f0877ba].

1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
- (bool)isBlocking
{
	return _blocking;
}

- (void)setBlocking: (bool)enable
{
#if defined(HAVE_FCNTL)
	bool readImplemented = false, writeImplemented = false;

	@try {
		int readFlags;

		readFlags = fcntl(((id <OFReadyForReadingObserving>)self)
		    .fileDescriptorForReading, F_GETFL, 0);







|







1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
- (bool)isBlocking
{
	return _blocking;
}

- (void)setBlocking: (bool)enable
{
#if defined(HAVE_FCNTL) && !defined(OF_MORPHOS)
	bool readImplemented = false, writeImplemented = false;

	@try {
		int readFlags;

		readFlags = fcntl(((id <OFReadyForReadingObserving>)self)
		    .fileDescriptorForReading, F_GETFL, 0);

Modified src/OFStreamSocket.m from [0652ea9722] to [f3b8b9f100].

120
121
122
123
124
125
126
127
128
129

130



131
132
133
134
135
136
137
			   bytesWritten: 0
				  errNo: of_socket_errno()];
#endif

	return (size_t)bytesWritten;
}

#ifdef OF_WINDOWS
- (void)setBlocking: (bool)enable
{

	u_long v = enable;




	if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR)
		@throw [OFSetOptionFailedException
		    exceptionWithObject: self
				  errNo: of_socket_errno()];

	_blocking = enable;







|


>

>
>
>







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
			   bytesWritten: 0
				  errNo: of_socket_errno()];
#endif

	return (size_t)bytesWritten;
}

#if defined(OF_WINDOWS) || defined(OF_MORPHOS)
- (void)setBlocking: (bool)enable
{
# ifdef OF_WINDOWS
	u_long v = enable;
# else
	char v = enable;
# endif

	if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR)
		@throw [OFSetOptionFailedException
		    exceptionWithObject: self
				  errNo: of_socket_errno()];

	_blocking = enable;

Modified src/socket_helpers.h from [cefe3ad662] to [5394fb29aa].

44
45
46
47
48
49
50
51

52
53
54
55
56

57


58
59
60
61
62
63
64
# define SOMAXCONN 16
#endif

#ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 0
#endif

#if !defined(OF_WINDOWS) && !defined(OF_WII)

# define closesocket(sock) close(sock)
#endif

#ifdef OF_MORPHOS
# define hstrerror(err) "unknown (no hstrerror)"

typedef uint32_t in_addr_t;


#endif

#ifdef OF_MORPHOS_IXEMUL
typedef uint32_t in_addr_t;
#endif

#ifdef OF_WII







|
>
|
<
|
<

>

>
>







44
45
46
47
48
49
50
51
52
53

54

55
56
57
58
59
60
61
62
63
64
65
66
# define SOMAXCONN 16
#endif

#ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 0
#endif

#if defined(OF_MORPHOS)
# include <sys/filio.h>
# define closesocket(sock) CloseSocket(sock)

# define ioctlsocket(fd, req, arg) IoctlSocket(fd, req, arg)

# define hstrerror(err) "unknown (no hstrerror)"
# define SOCKET_ERROR -1
typedef uint32_t in_addr_t;
#elif !defined(OF_WINDOWS) && !defined(OF_WII)
# define closesocket(sock) close(sock)
#endif

#ifdef OF_MORPHOS_IXEMUL
typedef uint32_t in_addr_t;
#endif

#ifdef OF_WII