Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jens Gustedt
P99 - macros and functions for C99
Commits
ca8ee791
Commit
ca8ee791
authored
Jul 21, 2011
by
(no author)
Committed by
Jens Gustedt
Jul 21, 2011
Browse files
beautify the code
Signed-off-by:
Jens Gustedt
<
Jens.Gustedt@loria.fr
>
parent
457ba389
Changes
93
Hide whitespace changes
Inline
Side-by-side
include/orwl.h
View file @
ca8ee791
...
...
@@ -3,7 +3,7 @@
/* Except of parts copied from previous work and as explicitly stated below, */
/* the authors and copyright holders for this work are as follows: */
/* all rights reserved, 2011 Emmanuel Jeanvoine, INRIA, France */
/* all rights reserved, 2011 Jens Gustedt, INRIA, France
*/
/* all rights reserved,
2010-
2011 Jens Gustedt, INRIA, France */
/* */
/* This file is part of the P99 project. You received this file as as */
/* part of a confidential agreement and you may generally not */
...
...
@@ -12,8 +12,8 @@
/* even the implied warranty of merchantability or fitness for a */
/* particular purpose. */
/* */
#ifndef
ORWL_H_
# define
ORWL_H_
#ifndef
ORWL_H_
# define
ORWL_H_
#include "orwl_handle2.h"
#include "orwl_posix.h"
...
...
@@ -227,4 +227,4 @@ O_RWL_DOCUMENT_CONFIG(POSIX_TIMEOUTS)
#endif
/* configuration options */
#endif
/* !ORWL_H_ */
#endif
/* !ORWL_H_ */
include/orwl_atomic.h
View file @
ca8ee791
...
...
@@ -13,16 +13,16 @@
/* */
/*
** orwl_atomic.h
**
**
** Made by Jens Gustedt
** Login <gustedt@damogran.loria.fr>
**
**
** Started on Sun Dec 19 00:34:52 2010 Jens Gustedt
** Last update Sun Dec 19 00:34:52 2010 Jens Gustedt
*/
#ifndef
ORWL_ATOMIC_H_
# define
ORWL_ATOMIC_H_
#ifndef
ORWL_ATOMIC_H_
# define
ORWL_ATOMIC_H_
#include "orwl_int.h"
...
...
@@ -308,4 +308,4 @@ DECLARE_ATOMIC_OP(atomic_float, mult, *=);
DECLARE_ATOMIC_OP
(
atomic_float
,
div
,
/=
);
#endif
/* !ORWL_ATOMIC_H_ */
#endif
/* !ORWL_ATOMIC_H_ */
include/orwl_atomic_arm.h
View file @
ca8ee791
...
...
@@ -29,7 +29,7 @@ ATOMIC_TYPE arm_ldrex(ATOMIC_TYPE volatile*ptr) {
:
"=&r"
(
ret
)
:
"r"
(
ptr
)
:
"cc"
,
"memory"
);
);
return
ret
;
}
...
...
@@ -40,7 +40,7 @@ _Bool arm_strex(ATOMIC_TYPE volatile*ptr, ATOMIC_TYPE val) {
:
"=&r"
(
error
)
:
"r"
(
val
),
"r"
(
ptr
)
:
"cc"
,
"memory"
);
);
return
!
error
;
}
...
...
@@ -72,8 +72,7 @@ _Bool atomic_compare_exchange_weak(atomic_size_t volatile *object, size_t *expec
size_t
oldval
=
arm_ldrex
(
object
);
if
(
oldval
==
*
expected
)
{
if
(
arm_strex
(
object
,
desired
))
return
true
;
}
else
{
}
else
{
/* Cancel */
arm_strex
(
object
,
oldval
);
*
expected
=
oldval
;
...
...
include/orwl_atomic_gcc_sync.h
View file @
ca8ee791
/* This may look like nonsense, but it really is -*- mode: C -*- */
/* */
/* Except of parts copied from previous work and as explicitly stated below, */
/* the author and copyright holder for this work is */
/* all rights reserved, 2011 Jens Gustedt, INRIA, France */
/* */
/* This file is part of the P99 project. You received this file as as */
/* part of a confidential agreement and you may generally not */
/* redistribute it and/or modify it, unless under the terms as given in */
/* the file LICENSE. It is distributed without any warranty; without */
/* even the implied warranty of merchantability or fitness for a */
/* particular purpose. */
/* */
/**
** @file An implementation of the atomic generic functions on top of
** gcc's __sync builtins.
...
...
@@ -52,98 +64,98 @@
#define ORWL_SYNC_8 ORWL_SYNC_MAX
#endif
#define atomic_compare_exchange_weak(OBJECT, EXPECTED, DESIRED) \
(sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_compare_exchange_weak_, ORWL_SYNC_1)(OBJECT, EXPECTED, DESIRED)
\
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_compare_exchange_weak_, ORWL_SYNC_2)(OBJECT, EXPECTED, DESIRED)
\
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_compare_exchange_weak_, ORWL_SYNC_4)(OBJECT, EXPECTED, DESIRED)
\
#define atomic_compare_exchange_weak(OBJECT, EXPECTED, DESIRED)
\
(sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_compare_exchange_weak_, ORWL_SYNC_1)(OBJECT, EXPECTED, DESIRED) \
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_compare_exchange_weak_, ORWL_SYNC_2)(OBJECT, EXPECTED, DESIRED) \
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_compare_exchange_weak_, ORWL_SYNC_4)(OBJECT, EXPECTED, DESIRED) \
: P99_PASTE2(atomic_compare_exchange_weak_, ORWL_SYNC_8)(OBJECT, EXPECTED, DESIRED))))
#define atomic_store(OBJECT, DESIRED)
\
(sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_store_, ORWL_SYNC_1)(OBJECT, DESIRED)
\
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_store_, ORWL_SYNC_2)(OBJECT, DESIRED)
\
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_store_, ORWL_SYNC_4)(OBJECT, DESIRED)
\
#define atomic_store(OBJECT, DESIRED) \
(sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_store_, ORWL_SYNC_1)(OBJECT, DESIRED) \
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_store_, ORWL_SYNC_2)(OBJECT, DESIRED) \
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_store_, ORWL_SYNC_4)(OBJECT, DESIRED) \
: P99_PASTE2(atomic_store_, ORWL_SYNC_8)(OBJECT, DESIRED))))
#define atomic_load(OBJECT)
\
P99_SIGN_PROMOTE
\
((sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_load_, ORWL_SYNC_1)(OBJECT)
\
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_load_, ORWL_SYNC_2)(OBJECT)
\
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_load_, ORWL_SYNC_4)(OBJECT)
\
: P99_PASTE2(atomic_load_, ORWL_SYNC_8)(OBJECT)))),
\
#define atomic_load(OBJECT) \
P99_SIGN_PROMOTE \
((sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_load_, ORWL_SYNC_1)(OBJECT) \
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_load_, ORWL_SYNC_2)(OBJECT) \
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_load_, ORWL_SYNC_4)(OBJECT) \
: P99_PASTE2(atomic_load_, ORWL_SYNC_8)(OBJECT)))), \
*(OBJECT))
#define atomic_fetch_add(OBJECT, OPERAND) \
P99_SIGN_PROMOTE \
((sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_1)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_2)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_4)(OBJECT, OPERAND) \
#define atomic_fetch_add(OBJECT, OPERAND)
\
P99_SIGN_PROMOTE
\
((sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_1)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_2)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_4)(OBJECT, OPERAND)
\
: P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_8)(OBJECT, OPERAND)))), \
*(OBJECT))
#define atomic_fetch_add(OBJECT, OPERAND) \
P99_SIGN_PROMOTE \
((sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_1)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_2)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_4)(OBJECT, OPERAND) \
#define atomic_fetch_add(OBJECT, OPERAND)
\
P99_SIGN_PROMOTE
\
((sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_1)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_2)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_4)(OBJECT, OPERAND)
\
: P99_PASTE2(atomic_fetch_add_, ORWL_SYNC_8)(OBJECT, OPERAND)))), \
*(OBJECT))
#define atomic_fetch_sub(OBJECT, OPERAND) \
P99_SIGN_PROMOTE \
((sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_fetch_sub_, ORWL_SYNC_1)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_fetch_sub_, ORWL_SYNC_2)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_fetch_sub_, ORWL_SYNC_4)(OBJECT, OPERAND) \
#define atomic_fetch_sub(OBJECT, OPERAND)
\
P99_SIGN_PROMOTE
\
((sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_fetch_sub_, ORWL_SYNC_1)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_fetch_sub_, ORWL_SYNC_2)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_fetch_sub_, ORWL_SYNC_4)(OBJECT, OPERAND)
\
: P99_PASTE2(atomic_fetch_sub_, ORWL_SYNC_8)(OBJECT, OPERAND)))), \
*(OBJECT))
#define atomic_fetch_or(OBJECT, OPERAND) \
P99_SIGN_PROMOTE \
((sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_fetch_or_, ORWL_SYNC_1)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_fetch_or_, ORWL_SYNC_2)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_fetch_or_, ORWL_SYNC_4)(OBJECT, OPERAND) \
#define atomic_fetch_or(OBJECT, OPERAND)
\
P99_SIGN_PROMOTE
\
((sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_fetch_or_, ORWL_SYNC_1)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_fetch_or_, ORWL_SYNC_2)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_fetch_or_, ORWL_SYNC_4)(OBJECT, OPERAND)
\
: P99_PASTE2(atomic_fetch_or_, ORWL_SYNC_8)(OBJECT, OPERAND)))), \
*(OBJECT))
#define atomic_fetch_xor(OBJECT, OPERAND) \
P99_SIGN_PROMOTE \
((sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_fetch_xor_, ORWL_SYNC_1)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_fetch_xor_, ORWL_SYNC_2)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_fetch_xor_, ORWL_SYNC_4)(OBJECT, OPERAND) \
#define atomic_fetch_xor(OBJECT, OPERAND)
\
P99_SIGN_PROMOTE
\
((sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_fetch_xor_, ORWL_SYNC_1)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_fetch_xor_, ORWL_SYNC_2)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_fetch_xor_, ORWL_SYNC_4)(OBJECT, OPERAND)
\
: P99_PASTE2(atomic_fetch_xor_, ORWL_SYNC_8)(OBJECT, OPERAND)))), \
*(OBJECT))
#define atomic_fetch_and(OBJECT, OPERAND) \
P99_SIGN_PROMOTE \
((sizeof(*(OBJECT)) == 1 \
? P99_PASTE2(atomic_fetch_and_, ORWL_SYNC_1)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 2 \
? P99_PASTE2(atomic_fetch_and_, ORWL_SYNC_2)(OBJECT, OPERAND) \
: (sizeof(*(OBJECT)) == 4 \
? P99_PASTE2(atomic_fetch_and_, ORWL_SYNC_4)(OBJECT, OPERAND) \
#define atomic_fetch_and(OBJECT, OPERAND)
\
P99_SIGN_PROMOTE
\
((sizeof(*(OBJECT)) == 1
\
? P99_PASTE2(atomic_fetch_and_, ORWL_SYNC_1)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 2
\
? P99_PASTE2(atomic_fetch_and_, ORWL_SYNC_2)(OBJECT, OPERAND)
\
: (sizeof(*(OBJECT)) == 4
\
? P99_PASTE2(atomic_fetch_and_, ORWL_SYNC_4)(OBJECT, OPERAND)
\
: P99_PASTE2(atomic_fetch_and_, ORWL_SYNC_8)(OBJECT, OPERAND)))), \
*(OBJECT))
...
...
include/orwl_atomic_gcc_sync_inttypes.h
View file @
ca8ee791
/* This may look like nonsense, but it really is -*- mode: C -*- */
/* */
/* Except of parts copied from previous work and as explicitly stated below, */
/* the author and copyright holder for this work is */
/* all rights reserved, 2011 Jens Gustedt, INRIA, France */
/* */
/* This file is part of the P99 project. You received this file as as */
/* part of a confidential agreement and you may generally not */
/* redistribute it and/or modify it, unless under the terms as given in */
/* the file LICENSE. It is distributed without any warranty; without */
/* even the implied warranty of merchantability or fitness for a */
/* particular purpose. */
/* */
/**
** @file
** @brief Implementation of the atomic operations for the different
...
...
@@ -30,7 +42,7 @@ _Bool ORWL_MANG(atomic_compare_exchange_weak)(void volatile*object, void*restric
}
inline
void
ORWL_MANG
(
atomic_store
)(
void
volatile
*
object
,
ORWL_AT
desired
){
void
ORWL_MANG
(
atomic_store
)(
void
volatile
*
object
,
ORWL_AT
desired
)
{
for
(
ORWL_AT
expected
=
desired
;;)
{
ORWL_AT
val
=
__sync_val_compare_and_swap
((
ORWL_AT
volatile
*
)
object
,
expected
,
desired
);
if
(
val
==
expected
)
break
;
...
...
include/orwl_atomic_gcc_sync_inttypes_instantiate.h
View file @
ca8ee791
/* This may look like nonsense, but it really is -*- mode: C -*- */
/* */
/* Except of parts copied from previous work and as explicitly stated below, */
/* the author and copyright holder for this work is */
/* all rights reserved, 2011 Jens Gustedt, INRIA, France */
/* */
/* This file is part of the P99 project. You received this file as as */
/* part of a confidential agreement and you may generally not */
/* redistribute it and/or modify it, unless under the terms as given in */
/* the file LICENSE. It is distributed without any warranty; without */
/* even the implied warranty of merchantability or fitness for a */
/* particular purpose. */
/* */
/**
** @brief Instantiation of the atomic operations for the different
** integer types.
...
...
include/orwl_barrier.h
View file @
ca8ee791
...
...
@@ -13,10 +13,10 @@
/* */
/*
** orwl_barrier.h
**
**
** Made by Jens Gustedt
** Login <gustedt@damogran.loria.fr>
**
**
** Started on Wed Nov 24 23:17:01 2010 Jens Gustedt
** Last update Wed Nov 24 23:17:01 2010 Jens Gustedt
*/
...
...
@@ -26,8 +26,8 @@
** @brief Provide a fallback implementation for barriers.
**/
#ifndef
ORWL_BARRIER_H_
# define
ORWL_BARRIER_H_
#ifndef
ORWL_BARRIER_H_
# define
ORWL_BARRIER_H_
#if defined(POSIX_BARRIERS) && (POSIX_BARRIERS > 0)
...
...
@@ -86,4 +86,4 @@ int orwl_barrier_wait(orwl_barrier* barrier);
#endif
#endif
/* !ORWL_BARRIER_H_ */
#endif
/* !ORWL_BARRIER_H_ */
include/orwl_buffer.h
View file @
ca8ee791
/* This may look like nonsense, but it really is -*- mode: C -*- */
/* */
/* Except of parts copied from previous work and as explicitly stated below, */
/* the author and copyright holder for this work is */
/* all rights reserved, 2011 Jens Gustedt, INRIA, France */
/* */
/* This file is part of the P99 project. You received this file as as */
/* part of a confidential agreement and you may generally not */
/* redistribute it and/or modify it, unless under the terms as given in */
/* the file LICENSE. It is distributed without any warranty; without */
/* even the implied warranty of merchantability or fitness for a */
/* particular purpose. */
/* */
/*
** orwl_buffer.h
**
**
** Made by Jens Gustedt
** Login <gustedt@damogran.loria.fr>
**
**
** Started on Tue Jul 5 08:25:17 2011 Jens Gustedt
** Last update Tue Jul 5 08:25:17 2011 Jens Gustedt
*/
#ifndef
ORWL_BUFFER_H_
# define
ORWL_BUFFER_H_
#ifndef
ORWL_BUFFER_H_
# define
ORWL_BUFFER_H_
#include "p99.h"
...
...
@@ -45,4 +58,4 @@ void orwl_buffer_destroy(orwl_buffer *buf) {
}
#endif
/* !ORWL_BUFFER_H_ */
#endif
/* !ORWL_BUFFER_H_ */
include/orwl_count.h
View file @
ca8ee791
...
...
@@ -40,7 +40,7 @@ struct orwl_count {
atomic_size_t
large
;
int
narrow
;
}
overl
;
overl
;
#if !defined(HAVE_FUTEX) || !defined(HAVE_ATOMIC)
/** @brief A mutex that is used in the non-futex implementations */
pthread_mutex_t
mut
;
...
...
@@ -161,7 +161,7 @@ size_t orwl_count_dec(orwl_count* counter, size_t howmuch) {
size_t
val
=
atomic_fetch_sub
(
&
counter
->
overl
.
large
,
howmuch
);
if
(
P99_UNLIKELY
(
val
<=
howmuch
))
MUTUAL_EXCLUDE
(
counter
->
mut
)
pthread_cond_broadcast
(
&
counter
->
cnd
);
pthread_cond_broadcast
(
&
counter
->
cnd
);
return
val
-
howmuch
;
}
...
...
@@ -264,7 +264,7 @@ void orwl_notifier_destroy(orwl_notifier* notifier) {
}
/**
** @brief Verify if the notification flag has been set. Non blocking.
** @brief Verify if the notification flag has been set. Non blocking.
** @memberof orwl_notifier
**/
inline
...
...
@@ -273,7 +273,7 @@ bool orwl_notifier_verify(orwl_notifier* notifier) {
}
/**
** @brief Set the notifier flag and wake up all potential waiters.
** @brief Set the notifier flag and wake up all potential waiters.
** @memberof orwl_notifier
**/
inline
...
...
include/orwl_document.h
View file @
ca8ee791
...
...
@@ -11,8 +11,8 @@
/* even the implied warranty of merchantability or fitness for a */
/* particular purpose. */
/* */
#ifndef
ORWL_DOCUMENT_H_
# define
ORWL_DOCUMENT_H_
#ifndef
ORWL_DOCUMENT_H_
# define
ORWL_DOCUMENT_H_
#include "p99_defarg.h"
...
...
@@ -57,4 +57,4 @@ P99_MACRO_END(DOCUMENT_INIT);
/*! @brief Destroy a variable of type T @see T ## _delete needs this. */
\
/*! @memberof T */
#endif
/* !ORWL_DOCUMENT_H_ */
#endif
/* !ORWL_DOCUMENT_H_ */
include/orwl_endpoint.h
View file @
ca8ee791
...
...
@@ -11,8 +11,8 @@
/* even the implied warranty of merchantability or fitness for a */
/* particular purpose. */
/* */
#ifndef
ORWL_ENDPOINT_H_
# define
ORWL_ENDPOINT_H_
#ifndef
ORWL_ENDPOINT_H_
# define
ORWL_ENDPOINT_H_
#include "orwl_rand.h"
#include "orwl_buffer.h"
...
...
@@ -91,8 +91,8 @@ DOCUMENT_INIT(orwl_addr)
P99_DEFARG_DOCU
(
orwl_addr
)
inline
orwl_addr
*
orwl_addr_init
(
orwl_addr
*
A
,
/*!< the object to initialize */
in_addr_t
I0
/*!< defaults to the null address */
)
{
in_addr_t
I0
/*!< defaults to the null address */
)
{
if
(
A
)
{
*
A
=
P99_LVAL
(
orwl_addr
,
.
a
=
{
[
2
]
=
htonl
(
0x0000FFFF
),
[
3
]
=
I0
}
);
}
...
...
@@ -110,10 +110,10 @@ inline
struct
in_addr
addr2net
(
orwl_addr
const
*
A
)
{
struct
in_addr
ret
=
{
.
s_addr
=
((
!
A
->
a
[
0
]
&&
!
A
->
a
[
1
]
&&
(
ntohl
(
A
->
a
[
2
])
==
0x0000FFFF
))
?
A
->
a
[
3
]
:
P99_TMAX
(
in_addr_t
))
&&
!
A
->
a
[
1
]
&&
(
ntohl
(
A
->
a
[
2
])
==
0x0000FFFF
))
?
A
->
a
[
3
]
:
P99_TMAX
(
in_addr_t
))
};
return
ret
;
}
...
...
@@ -122,13 +122,13 @@ struct in_addr addr2net(orwl_addr const*A) {
/**
** @brief Return the IPv6 address stored in @a A.
**
** This is only present if the platform supports IPv6.
** This is only present if the platform supports IPv6.
** @memberof orwl_addr
**/
inline
struct
in6_addr
addr2net6
(
orwl_addr
const
*
A
)
{
struct
in6_addr
ret
=
{
=
{
.
s6_addr
=
P99_ADESIGNATED
(
A
->
aaaa
,
16
)
};
return
ret
;
...
...
@@ -174,8 +174,8 @@ DOCUMENT_INIT(orwl_port)
P99_DEFARG_DOCU
(
orwl_port
)
inline
orwl_port
*
orwl_port_init
(
orwl_port
*
A
,
/*!< the object to initialize */
in_port_t
P
/*!< defaults to 0 */
)
{
in_port_t
P
/*!< defaults to 0 */
)
{
if
(
A
)
{
*
A
=
net2port
(
P
);
}
...
...
@@ -234,7 +234,7 @@ orwl_endpoint* orwl_endpoint_init
in_addr_t
addr
,
/*!< defaults to the null address */
in_port_t
port
,
/*!< defaults to 0 */
uint64_t
index
/*!< defaults to 0 */
)
{
)
{
if
(
endpoint
)
{
*
endpoint
=
P99_LVAL
(
orwl_endpoint
,
.
index
=
index
);
orwl_addr_init
(
&
endpoint
->
addr
,
addr
);
...
...
@@ -255,11 +255,11 @@ DECLARE_NEW_DELETE(orwl_endpoint);
orwl_endpoint
*
orwl_endpoint_parse
(
orwl_endpoint
*
ep
,
/*!< [out] the object to initialize */
char
const
*
name
/*!< [in] the string to parse */
);
);
inline
orwl_endpoint
orwl_endpoint_get
(
char
const
*
name
/*!< [in] the string to parse */
)
{
)
{
orwl_endpoint
ret
=
P99_INIT
;
orwl_endpoint_parse
(
&
ret
,
name
);
return
ret
;
...
...
@@ -268,7 +268,7 @@ orwl_endpoint orwl_endpoint_get(char const* name /*!< [in] the string to parse
P99_DEFARG_DOCU
(
orwl_endpoint_print
)
char
const
*
orwl_endpoint_print
(
orwl_endpoint
const
*
ep
,
/*!< [in] the object to interpret */
char
name
[
static
128
]
/*!< [out] the string to initialize */
);
);
#ifndef DOXYGEN
P99_PROTOTYPE
(
char
const
*
,
orwl_endpoint_print
,
orwl_endpoint
const
*
,
char
*
);
...
...
@@ -309,7 +309,7 @@ uint64_t orwl_send(orwl_server* srv, orwl_endpoint const* there, rand48_t *seed,
** thread->main [label="pthread_exit()"];
** @endmsc
**/
#define orwl_rpc(SRV, THERE, SEED, F, ...) \
#define orwl_rpc(SRV, THERE, SEED, F, ...)
\
orwl_send(SRV, THERE, SEED, ((orwl_buffer){ P99_LENGTH_ARR_ARG(uint64_t, ORWL_OBJID(F), __VA_ARGS__) }))
#endif
/* !ORWL_ENDPOINT_H_ */
#endif
/* !ORWL_ENDPOINT_H_ */
include/orwl_futex.h
View file @
ca8ee791
...
...
@@ -50,7 +50,7 @@ int orwl_futex(int *uaddr, /*!< the base address to be used */
0. */
int
*
uaddr2
,
/*!< unused by ORWL, defaults to 0 */
int
val3
/*!< unused by ORWL, defaults to 0 */
)
{
)
{
return
syscall
(
SYS_futex
,
uaddr
,
op
,
val
,
timeout
,
uaddr2
,
val3
);
}
...
...
include/orwl_handle2.h
View file @
ca8ee791
...
...
@@ -11,8 +11,8 @@
/* even the implied warranty of merchantability or fitness for a */
/* particular purpose. */
/* */
#ifndef
ORWL_HANDLE2_H_
# define
ORWL_HANDLE2_H_
#ifndef
ORWL_HANDLE2_H_
# define
ORWL_HANDLE2_H_
#include "orwl_remote_queue.h"
#include P99_ADVANCE_ID
...
...
@@ -43,7 +43,7 @@ struct orwl_handle2 {
** since we are usually only interested by the parity. Having it on
** some bits more might come handy when debugging, though.
**/
unsigned
clock
:
(
sizeof
(
unsigned
)
*
8
-
1
);
unsigned
clock
:
(
sizeof
(
unsigned
)
*
8
-
1
);
/** the last known state of pair[i] */
orwl_state
state
[
2
];
/** the two handles that are used in alternation */
...
...
@@ -102,8 +102,8 @@ DECLARE_ORWL_TYPE_DYNAMIC(orwl_handle2);
O_RWL_DOCUMENT_SEED
P99_DEFARG_DOCU
(
orwl_write_request2
)
orwl_state
orwl_write_request2
(
orwl_mirror
*
location
,
/*!< [in,out] the location for the request */
orwl_handle2
*
rh2
,
/*!< [in,out] the handle for the request */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
orwl_handle2
*
rh2
,
/*!< [in,out] the handle for the request */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
);
/**
...
...
@@ -112,8 +112,8 @@ orwl_state orwl_write_request2(orwl_mirror* location, /*!< [in,out] the location
O_RWL_DOCUMENT_SEED
P99_DEFARG_DOCU
(
orwl_read_request2
)
orwl_state
orwl_read_request2
(
orwl_mirror
*
location
,
/*!< [in,out] the location for the request */
orwl_handle2
*
rh2
,
/*!< [in,out] the handle for the request */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
orwl_handle2
*
rh2
,
/*!< [in,out] the handle for the request */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
);
/**
...
...
@@ -122,7 +122,7 @@ orwl_state orwl_read_request2(orwl_mirror* location, /*!< [in,out] the location
O_RWL_DOCUMENT_SEED
P99_DEFARG_DOCU
(
orwl_release2
)
orwl_state
orwl_release2
(
orwl_handle2
*
rh2
,
/*!< [in,out] the handle to be released */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
);
/**
...
...
@@ -131,7 +131,7 @@ orwl_state orwl_release2(orwl_handle2* rh2, /*!< [in,out] the handle to be rel
O_RWL_DOCUMENT_SEED
P99_DEFARG_DOCU
(
orwl_cancel2
)
orwl_state
orwl_cancel2
(
orwl_handle2
*
rh2
,
/*!< [in,out] the handle to be canceled */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
);
/**
...
...
@@ -141,7 +141,7 @@ O_RWL_DOCUMENT_SEED
P99_DEFARG_DOCU
(
orwl_acquire2
)
orwl_state
orwl_acquire2
(
orwl_handle2
*
rh2
,
/*!< [in,out] the handle to be acquired */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
);
);
/**
** @memberof orwl_handle2
...
...
@@ -150,7 +150,7 @@ O_RWL_DOCUMENT_SEED
P99_DEFARG_DOCU
(
orwl_test2
)
orwl_state
orwl_test2
(
orwl_handle2
*
rh2
,
/*!< [in,out] the handle to be tested */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
);
);
/**
** @memberof orwl_handle2
...
...
@@ -158,10 +158,10 @@ orwl_state orwl_test2(orwl_handle2* rh2, /*!< [in,out] the handle to be tested
O_RWL_DOCUMENT_SEED
P99_DEFARG_DOCU
(
orwl_map2
)
uint64_t
*
orwl_map2
(
orwl_handle2
*
rh2
,
/*!< [in,out] the handle to be queried */
size_t
*
data_len
,
/*!< [out] length of @a data in
size_t
*
data_len
,
/*!< [out] length of @a data in
number of elements */
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
);
rand48_t
*
seed
/*!< [in,out] defaults to a thread local seed */
);