mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-01-13 11:30:02 +00:00
build fixes for usrsctp
This commit is contained in:
parent
55284dd803
commit
09a64c8b51
@ -73,7 +73,6 @@ else:
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'Darwin':
|
||||
DEFINES['__APPLE_USE_RFC_2292'] = 1
|
||||
DEFINES['__APPLE__'] = False
|
||||
|
||||
if CONFIG['OS_TARGET'] in ('Linux', 'Android'):
|
||||
# to make sure that in6_pktinfo gets defined on all distros
|
||||
|
@ -1111,6 +1111,16 @@ sctp_get_mbuf_for_msg(unsigned int space_needed, int want_header, int how, int a
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/* TenFourFox: we need both of these macros */
|
||||
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = ((head)->tqh_first); \
|
||||
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = ((head)->lh_first); \
|
||||
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#if defined(__linux__)
|
||||
#if !defined(TAILQ_FOREACH_SAFE)
|
||||
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
||||
|
@ -84,8 +84,13 @@ void
|
||||
sctp_userspace_set_threadname(const char *name)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
#if(1)
|
||||
/* TenFourFox: no pthread_setname_np in Tiger */
|
||||
return;
|
||||
#else
|
||||
pthread_setname_np(name);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__linux__)
|
||||
prctl(PR_SET_NAME, name);
|
||||
#endif
|
||||
|
@ -54,7 +54,9 @@
|
||||
#define atomic_add_int(addr, val) OSAtomicAdd32Barrier(val, (int32_t *)addr)
|
||||
#define atomic_fetchadd_int(addr, val) OSAtomicAdd32Barrier(val, (int32_t *)addr)
|
||||
#define atomic_subtract_int(addr, val) OSAtomicAdd32Barrier(-val, (int32_t *)addr)
|
||||
#define atomic_cmpset_int(dst, exp, src) OSAtomicCompareAndSwapIntBarrier(exp, src, (int *)dst)
|
||||
/* TenFourFox */
|
||||
#define atomic_cmpset_int(dst, exp, src) OSAtomicCompareAndSwap32Barrier(exp, src, (int *)dst)
|
||||
//#define atomic_cmpset_int(dst, exp, src) OSAtomicCompareAndSwapIntBarrier(exp, src, (int *)dst)
|
||||
#define SCTP_DECREMENT_AND_CHECK_REFCOUNT(addr) (atomic_fetchadd_int(addr, -1) == 0)
|
||||
#endif
|
||||
|
||||
|
@ -132,8 +132,23 @@ init_random(void)
|
||||
void
|
||||
read_random(void *buf, size_t size)
|
||||
{
|
||||
/* TenFourFox: no arc4random_buf in Tiger.
|
||||
This isn't used much, so substitute a secure, if suboptimal, alternate. */
|
||||
#if(0)
|
||||
arc4random_buf(buf, size);
|
||||
return;
|
||||
#else
|
||||
size_t i;
|
||||
char *c = (char *)buf;
|
||||
for(i=0; i<size; i++) {
|
||||
/* arc4random returns int, not char. Ass-U-ME that entropy
|
||||
is evenly distributed throughout the return value, so just
|
||||
take the lower 8 bits in case size is not a integral number
|
||||
of ints. */
|
||||
c[i] = (arc4random() & 0xff);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user