Changeset 2
- Timestamp:
- Nov 1, 2005 4:42:51 PM (19 years ago)
- Location:
- pjproject/main
- Files:
-
- 6 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/main/Makefile
r1 r2 1 1 DIRS = pjlib pjsdp pjmedia pjsip 2 2 3 MAKE_FLAGS := TARGET=$(TARGET)4 5 3 ifdef MINSIZE 6 MAKE_FLAGS := $(MAKE_FLAGS)MINSIZE=14 MAKE_FLAGS := MINSIZE=1 7 5 endif 8 6 … … 22 20 BINS = pjsip/bin/pjsua$(EXE) 23 21 24 include pjlib/build/make-$(TARGET).inc25 26 22 size: 27 @echo 'TARGET=$(TARGET)'28 23 @echo -n 'Date: ' 29 24 @date … … 42 37 done 43 38 39 dos2unix: 40 for f in `find . | egrep '(mak|h|c|S|s|Makefile)$$'`; do \ 41 dos2unix "$$f" > dos2unix.tmp; \ 42 cp dos2unix.tmp "$$f"; \ 43 done 44 rm -f dos2unix.tmp 45 -
pjproject/main/build.mak
r1 r2 54 54 #export KERNEL_ARCH = ARCH=um 55 55 56 # 57 # SunOS, sparc, gcc 58 # 59 export MACHINE_NAME := sparc 60 export OS_NAME := sunos 61 export CC_NAME := gcc 62 export HOST_NAME := unix 63 -
pjproject/main/build/rules.mak
r1 r2 149 149 for F in $(FULL_SRCS); do \ 150 150 if test -f $$F; then \ 151 echo -n $(OBJDIR)/>> $(DEP_FILE); \151 bash -c "echo -n $(OBJDIR)/" >> $(DEP_FILE); \ 152 152 if gcc -MM $(DEPFLAGS) $$F | sed '/^#/d' >> $(DEP_FILE); then \ 153 153 true; \ 154 154 else \ 155 155 echo 'err:' >> $(DEP_FILE); \ 156 rm -f $(DEP_FILE); \ 156 157 exit 1; \ 157 158 fi; \ 158 159 fi; \ 159 done 160 done; 160 161 161 162 dep: depend -
pjproject/main/pjlib/build
-
Property
svn:ignore
set to
.pjlib*
output/*
core
-
Property
svn:ignore
set to
-
pjproject/main/pjlib/build/Makefile
r1 r2 61 61 # Gather all flags. 62 62 # 63 export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \63 export _CFLAGS := -O2 $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \ 64 64 $(CFLAGS) $(CC_INC)../include 65 65 export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \ -
pjproject/main/pjlib/build/output
-
Property
svn:ignore
set to
*
-
Property
svn:ignore
set to
-
pjproject/main/pjlib/include/pj
-
Property
svn:ignore
set to
config_site.h
-
Property
svn:ignore
set to
-
pjproject/main/pjlib/include/pj/compat/errno.h
r1 r2 10 10 11 11 #elif (defined(PJ_LINUX) && PJ_LINUX != 0) || \ 12 (defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0) 12 (defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0) || \ 13 (defined(PJ_SUNOS) && PJ_SUNOS != 0) 13 14 14 15 typedef int pj_os_err_type; -
pjproject/main/pjlib/include/pj/compat/high_precision.h
r1 r2 36 36 37 37 #else 38 # warning "High precision math is not available" 39 38 40 /* 39 41 * Last, fallback to 32-bit arithmetics. -
pjproject/main/pjlib/include/pj/config.h
r1 r2 22 22 23 23 /******************************************************************** 24 * Include target specific configuration.25 */ 26 #if defined(PJ_WIN32) 24 * Include target OS specific configuration. 25 */ 26 #if defined(PJ_WIN32) && PJ_WIN32!=0 27 27 # include <pj/compat/os_win32.h> 28 #elif defined(PJ_LINUX) 28 #elif defined(PJ_LINUX) && PJ_LINUX!=0 29 29 # include <pj/compat/os_linux.h> 30 #elif defined(PJ_LINUX_KERNEL) 30 #elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0 31 31 # include <pj/compat/os_linux_kernel.h> 32 #elif defined(PJ_PALMOS) 32 #elif defined(PJ_PALMOS) && PJ_PALMOS!=0 33 33 # include <pj/compat/os_palmos.h> 34 #elif defined(PJ_SUNOS) && PJ_SUNOS!=0 35 # include <pj/compat/os_sunos.h> 34 36 #else 35 37 # error "Please specify target os." … … 41 43 */ 42 44 #if defined (PJ_M_I386) && PJ_M_I386 != 0 43 # include <pj/compat/m_i386.h>45 # include <pj/compat/m_i386.h> 44 46 #elif defined (PJ_M_M68K) && PJ_M_M68K != 0 45 47 # include <pj/compat/m_m68k.h> 46 48 #elif defined (PJ_M_ALPHA) && PJ_M_ALPHA != 0 47 49 # include <pj/compat/m_alpha.h> 50 #elif defined (PJ_M_SPARC) && PJ_M_SPARC != 0 51 # include <pj/compat/m_sparc.h> 48 52 #else 49 53 # error "Please specify target machine." -
pjproject/main/pjlib/include/pj/os.h
r1 r2 58 58 */ 59 59 #if !defined(PJ_THREAD_DESC_SIZE) 60 # define PJ_THREAD_DESC_SIZE ( PJ_MAX_OBJ_NAME + 10*sizeof(long))60 # define PJ_THREAD_DESC_SIZE (16) 61 61 #endif 62 62 … … 65 65 * or native API. 66 66 */ 67 typedef pj_uint8_tpj_thread_desc[PJ_THREAD_DESC_SIZE];67 typedef long pj_thread_desc[PJ_THREAD_DESC_SIZE]; 68 68 69 69 /** … … 245 245 * @param value The value. 246 246 */ 247 PJ_DECL( void) pj_thread_local_set(long index, void *value);247 PJ_DECL(pj_status_t) pj_thread_local_set(long index, void *value); 248 248 249 249 /** … … 784 784 struct 785 785 { 786 #if defined(PJ_IS_LITTLE_ENDIAN) && PJ_IS_LITTLE_ENDIAN!=0 786 787 pj_uint32_t lo; /**< Low 32-bit value of the 64-bit value. */ 787 788 pj_uint32_t hi; /**< high 32-bit value of the 64-bit value. */ 789 #else 790 pj_uint32_t hi; /**< high 32-bit value of the 64-bit value. */ 791 pj_uint32_t lo; /**< Low 32-bit value of the 64-bit value. */ 792 #endif 788 793 } u32; /**< The 64-bit value as two 32-bit values. */ 789 794 -
pjproject/main/pjlib/lib
-
Property
svn:ignore
set to
*
-
Property
svn:ignore
set to
-
pjproject/main/pjlib/src/pj/ioqueue_select.c
r1 r2 499 499 # if defined(PJ_WIN32) && PJ_WIN32 != 0 500 500 rc = pj_sock_recv(h->fd, h->rd_buf, &bytes_read, 0); 501 # elif defined(PJ_LINUX) && PJ_LINUX != 0 501 # elif (defined(PJ_LINUX) && PJ_LINUX != 0) || \ 502 (defined(PJ_SUNOS) && PJ_SUNOS != 0) 502 503 bytes_read = read(h->fd, h->rd_buf, bytes_read); 503 504 rc = (bytes_read >= 0) ? PJ_SUCCESS : pj_get_os_error(); … … 506 507 rc = (bytes_read >= 0) ? PJ_SUCCESS : -bytes_read; 507 508 # else 508 # error " Check this man!"509 # error "Implement read() for this platform!" 509 510 # endif 510 511 } … … 560 561 PJ_IOQUEUE_IS_CONNECT_OP(h->op)); 561 562 562 #if PJ_HAS_TCP563 #if defined(PJ_HAS_TCP) && PJ_HAS_TCP!=0 563 564 if ((h->op & PJ_IOQUEUE_OP_CONNECT)) { 564 565 /* Completion of connect() operation */ 565 566 pj_ssize_t bytes_transfered; 566 567 567 #if defined(PJ_LINUX) || defined(PJ_LINUX_KERNEL) 568 #if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ 569 (defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0) 568 570 /* from connect(2): 569 571 * On Linux, use getsockopt to read the SO_ERROR option at … … 585 587 bytes_transfered = value; 586 588 } 587 #elif defined(PJ_WIN32) 589 #elif defined(PJ_WIN32) && PJ_WIN32!=0 588 590 bytes_transfered = 0; /* success */ 589 591 #else 590 # error "Got to check this one!" 592 /* Excellent information in D.J. Bernstein page: 593 * http://cr.yp.to/docs/connect.html 594 * 595 * Seems like the most portable way of detecting connect() 596 * failure is to call getpeername(). If socket is connected, 597 * getpeername() will return 0. If the socket is not connected, 598 * it will return ENOTCONN, and read(fd, &ch, 1) will produce 599 * the right errno through error slippage. This is a combination 600 * of suggestions from Douglas C. Schmidt and Ken Keys. 601 */ 602 int gp_rc; 603 struct sockaddr_in addr; 604 socklen_t addrlen = sizeof(addr); 605 606 gp_rc = getpeername(h->fd, (struct sockaddr*)&addr, &addrlen); 607 bytes_transfered = gp_rc; 591 608 #endif 592 609 -
pjproject/main/pjlib/src/pj/os_core_linux_kernel.c
r1 r2 253 253 254 254 /* Initialize and set the thread entry. */ 255 pj_memset(desc, 0, sizeof( pj_thread_desc));255 pj_memset(desc, 0, sizeof(struct pj_thread_t)); 256 256 257 257 if(cstr_thread_name && pj_strlen(&thread_name) < sizeof(thread->obj_name)-1) … … 288 288 return rc; 289 289 290 return pj_thread_register("pjlib-main", ( pj_uint8_t*)&main_thread, &dummy);290 return pj_thread_register("pjlib-main", (long*)&main_thread, &dummy); 291 291 } 292 292 … … 473 473 } 474 474 475 PJ_DEF( void) pj_thread_local_set(long index, void *value)475 PJ_DEF(pj_status_t) pj_thread_local_set(long index, void *value) 476 476 { 477 477 pj_assert(index >= 0 && index < MAX_TLS_ID); 478 478 tls_values[index] = value; 479 return PJ_SUCCESS; 479 480 } 480 481 -
pjproject/main/pjlib/src/pj/os_core_unix.c
r1 r2 175 175 #if PJ_HAS_THREADS 176 176 char stack_ptr; 177 pj_status_t rc; 177 178 pj_thread_t *thread = (pj_thread_t *)desc; 178 179 pj_str_t thread_name = pj_str((char*)cstr_thread_name); … … 191 192 192 193 /* Initialize and set the thread entry. */ 193 pj_memset(desc, 0, sizeof( pj_thread_desc));194 pj_memset(desc, 0, sizeof(struct pj_thread_t)); 194 195 thread->thread = pthread_self(); 195 196 … … 199 200 pj_sprintf(thread->obj_name, "thr%p", (void*)thread->thread); 200 201 201 pj_thread_local_set(thread_tls_id, thread); 202 rc = pj_thread_local_set(thread_tls_id, thread); 203 if (rc != PJ_SUCCESS) 204 return rc; 202 205 203 206 #if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0 … … 214 217 pj_thread_t *thread = (pj_thread_t*)desc; 215 218 *ptr_thread = thread; 216 return SUCCESS;219 return PJ_SUCCESS; 217 220 #endif 218 221 } … … 231 234 return rc; 232 235 } 233 return pj_thread_register("thr%p", ( pj_uint8_t*)&main_thread, &dummy);236 return pj_thread_register("thr%p", (long*)&main_thread, &dummy); 234 237 #else 235 238 PJ_LOG(2,(THIS_FILE, "Thread init error. Threading is not enabled!")); … … 248 251 pj_thread_t *rec = param; 249 252 void *result; 253 pj_status_t rc; 250 254 251 255 #if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0 … … 254 258 255 259 /* Set current thread id. */ 256 pj_thread_local_set(thread_tls_id, rec); 260 rc = pj_thread_local_set(thread_tls_id, rec); 261 if (rc != PJ_SUCCESS) { 262 pj_assert(!"Thread TLS ID is not set (pj_init() error?)"); 263 } 257 264 258 265 /* Check if suspension is required. */ … … 660 667 * pj_thread_local_set() 661 668 */ 662 PJ_DEF( void) pj_thread_local_set(long index, void *value)669 PJ_DEF(pj_status_t) pj_thread_local_set(long index, void *value) 663 670 { 664 671 //Can't check stack because this function is called in the … … 666 673 //PJ_CHECK_STACK(); 667 674 #if PJ_HAS_THREADS 668 pthread_setspecific(index, value); 675 int rc=pthread_setspecific(index, value); 676 return rc==0 ? PJ_SUCCESS : PJ_RETURN_OS_ERROR(rc); 669 677 #else 670 678 pj_assert(index >= 0 && index < MAX_THREADS); 671 679 tls[index] = value; 680 return PJ_SUCCESS; 672 681 #endif 673 682 } … … 706 715 { 707 716 #if PJ_HAS_THREADS 708 PJ_UNUSED_ARG(type); 709 710 PJ_CHECK_STACK(); 717 pthread_mutexattr_t attr; 718 int rc; 719 720 PJ_CHECK_STACK(); 721 722 pthread_mutexattr_init(&attr); 711 723 712 724 if (type == PJ_MUTEX_SIMPLE) { 713 pthread_mutex_t the_mutex = PTHREAD_MUTEX_INITIALIZER; 714 mutex->mutex = the_mutex; 725 #if defined(PJ_LINUX) && PJ_LINUX!=0 726 rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP); 727 #else 728 rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); 729 #endif 715 730 } else { 716 pthread_mutex_t the_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; 717 mutex->mutex = the_mutex; 731 #if defined(PJ_LINUX) && PJ_LINUX!=0 732 rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); 733 #else 734 rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); 735 #endif 736 } 737 738 if (rc != 0) { 739 return PJ_RETURN_OS_ERROR(rc); 740 } 741 742 rc = pthread_mutex_init(&mutex->mutex, &attr); 743 if (rc != 0) { 744 return PJ_RETURN_OS_ERROR(rc); 718 745 } 719 746 -
pjproject/main/pjlib/src/pj/os_core_win32.c
r1 r2 192 192 { 193 193 char stack_ptr; 194 pj_status_t rc; 194 195 pj_thread_t *thread = (pj_thread_t *)desc; 195 196 pj_str_t thread_name = pj_str((char*)cstr_thread_name); … … 208 209 209 210 /* Initialize and set the thread entry. */ 210 pj_memset(desc, 0, sizeof( pj_thread_desc));211 pj_memset(desc, 0, sizeof(struct pj_thread_t)); 211 212 thread->hthread = GetCurrentThread(); 212 213 thread->idthread = GetCurrentThreadId(); … … 225 226 pj_sprintf(thread->obj_name, "thr%p", (void*)thread->idthread); 226 227 227 pj_thread_local_set(thread_tls_id, thread); 228 rc = pj_thread_local_set(thread_tls_id, thread); 229 if (rc != PJ_SUCCESS) 230 return rc; 228 231 229 232 *thread_ptr = thread; … … 257 260 PJ_LOG(6,(rec->obj_name, "Thread started")); 258 261 259 pj_thread_local_set(thread_tls_id, rec); 262 if (pj_thread_local_set(thread_tls_id, rec) != PJ_SUCCESS) { 263 pj_assert(!"TLS is not set (pj_init() error?)"); 264 } 265 260 266 result = (*rec->proc)(rec->arg); 261 267 … … 586 592 * pj_thread_local_set() 587 593 */ 588 PJ_DEF(void) pj_thread_local_set(long index, void *value) 589 { 594 PJ_DEF(pj_status_t) pj_thread_local_set(long index, void *value) 595 { 596 BOOL rc; 597 590 598 //Can't check stack because this function is called in the 591 599 //beginning before main thread is initialized. 592 600 //PJ_CHECK_STACK(); 593 TlsSetValue(index, value); 601 rc = TlsSetValue(index, value); 602 return rc!=0 ? PJ_SUCCESS : PJ_RETURN_OS_ERROR(GetLastError()); 594 603 } 595 604 -
pjproject/main/pjlib/src/pj/sock_select.c
r1 r2 21 21 #include <pj/errno.h> 22 22 23 #if defined(PJ_HAS_STRING_H) && PJ_HAS_STRING_H!=0 24 # include <string.h> 25 #endif 23 26 24 27 #ifdef _MSC_VER … … 26 29 #endif 27 30 28 #define PART_FDSET(p_fdsetp) ((fd_set*)&p_fdsetp->data[1]) 29 #define PART_COUNT(p_fdsetp) (p_fdsetp->data[0]) 31 #define PART_FDSET(ps) ((fd_set*)&ps->data[1]) 32 #define PART_FDSET_OR_NULL(ps) (ps ? PART_FDSET(ps) : NULL) 33 #define PART_COUNT(ps) (ps->data[0]) 30 34 31 35 PJ_DEF(void) PJ_FD_ZERO(pj_fd_set_t *fdsetp) … … 96 100 } 97 101 98 return select(n, PART_FDSET (readfds), PART_FDSET(writefds),99 PART_FDSET (exceptfds), p_os_timeout);102 return select(n, PART_FDSET_OR_NULL(readfds), PART_FDSET_OR_NULL(writefds), 103 PART_FDSET_OR_NULL(exceptfds), p_os_timeout); 100 104 } 101 105 -
pjproject/main/pjlib/src/pjlib-test/echo_clt.c
r1 r2 47 47 PJ_FD_SET(sock, &fdset); 48 48 49 return pj_sock_select( 1, &fdset, NULL, NULL, &timeout);49 return pj_sock_select(FD_SETSIZE, &fdset, NULL, NULL, &timeout); 50 50 } 51 51 … … 83 83 return -20; 84 84 } 85 86 PJ_LOG(3,("", "...socket connected to %s:%d", 87 pj_inet_ntoa(addr.sin_addr), 88 pj_ntohs(addr.sin_port))); 85 89 86 90 pj_create_random_string(send_buf, BUF_SIZE); … … 116 120 if (rc == 0) { 117 121 PJ_LOG(3,("", "...timeout")); 122 bytes = 0; 123 } else if (rc < 0) { 124 rc = pj_get_netos_error(); 125 app_perror("...select() error", rc); 126 break; 118 127 } else { 119 128 /* Receive back the original packet. */ … … 130 139 } 131 140 bytes = 0; 141 received = 0; 132 142 break; 133 143 } 134 144 bytes += received; 135 } while (bytes != BUF_SIZE );145 } while (bytes != BUF_SIZE && bytes != 0); 136 146 } 137 147 … … 178 188 179 189 if (pj_memcmp(send_buf, recv_buf, BUF_SIZE) != 0) { 180 PJ_LOG(3,("", "...error: buffer has changed!"));190 //PJ_LOG(3,("", "...error: buffer has changed!")); 181 191 break; 182 192 } -
pjproject/main/pjlib/src/pjlib-test/main.c
r1 r2 36 36 #endif 37 37 38 #if defined(PJ_SUNOS) && PJ_SUNOS!=0 39 #include <signal.h> 40 static void init_signals() 41 { 42 struct sigaction act; 43 44 memset(&act, 0, sizeof(act)); 45 act.sa_handler = SIG_IGN; 46 47 sigaction(SIGALRM, &act, NULL); 48 } 49 50 #else 51 #define init_signals() 52 #endif 53 38 54 int main(int argc, char *argv[]) 39 55 { … … 41 57 42 58 boost(); 59 init_signals(); 43 60 44 61 while (argc > 1) { -
pjproject/main/pjlib/src/pjlib-test/test.h
r1 r2 5 5 #include <pj/types.h> 6 6 7 #define GROUP_LIBC 18 #define GROUP_OS 19 #define GROUP_DATA_STRUCTURE 110 #define GROUP_NETWORK 111 #define GROUP_EXTRA 17 #define GROUP_LIBC 0 8 #define GROUP_OS 0 9 #define GROUP_DATA_STRUCTURE 0 10 #define GROUP_NETWORK 0 11 #define GROUP_EXTRA 0 12 12 13 13 #define INCLUDE_ERRNO_TEST GROUP_LIBC … … 19 19 #define INCLUDE_POOL_PERF_TEST (PJ_HAS_MALLOC && GROUP_LIBC) 20 20 #define INCLUDE_STRING_TEST GROUP_DATA_STRUCTURE 21 #define INCLUDE_FIFOBUF_TEST GROUP_DATA_STRUCTURE21 #define INCLUDE_FIFOBUF_TEST 0 // GROUP_DATA_STRUCTURE 22 22 #define INCLUDE_RBTREE_TEST GROUP_DATA_STRUCTURE 23 23 #define INCLUDE_TIMER_TEST GROUP_DATA_STRUCTURE … … 36 36 37 37 #define INCLUDE_ECHO_SERVER 0 38 #define INCLUDE_ECHO_CLIENT 038 #define INCLUDE_ECHO_CLIENT 1 39 39 40 40 #define ECHO_SERVER_MAX_THREADS 4 … … 43 43 #define ECHO_SERVER_DURATION_MSEC (60*60*1000) 44 44 45 #define ECHO_CLIENT_MAX_THREADS 1045 #define ECHO_CLIENT_MAX_THREADS 2 46 46 47 47 PJ_BEGIN_DECL -
pjproject/main/pjlib/src/pjlib-test/timestamp.c
r1 r2 124 124 /* See if elapsed time is reasonable. */ 125 125 if (elapsed < 1 || elapsed > 100000) { 126 PJ_LOG(3,(THIS_FILE, "....error: elapsed time outside window (%u)", 127 elapsed)); 126 PJ_LOG(3,(THIS_FILE, "....error: elapsed time outside window (%u, " 127 "t1.u32.hi=%u, t1.u32.lo=%u, " 128 "t2.u32.hi=%u, t2.u32.lo=%u)", 129 elapsed, 130 t1.u32.hi, t1.u32.lo, t2.u32.hi, t2.u32.lo)); 128 131 return -1030; 129 132 } -
pjproject/main/pjmedia/src/pjmedia/portaudio/pa_front.c
r1 r2 34 34 /** @mainpage 35 35 36 PortAudio is an open-source cross-platform Clibrary for audio input36 PortAudio is an open-source cross-platform CË library for audio input 37 37 and output. It is designed to simplify the porting of audio applications 38 38 between various platforms, and also to simplify the development of audio
Note: See TracChangeset
for help on using the changeset viewer.