ObjFW  Check-in [a2738e1a3d]

Overview
Comment:FD_SETSIZE is not (maximum FD number + 1) on Win32

Instead, FD_SETSIZE is the number of file descriptors supported by
select(), independent of the actual file descriptor number.

The default value is 64, even though it seems that Win32 supports much
more than that. Thus, this is defined to 1024 on Win32 now.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a2738e1a3df9787edeb1916a108282c29c722ebf159048341eb740e93fa488a7
User & Date: js on 2015-05-02 21:46:28
Other Links: manifest | tags
Context
2015-05-02
23:52
OF_ENSURE: Wrap in do / while (0) check-in: e1b2c4bb1e user: js tags: trunk
21:46
FD_SETSIZE is not (maximum FD number + 1) on Win32 check-in: a2738e1a3d user: js tags: trunk
16:41
utils/objfw-compile: Small improvements check-in: e8c3418693 user: js tags: trunk
Changes

Modified src/OFKernelEventObserver_select.m from [094238e437] to [6084d13774].

13
14
15
16
17
18
19





20
21
22
23
24
25
26
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#define __NO_EXT_QNX

#include "config.h"






#include <errno.h>
#include <math.h>
#include <string.h>

#include <sys/time.h>








>
>
>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#define __NO_EXT_QNX

#include "config.h"

#ifdef _WIN32
/* Win32 has a ridiculous default of 64, even though it supports much more. */
# define FD_SETSIZE 1024
#endif

#include <errno.h>
#include <math.h>
#include <string.h>

#include <sys/time.h>

45
46
47
48
49
50
51

52
53

54
55
56
57
58
59

60
61

62
63
64
65
66
67
68
	FD_SET(_cancelFD[0], &_readFDs);

	return self;
}

- (void)OF_addFileDescriptorForReading: (int)fd
{

	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException exception];


	FD_SET(fd, &_readFDs);
}

- (void)OF_addFileDescriptorForWriting: (int)fd
{

	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException exception];


	FD_SET(fd, &_writeFDs);
}

- (void)OF_removeFileDescriptorForReading: (int)fd
{
	if (fd >= FD_SETSIZE)







>


>






>


>







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
	FD_SET(_cancelFD[0], &_readFDs);

	return self;
}

- (void)OF_addFileDescriptorForReading: (int)fd
{
#ifndef _WIN32
	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException exception];
#endif

	FD_SET(fd, &_readFDs);
}

- (void)OF_addFileDescriptorForWriting: (int)fd
{
#ifndef _WIN32
	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException exception];
#endif

	FD_SET(fd, &_writeFDs);
}

- (void)OF_removeFileDescriptorForReading: (int)fd
{
	if (fd >= FD_SETSIZE)