diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-02-08 11:14:03 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-02-08 11:14:03 +0000 |
commit | ba1878c8122da61f2bda2a4cc0dc9ca7c88556f3 (patch) | |
tree | 6822476b021e6a2fd98dede4c51b01100404d133 /pjlib | |
parent | c00a805879c4ec9724bc798caf8b402e397b13c4 (diff) |
Fixed build errors when PJ_OS_HAS_CHECK_STACK or PJ_HAS_TCP is disabled
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@153 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r-- | pjlib/build/Makefile | 2 | ||||
-rw-r--r-- | pjlib/include/pj/compat/os_linux.h | 4 | ||||
-rw-r--r-- | pjlib/include/pj/compat/os_linux_kernel.h | 3 | ||||
-rw-r--r-- | pjlib/include/pj/compat/os_palmos.h | 9 | ||||
-rw-r--r-- | pjlib/include/pj/compat/os_sunos.h | 14 | ||||
-rw-r--r-- | pjlib/include/pj/compat/os_win32.h | 14 | ||||
-rw-r--r-- | pjlib/src/pj/sock_bsd.c | 29 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/util.c | 6 |
8 files changed, 48 insertions, 33 deletions
diff --git a/pjlib/build/Makefile b/pjlib/build/Makefile index c278f752..54f71bca 100644 --- a/pjlib/build/Makefile +++ b/pjlib/build/Makefile @@ -8,7 +8,7 @@ export PJLIB_LIB := ../lib/libpj-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(LIBEXT) ############################################################################### # Gather all flags. # -export _CFLAGS := -O2 -g $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \ +export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \ $(CFLAGS) $(CC_INC)../include export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \ $(HOST_CXXFLAGS) $(CXXFLAGS) diff --git a/pjlib/include/pj/compat/os_linux.h b/pjlib/include/pj/compat/os_linux.h index ab26852f..24faa228 100644 --- a/pjlib/include/pj/compat/os_linux.h +++ b/pjlib/include/pj/compat/os_linux.h @@ -76,7 +76,9 @@ #define PJ_HAS_HIGH_RES_TIMER 1 #define PJ_HAS_MALLOC 1 -#define PJ_OS_HAS_CHECK_STACK 0 +#ifndef PJ_OS_HAS_CHECK_STACK +# define PJ_OS_HAS_CHECK_STACK 0 +#endif #define PJ_NATIVE_STRING_IS_UNICODE 0 #define PJ_ATOMIC_VALUE_TYPE long diff --git a/pjlib/include/pj/compat/os_linux_kernel.h b/pjlib/include/pj/compat/os_linux_kernel.h index 11e22da0..502d5aa8 100644 --- a/pjlib/include/pj/compat/os_linux_kernel.h +++ b/pjlib/include/pj/compat/os_linux_kernel.h @@ -94,7 +94,8 @@ #define PJ_HAS_SEMAPHORE 0 #define PJ_HAS_EVENT_OBJ 0 #define PJ_HAS_HIGH_RES_TIMER 1 -#define PJ_OS_HAS_CHECK_STACK 0 +#ifndef PJ_OS_HAS_CHECK_STACK +# define PJ_OS_HAS_CHECK_STACK 0 #define PJ_TERM_HAS_COLOR 0 #define PJ_NATIVE_STRING_IS_UNICODE 0 diff --git a/pjlib/include/pj/compat/os_palmos.h b/pjlib/include/pj/compat/os_palmos.h index 3d540a3b..e97cd66a 100644 --- a/pjlib/include/pj/compat/os_palmos.h +++ b/pjlib/include/pj/compat/os_palmos.h @@ -70,11 +70,12 @@ /* Default threading is enabled, unless it's overridden. */ #ifndef PJ_HAS_THREADS -# define PJ_HAS_THREADS (1) +# define PJ_HAS_THREADS (1) #endif -#define PJ_HAS_HIGH_RES_TIMER 1 -#define PJ_OS_HAS_CHECK_STACK 0 -#define PJ_NATIVE_STRING_IS_UNICODE 0 +#define PJ_HAS_HIGH_RES_TIMER 1 +#ifndef PJ_OS_HAS_CHECK_STACK +# define PJ_OS_HAS_CHECK_STACK 0 +#define PJ_NATIVE_STRING_IS_UNICODE 0 #endif /* __PJ_COMPAT_OS_PALMOS_H__ */ diff --git a/pjlib/include/pj/compat/os_sunos.h b/pjlib/include/pj/compat/os_sunos.h index 269631ff..bbe7a759 100644 --- a/pjlib/include/pj/compat/os_sunos.h +++ b/pjlib/include/pj/compat/os_sunos.h @@ -71,15 +71,17 @@ /* Default threading is enabled, unless it's overridden. */ #ifndef PJ_HAS_THREADS -# define PJ_HAS_THREADS (1) +# define PJ_HAS_THREADS (1) #endif -#define PJ_HAS_HIGH_RES_TIMER 1 -#define PJ_HAS_MALLOC 1 -#define PJ_OS_HAS_CHECK_STACK 0 -#define PJ_NATIVE_STRING_IS_UNICODE 0 +#define PJ_HAS_HIGH_RES_TIMER 1 +#define PJ_HAS_MALLOC 1 +#ifndef PJ_OS_HAS_CHECK_STACK +# define PJ_OS_HAS_CHECK_STACK 0 +#endif +#define PJ_NATIVE_STRING_IS_UNICODE 0 -#define PJ_ATOMIC_VALUE_TYPE long +#define PJ_ATOMIC_VALUE_TYPE long /* Get BSD related identifers in Sun's include files */ #define BSD_COMP diff --git a/pjlib/include/pj/compat/os_win32.h b/pjlib/include/pj/compat/os_win32.h index a078a7e7..8e4c7ab9 100644 --- a/pjlib/include/pj/compat/os_win32.h +++ b/pjlib/include/pj/compat/os_win32.h @@ -75,14 +75,16 @@ /* Default threading is enabled, unless it's overridden. */ #ifndef PJ_HAS_THREADS -# define PJ_HAS_THREADS (1) +# define PJ_HAS_THREADS (1) #endif -#define PJ_HAS_HIGH_RES_TIMER 1 -#define PJ_HAS_MALLOC 1 -#define PJ_OS_HAS_CHECK_STACK 1 -#define PJ_NATIVE_STRING_IS_UNICODE 0 +#define PJ_HAS_HIGH_RES_TIMER 1 +#define PJ_HAS_MALLOC 1 +#ifndef PJ_OS_HAS_CHECK_STACK +# define PJ_OS_HAS_CHECK_STACK 1 +#endif +#define PJ_NATIVE_STRING_IS_UNICODE 0 -#define PJ_ATOMIC_VALUE_TYPE long +#define PJ_ATOMIC_VALUE_TYPE long #endif /* __PJ_COMPAT_OS_WIN32_H__ */ diff --git a/pjlib/src/pj/sock_bsd.c b/pjlib/src/pj/sock_bsd.c index cdb8ca8d..df59a742 100644 --- a/pjlib/src/pj/sock_bsd.c +++ b/pjlib/src/pj/sock_bsd.c @@ -522,41 +522,42 @@ PJ_DEF(pj_status_t) pj_sock_setsockopt( pj_sock_t sock, } /* - * Shutdown socket. + * Connect socket. */ -#if PJ_HAS_TCP -PJ_DEF(pj_status_t) pj_sock_shutdown( pj_sock_t sock, - int how) +PJ_DEF(pj_status_t) pj_sock_connect( pj_sock_t sock, + const pj_sockaddr_t *addr, + int namelen) { PJ_CHECK_STACK(); - if (shutdown(sock, how) != 0) + if (connect(sock, (struct sockaddr*)addr, namelen) != 0) return PJ_RETURN_OS_ERROR(pj_get_native_netos_error()); else return PJ_SUCCESS; } + /* - * Start listening to incoming connections. + * Shutdown socket. */ -PJ_DEF(pj_status_t) pj_sock_listen( pj_sock_t sock, - int backlog) +#if PJ_HAS_TCP +PJ_DEF(pj_status_t) pj_sock_shutdown( pj_sock_t sock, + int how) { PJ_CHECK_STACK(); - if (listen(sock, backlog) != 0) + if (shutdown(sock, how) != 0) return PJ_RETURN_OS_ERROR(pj_get_native_netos_error()); else return PJ_SUCCESS; } /* - * Connect socket. + * Start listening to incoming connections. */ -PJ_DEF(pj_status_t) pj_sock_connect( pj_sock_t sock, - const pj_sockaddr_t *addr, - int namelen) +PJ_DEF(pj_status_t) pj_sock_listen( pj_sock_t sock, + int backlog) { PJ_CHECK_STACK(); - if (connect(sock, (struct sockaddr*)addr, namelen) != 0) + if (listen(sock, backlog) != 0) return PJ_RETURN_OS_ERROR(pj_get_native_netos_error()); else return PJ_SUCCESS; diff --git a/pjlib/src/pjlib-test/util.c b/pjlib/src/pjlib-test/util.c index d5cded20..19b769cb 100644 --- a/pjlib/src/pjlib-test/util.c +++ b/pjlib/src/pjlib-test/util.c @@ -50,11 +50,13 @@ pj_status_t app_socket(int family, int type, int proto, int port, if (rc != PJ_SUCCESS) return rc; +#if PJ_HAS_TCP if (type == PJ_SOCK_STREAM) { rc = pj_sock_listen(sock, 5); if (rc != PJ_SUCCESS) return rc; } +#endif *ptr_sock = sock; return PJ_SUCCESS; @@ -94,11 +96,13 @@ pj_status_t app_socketpair(int family, int type, int protocol, goto on_error; /* For TCP, listen the socket. */ +#if PJ_HAS_TCP if (type == PJ_SOCK_STREAM) { rc = pj_sock_listen(sock[SERVER], PJ_SOMAXCONN); if (rc != PJ_SUCCESS) goto on_error; } +#endif /* Connect client socket. */ addr.sin_addr = pj_inet_addr(pj_cstr(&s, "127.0.0.1")); @@ -107,6 +111,7 @@ pj_status_t app_socketpair(int family, int type, int protocol, goto on_error; /* For TCP, must accept(), and get the new socket. */ +#if PJ_HAS_TCP if (type == PJ_SOCK_STREAM) { pj_sock_t newserver; @@ -118,6 +123,7 @@ pj_status_t app_socketpair(int family, int type, int protocol, pj_sock_close(sock[SERVER]); sock[SERVER] = newserver; } +#endif *serverfd = sock[SERVER]; *clientfd = sock[CLIENT]; |