ObjFW  Check-in [b37fdafac1]

Overview
Comment:Clean up a few file and socket related checks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b37fdafac1b78d8112455c4b98449748e0a3d7150fbf520cfd1d5256e8c2239e
User & Date: js on 2015-05-14 09:58:09
Other Links: manifest | tags
Context
2015-05-16
11:15
+[sleepForTimeInterval:]: Just return on negative check-in: 41d9be6b3b user: js tags: trunk
2015-05-14
09:58
Clean up a few file and socket related checks check-in: b37fdafac1 user: js tags: trunk
09:34
OFException.m: Fix missing includes check-in: dddeff64f8 user: js tags: trunk
Changes

Modified configure.ac from [f016f582af] to [9759d99d2a].

723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747





748
749
750
751
752
753
754
	AC_SUBST(OFHASH, "ofhash")
	AC_SUBST(OFZIP, "ofzip")

	AC_CHECK_TYPE(off64_t, [
		AC_DEFINE(OF_HAVE_OFF64_T, 1, [Whether we have off64_t])
	])

	AC_CHECK_FUNCS(readdir_r)
])

AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep lstat])

AC_CHECK_HEADERS([pwd.h grp.h])
AC_CHECK_FUNC(chmod, [
	AC_DEFINE(OF_HAVE_CHMOD, 1, [Whether we have chmod()])
])
AC_CHECK_FUNC(chown, [
	AC_DEFINE(OF_HAVE_CHOWN, 1, [Whether we have chown()])
])
AC_CHECK_FUNC(link, [
	AC_DEFINE(OF_HAVE_LINK, 1, [Whether we have link()])
])
AC_CHECK_FUNC(symlink, [
	AC_DEFINE(OF_HAVE_SYMLINK, 1, [Whether we have symlink()])
])





AC_CHECK_FUNC(pipe, [
	AC_DEFINE(OF_HAVE_PIPE, 1, [Whether we have pipe()])
])

AC_ARG_ENABLE(sockets,
	AS_HELP_STRING([--disable-sockets], [disable socket support]))
AS_IF([test x"$enable_sockets" != x"no"], [







<
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>







723
724
725
726
727
728
729





730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
	AC_SUBST(OFHASH, "ofhash")
	AC_SUBST(OFZIP, "ofzip")

	AC_CHECK_TYPE(off64_t, [
		AC_DEFINE(OF_HAVE_OFF64_T, 1, [Whether we have off64_t])
	])






	AC_CHECK_HEADERS([pwd.h grp.h])
	AC_CHECK_FUNC(chmod, [
		AC_DEFINE(OF_HAVE_CHMOD, 1, [Whether we have chmod()])
	])
	AC_CHECK_FUNC(chown, [
		AC_DEFINE(OF_HAVE_CHOWN, 1, [Whether we have chown()])
	])
	AC_CHECK_FUNC(link, [
		AC_DEFINE(OF_HAVE_LINK, 1, [Whether we have link()])
	])
	AC_CHECK_FUNC(symlink, [
		AC_DEFINE(OF_HAVE_SYMLINK, 1, [Whether we have symlink()])
	])
	AC_CHECK_FUNCS([lstat readdir_r])
])

AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep fcntl])

AC_CHECK_FUNC(pipe, [
	AC_DEFINE(OF_HAVE_PIPE, 1, [Whether we have pipe()])
])

AC_ARG_ENABLE(sockets,
	AS_HELP_STRING([--disable-sockets], [disable socket support]))
AS_IF([test x"$enable_sockets" != x"no"], [
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
	])
	AC_CHECK_HEADERS(netinet/tcp.h, [
		AC_DEFINE(OF_HAVE_NETINET_TCP_H, 1,
			[Whether we have netinet/tcp.h])
	])
	AC_CHECK_HEADERS([arpa/inet.h netdb.h])

	AC_CHECK_FUNCS([fcntl paccept accept4])

	AC_CHECK_FUNC(kqueue, [
		AC_DEFINE(HAVE_KQUEUE, 1, [Whether we have kqueue])
		AC_SUBST(OFKERNELEVENTOBSERVER_KQUEUE_M,
			"OFKernelEventObserver_kqueue.m")

		AC_CHECK_FUNCS(kqueue1)







|







773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
	])
	AC_CHECK_HEADERS(netinet/tcp.h, [
		AC_DEFINE(OF_HAVE_NETINET_TCP_H, 1,
			[Whether we have netinet/tcp.h])
	])
	AC_CHECK_HEADERS([arpa/inet.h netdb.h])

	AC_CHECK_FUNCS([paccept accept4])

	AC_CHECK_FUNC(kqueue, [
		AC_DEFINE(HAVE_KQUEUE, 1, [Whether we have kqueue])
		AC_SUBST(OFKERNELEVENTOBSERVER_KQUEUE_M,
			"OFKernelEventObserver_kqueue.m")

		AC_CHECK_FUNCS(kqueue1)

Modified src/OFFile.m from [9e0e30b9e9] to [2c4c5b7c7a].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* Work around __block being used by glibc */
#ifdef __GLIBC__
# undef __USE_XOPEN
#endif

#include <unistd.h>

#include <fcntl.h>
#include <dirent.h>

#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#ifdef HAVE_GRP_H
# include <grp.h>
#endif







|
|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* Work around __block being used by glibc */
#ifdef __GLIBC__
# undef __USE_XOPEN
#endif

#include <unistd.h>

#include <dirent.h>
#include <fcntl.h>

#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#ifdef HAVE_GRP_H
# include <grp.h>
#endif

Modified src/OFStream.m from [298e596b16] to [6ab65dacbe].

1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
- (bool)isBlocking
{
	return _blocking;
}

- (void)setBlocking: (bool)enable
{
#ifndef _WIN32
	bool readImplemented = false, writeImplemented = false;

	@try {
		int readFlags;

		readFlags = fcntl([self fileDescriptorForReading], F_GETFL);








|







1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
- (bool)isBlocking
{
	return _blocking;
}

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

	@try {
		int readFlags;

		readFlags = fcntl([self fileDescriptorForReading], F_GETFL);

Modified src/OFTCPSocket.m from [12ce6e353d] to [85280ea39a].

21
22
23
24
25
26
27


28
29
30
31
32
33
34
#include "config.h"

#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>



#import "OFTCPSocket.h"
#import "OFTCPSocket+SOCKS5.h"
#import "OFString.h"
#import "OFThread.h"
#import "OFTimer.h"
#import "OFRunLoop.h"







>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "config.h"

#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <fcntl.h>

#import "OFTCPSocket.h"
#import "OFTCPSocket+SOCKS5.h"
#import "OFString.h"
#import "OFThread.h"
#import "OFTimer.h"
#import "OFRunLoop.h"

Modified src/OFUDPSocket.m from [4e13070b06] to [1641047e8d].

15
16
17
18
19
20
21


22
23
24
25
26
27
28
 */

#include "config.h"

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



#import "OFUDPSocket.h"
#ifdef OF_HAVE_THREADS
# import "OFThread.h"
#endif
#import "OFRunLoop.h"
#import "OFRunLoop+Private.h"







>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 */

#include "config.h"

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

#include <fcntl.h>

#import "OFUDPSocket.h"
#ifdef OF_HAVE_THREADS
# import "OFThread.h"
#endif
#import "OFRunLoop.h"
#import "OFRunLoop+Private.h"

Modified src/socket.h from [f008ed8126] to [dbedacc6ee].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

#include <stdbool.h>

#include <fcntl.h>

#ifdef OF_HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef OF_HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef OF_HAVE_NETINET_TCP_H







<
<







18
19
20
21
22
23
24


25
26
27
28
29
30
31

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

#include <stdbool.h>



#ifdef OF_HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef OF_HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef OF_HAVE_NETINET_TCP_H