Changeset 5692
- Timestamp:
- Nov 13, 2017 6:06:25 AM (7 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 12 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/compat/assert.h
r3553 r5692 29 29 # include <assert.h> 30 30 31 #elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 032 # define assert(expr) do { \33 if (!(expr)) \34 printk("!!ASSERTION FAILED: [%s:%d] \"" #expr "\"\n",\35 __FILE__, __LINE__); \36 } while (0)37 38 31 #else 39 32 # warning "assert() is not implemented" -
pjproject/trunk/pjlib/include/pj/compat/high_precision.h
r3553 r5692 32 32 # define pj_highprec_mod(a,b) (a=fmod(a,b)) 33 33 34 #elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 035 36 # include <asm/div64.h>37 38 typedef pj_int64_t pj_highprec_t;39 40 # define pj_highprec_div(a1,a2) do_div(a1,a2)41 # define pj_highprec_mod(a1,a2) (a1=do_mod(a1, a2))42 43 PJ_INLINE(pj_int64_t) do_mod( pj_int64_t a1, pj_int64_t a2)44 {45 return do_div(a1,a2);46 }47 48 49 34 #elif defined(PJ_HAS_INT64) && PJ_HAS_INT64 != 0 50 35 /* -
pjproject/trunk/pjlib/include/pj/compat/rand.h
r3553 r5692 45 45 # endif 46 46 47 #elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 048 /*49 * Linux kernel mode random number generator.50 */51 # include <linux/random.h>52 # define platform_srand(seed)53 54 PJ_INLINE(int) platform_rand(void)55 {56 int value;57 get_random_bytes((void*)&value, sizeof(value));58 return value;59 }60 61 47 #else 62 48 # warning "platform_rand() is not implemented" -
pjproject/trunk/pjlib/include/pj/compat/setjmp.h
r3553 r5692 36 36 # endif 37 37 38 #elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0 && \39 defined(PJ_M_I386) && PJ_M_I386 != 040 41 /*42 * These are taken from uClibc.43 * Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>44 */45 # if defined __USE_MISC || defined _ASM46 # define JB_BX 047 # define JB_SI 148 # define JB_DI 249 # define JB_BP 350 # define JB_SP 451 # define JB_PC 552 # define JB_SIZE 2453 # endif54 55 # ifndef _ASM56 typedef int __jmp_buf[6];57 58 /* A `sigset_t' has a bit for each signal. */59 # define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))60 typedef struct __sigset_t_tag61 {62 unsigned long int __val[_SIGSET_NWORDS];63 } __sigset_t;64 65 /* Calling environment, plus possibly a saved signal mask. */66 typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */67 {68 /* NOTE: The machine-dependent definitions of `__sigsetjmp'69 assume that a `jmp_buf' begins with a `__jmp_buf' and that70 `__mask_was_saved' follows it. Do not move these members71 or add others before it. */72 __jmp_buf __jmpbuf; /* Calling environment. */73 int __mask_was_saved; /* Saved the signal mask? */74 // we never saved the mask.75 __sigset_t __saved_mask; /* Saved signal mask. */76 } jmp_buf[1];77 78 typedef jmp_buf sigjmp_buf;79 typedef jmp_buf pj_jmp_buf;80 81 PJ_DECL(int) pj_setjmp(pj_jmp_buf env);82 PJ_DECL(void) pj_longjmp(pj_jmp_buf env, int val) __attribute__((noreturn));83 84 # endif /* _ASM */85 86 38 #elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 87 39 /* Symbian framework don't use setjmp/longjmp */ -
pjproject/trunk/pjlib/include/pj/compat/socket.h
r5445 r5692 186 186 187 187 /* 188 * Linux kernel specifics189 */190 #if defined(PJ_LINUX_KERNEL)191 # include <linux/net.h>192 # include <asm/ioctls.h> /* FIONBIO */193 # include <linux/syscalls.h> /* sys_select() */194 # include <asm/uaccess.h> /* set/get_fs() */195 196 typedef int socklen_t;197 # define getsockopt sys_getsockopt198 199 /*200 * Wrapper for select() in Linux kernel.201 */202 PJ_INLINE(int) select(int n, fd_set *inp, fd_set *outp, fd_set *exp,203 struct timeval *tvp)204 {205 int count;206 mm_segment_t oldfs = get_fs();207 set_fs(KERNEL_DS);208 count = sys_select(n, inp, outp, exp, tvp);209 set_fs(oldfs);210 return count;211 }212 #endif /* PJ_LINUX_KERNEL */213 214 215 /*216 188 * This will finally be obsoleted, since it should be declared in 217 189 * os_auto.h -
pjproject/trunk/pjlib/include/pj/config.h
r5685 r5692 115 115 # define PJ_WIN32 1 116 116 # include <pj/compat/os_win32.h> 117 118 #elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0119 /*120 * Linux kernel121 */122 # include <pj/compat/os_linux_kernel.h>123 117 124 118 #elif defined(PJ_LINUX) || defined(linux) || defined(__linux) -
pjproject/trunk/pjlib/src/pj/ioqueue_common_abs.c
r5539 r5692 547 547 bytes_read = read(h->fd, read_op->buf, bytes_read); 548 548 rc = (bytes_read >= 0) ? PJ_SUCCESS : pj_get_os_error(); 549 # elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0550 bytes_read = sys_read(h->fd, read_op->buf, bytes_read);551 rc = (bytes_read >= 0) ? PJ_SUCCESS : -bytes_read;552 549 # else 553 550 # error "Implement read() for this platform!" -
pjproject/trunk/pjlib/src/pj/ioqueue_epoll.c
r5680 r5692 38 38 #include <pj/rand.h> 39 39 40 #if !defined(PJ_LINUX_KERNEL) || PJ_LINUX_KERNEL==0 41 /* 42 * Linux user mode 43 */ 44 # include <sys/epoll.h> 45 # include <errno.h> 46 # include <unistd.h> 47 48 # define epoll_data data.ptr 49 # define epoll_data_type void* 50 # define ioctl_val_type unsigned long 51 # define getsockopt_val_ptr int* 52 # define os_getsockopt getsockopt 53 # define os_ioctl ioctl 54 # define os_read read 55 # define os_close close 56 # define os_epoll_create epoll_create 57 # define os_epoll_ctl epoll_ctl 58 # define os_epoll_wait epoll_wait 59 #else 60 /* 61 * Linux kernel mode. 62 */ 63 # include <linux/config.h> 64 # include <linux/version.h> 65 # if defined(MODVERSIONS) 66 # include <linux/modversions.h> 67 # endif 68 # include <linux/kernel.h> 69 # include <linux/poll.h> 70 # include <linux/eventpoll.h> 71 # include <linux/syscalls.h> 72 # include <linux/errno.h> 73 # include <linux/unistd.h> 74 # include <asm/ioctls.h> 75 enum EPOLL_EVENTS 76 { 77 EPOLLIN = 0x001, 78 EPOLLOUT = 0x004, 79 EPOLLERR = 0x008, 80 }; 81 # define os_epoll_create sys_epoll_create 82 static int os_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) 83 { 84 long rc; 85 mm_segment_t oldfs = get_fs(); 86 set_fs(KERNEL_DS); 87 rc = sys_epoll_ctl(epfd, op, fd, event); 88 set_fs(oldfs); 89 if (rc) { 90 errno = -rc; 91 return -1; 92 } else { 93 return 0; 94 } 95 } 96 static int os_epoll_wait(int epfd, struct epoll_event *events, 97 int maxevents, int timeout) 98 { 99 int count; 100 mm_segment_t oldfs = get_fs(); 101 set_fs(KERNEL_DS); 102 count = sys_epoll_wait(epfd, events, maxevents, timeout); 103 set_fs(oldfs); 104 return count; 105 } 106 # define os_close sys_close 107 # define os_getsockopt pj_sock_getsockopt 108 static int os_read(int fd, void *buf, size_t len) 109 { 110 long rc; 111 mm_segment_t oldfs = get_fs(); 112 set_fs(KERNEL_DS); 113 rc = sys_read(fd, buf, len); 114 set_fs(oldfs); 115 if (rc) { 116 errno = -rc; 117 return -1; 118 } else { 119 return 0; 120 } 121 } 122 # define socklen_t unsigned 123 # define ioctl_val_type unsigned long 124 int ioctl(int fd, int opt, ioctl_val_type value); 125 static int os_ioctl(int fd, int opt, ioctl_val_type value) 126 { 127 int rc; 128 mm_segment_t oldfs = get_fs(); 129 set_fs(KERNEL_DS); 130 rc = ioctl(fd, opt, value); 131 set_fs(oldfs); 132 if (rc < 0) { 133 errno = -rc; 134 return rc; 135 } else 136 return rc; 137 } 138 # define getsockopt_val_ptr char* 139 140 # define epoll_data data 141 # define epoll_data_type __u32 142 #endif 40 #include <sys/epoll.h> 41 #include <errno.h> 42 #include <unistd.h> 43 44 #define epoll_data data.ptr 45 #define epoll_data_type void* 46 #define ioctl_val_type unsigned long 47 #define getsockopt_val_ptr int* 48 #define os_getsockopt getsockopt 49 #define os_ioctl ioctl 50 #define os_read read 51 #define os_close close 52 #define os_epoll_create epoll_create 53 #define os_epoll_ctl epoll_ctl 54 #define os_epoll_wait epoll_wait 143 55 144 56 #define THIS_FILE "ioq_epoll" … … 202 114 PJ_DEF(const char*) pj_ioqueue_name(void) 203 115 { 204 #if defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0 205 return "epoll-kernel"; 206 #else 207 return "epoll"; 208 #endif 116 return "epoll"; 209 117 } 210 118 -
pjproject/trunk/pjlib/src/pj/sock_bsd.c
r5590 r5692 230 230 PJ_DEF(char*) pj_inet_ntoa(pj_in_addr inaddr) 231 231 { 232 #if 0 //!defined(PJ_LINUX) && !defined(PJ_LINUX_KERNEL)232 #if 0 233 233 return inet_ntoa(*(struct in_addr*)&inaddr); 234 234 #else
Note: See TracChangeset
for help on using the changeset viewer.