Sync in the latest CloudABI system call definitions.
Some time ago I made a change to merge together the memory scope definitions used by mmap (MAP_{PRIVATE,SHARED}) and lock objects (PTHREAD_PROCESS_{PRIVATE,SHARED}). Though that sounded pretty smart back then, it's backfiring. In the case of mmap it's used with other flags in a bitmask, but for locking it's an enumeration. As our plan is to automatically generate bindings for other languages, that looks a bit sloppy. Change all of the locking functions to use separate flags instead. Obtained from: https://github.com/NuxiNL/cloudabi
This commit is contained in:
parent
20ec114656
commit
34d932442d
@ -212,16 +212,16 @@ static int futex_user_cmpxchg(uint32_t *, uint32_t, uint32_t *, uint32_t);
|
||||
|
||||
static int
|
||||
futex_address_create(struct futex_address *fa, struct thread *td,
|
||||
const void *object, cloudabi_mflags_t scope)
|
||||
const void *object, cloudabi_scope_t scope)
|
||||
{
|
||||
|
||||
KASSERT(td == curthread,
|
||||
("Can only create umtx keys for the current thread"));
|
||||
switch (scope) {
|
||||
case CLOUDABI_MAP_PRIVATE:
|
||||
case CLOUDABI_SCOPE_PRIVATE:
|
||||
return (umtx_key_get(object, TYPE_FUTEX, THREAD_SHARE,
|
||||
&fa->fa_key));
|
||||
case CLOUDABI_MAP_SHARED:
|
||||
case CLOUDABI_SCOPE_SHARED:
|
||||
return (umtx_key_get(object, TYPE_FUTEX, AUTO_SHARE,
|
||||
&fa->fa_key));
|
||||
default:
|
||||
@ -259,7 +259,7 @@ futex_condvar_assert(const struct futex_condvar *fc)
|
||||
|
||||
static int
|
||||
futex_condvar_lookup(struct thread *td, const cloudabi_condvar_t *address,
|
||||
cloudabi_mflags_t scope, struct futex_condvar **fcret)
|
||||
cloudabi_scope_t scope, struct futex_condvar **fcret)
|
||||
{
|
||||
struct futex_address fa_condvar;
|
||||
struct futex_condvar *fc;
|
||||
@ -286,8 +286,8 @@ futex_condvar_lookup(struct thread *td, const cloudabi_condvar_t *address,
|
||||
|
||||
static int
|
||||
futex_condvar_lookup_or_create(struct thread *td,
|
||||
const cloudabi_condvar_t *condvar, cloudabi_mflags_t condvar_scope,
|
||||
const cloudabi_lock_t *lock, cloudabi_mflags_t lock_scope,
|
||||
const cloudabi_condvar_t *condvar, cloudabi_scope_t condvar_scope,
|
||||
const cloudabi_lock_t *lock, cloudabi_scope_t lock_scope,
|
||||
struct futex_condvar **fcret)
|
||||
{
|
||||
struct futex_address fa_condvar, fa_lock;
|
||||
@ -385,7 +385,7 @@ futex_lock_assert(const struct futex_lock *fl)
|
||||
|
||||
static int
|
||||
futex_lock_lookup(struct thread *td, const cloudabi_lock_t *address,
|
||||
cloudabi_mflags_t scope, struct futex_lock **flret)
|
||||
cloudabi_scope_t scope, struct futex_lock **flret)
|
||||
{
|
||||
struct futex_address fa;
|
||||
int error;
|
||||
@ -974,8 +974,8 @@ futex_user_cmpxchg(uint32_t *obj, uint32_t cmp, uint32_t *old, uint32_t new)
|
||||
|
||||
int
|
||||
cloudabi_futex_condvar_wait(struct thread *td, cloudabi_condvar_t *condvar,
|
||||
cloudabi_mflags_t condvar_scope, cloudabi_lock_t *lock,
|
||||
cloudabi_mflags_t lock_scope, cloudabi_clockid_t clock_id,
|
||||
cloudabi_scope_t condvar_scope, cloudabi_lock_t *lock,
|
||||
cloudabi_scope_t lock_scope, cloudabi_clockid_t clock_id,
|
||||
cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision)
|
||||
{
|
||||
struct futex_condvar *fc;
|
||||
@ -1047,7 +1047,7 @@ cloudabi_futex_condvar_wait(struct thread *td, cloudabi_condvar_t *condvar,
|
||||
|
||||
int
|
||||
cloudabi_futex_lock_rdlock(struct thread *td, cloudabi_lock_t *lock,
|
||||
cloudabi_mflags_t scope, cloudabi_clockid_t clock_id,
|
||||
cloudabi_scope_t scope, cloudabi_clockid_t clock_id,
|
||||
cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision)
|
||||
{
|
||||
struct futex_lock *fl;
|
||||
@ -1066,7 +1066,7 @@ cloudabi_futex_lock_rdlock(struct thread *td, cloudabi_lock_t *lock,
|
||||
|
||||
int
|
||||
cloudabi_futex_lock_wrlock(struct thread *td, cloudabi_lock_t *lock,
|
||||
cloudabi_mflags_t scope, cloudabi_clockid_t clock_id,
|
||||
cloudabi_scope_t scope, cloudabi_clockid_t clock_id,
|
||||
cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision)
|
||||
{
|
||||
struct futex_lock *fl;
|
||||
|
@ -67,13 +67,13 @@ int cloudabi_convert_timespec(const struct timespec *, cloudabi_timestamp_t *);
|
||||
* sleep on a lock or condition variable.
|
||||
*/
|
||||
int cloudabi_futex_condvar_wait(struct thread *, cloudabi_condvar_t *,
|
||||
cloudabi_mflags_t, cloudabi_lock_t *, cloudabi_mflags_t, cloudabi_clockid_t,
|
||||
cloudabi_scope_t, cloudabi_lock_t *, cloudabi_scope_t, cloudabi_clockid_t,
|
||||
cloudabi_timestamp_t, cloudabi_timestamp_t);
|
||||
int cloudabi_futex_lock_rdlock(struct thread *, cloudabi_lock_t *,
|
||||
cloudabi_mflags_t, cloudabi_clockid_t, cloudabi_timestamp_t,
|
||||
cloudabi_scope_t, cloudabi_clockid_t, cloudabi_timestamp_t,
|
||||
cloudabi_timestamp_t);
|
||||
int cloudabi_futex_lock_wrlock(struct thread *, cloudabi_lock_t *,
|
||||
cloudabi_mflags_t, cloudabi_clockid_t, cloudabi_timestamp_t,
|
||||
cloudabi_scope_t, cloudabi_clockid_t, cloudabi_timestamp_t,
|
||||
cloudabi_timestamp_t);
|
||||
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
|
||||
case 2: {
|
||||
struct cloudabi_sys_condvar_signal_args *p = params;
|
||||
uarg[0] = (intptr_t) p->condvar; /* cloudabi_condvar_t * */
|
||||
iarg[1] = p->scope; /* cloudabi_mflags_t */
|
||||
iarg[1] = p->scope; /* cloudabi_scope_t */
|
||||
iarg[2] = p->nwaiters; /* cloudabi_nthreads_t */
|
||||
*n_args = 3;
|
||||
break;
|
||||
@ -297,7 +297,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
|
||||
case 31: {
|
||||
struct cloudabi_sys_lock_unlock_args *p = params;
|
||||
uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */
|
||||
iarg[1] = p->scope; /* cloudabi_mflags_t */
|
||||
iarg[1] = p->scope; /* cloudabi_scope_t */
|
||||
*n_args = 2;
|
||||
break;
|
||||
}
|
||||
@ -493,7 +493,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
|
||||
case 54: {
|
||||
struct cloudabi_sys_thread_exit_args *p = params;
|
||||
uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */
|
||||
iarg[1] = p->scope; /* cloudabi_mflags_t */
|
||||
iarg[1] = p->scope; /* cloudabi_scope_t */
|
||||
*n_args = 2;
|
||||
break;
|
||||
}
|
||||
@ -561,7 +561,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
|
||||
p = "cloudabi_condvar_t *";
|
||||
break;
|
||||
case 1:
|
||||
p = "cloudabi_mflags_t";
|
||||
p = "cloudabi_scope_t";
|
||||
break;
|
||||
case 2:
|
||||
p = "cloudabi_nthreads_t";
|
||||
@ -1043,7 +1043,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
|
||||
p = "cloudabi_lock_t *";
|
||||
break;
|
||||
case 1:
|
||||
p = "cloudabi_mflags_t";
|
||||
p = "cloudabi_scope_t";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1377,7 +1377,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
|
||||
p = "cloudabi_lock_t *";
|
||||
break;
|
||||
case 1:
|
||||
p = "cloudabi_mflags_t";
|
||||
p = "cloudabi_scope_t";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016 Nuxi, https://nuxi.nl/
|
||||
// Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
@ -20,8 +20,9 @@
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
// SUCH DAMAGE.
|
||||
|
||||
//
|
||||
// This file is automatically generated. Do not edit.
|
||||
//
|
||||
// Source: https://github.com/NuxiNL/cloudabi
|
||||
|
||||
#ifndef CLOUDABI64_TYPES_H
|
||||
@ -101,6 +102,8 @@ _Static_assert(offsetof(cloudabi64_iovec_t, iov_len) == 8, "Incorrect layout");
|
||||
_Static_assert(sizeof(cloudabi64_iovec_t) == 16, "Incorrect layout");
|
||||
_Static_assert(_Alignof(cloudabi64_iovec_t) == 8, "Incorrect layout");
|
||||
|
||||
typedef void cloudabi64_processentry_t(uint64_t auxv);
|
||||
|
||||
typedef struct {
|
||||
_Alignas(8) uint64_t ri_data;
|
||||
_Alignas(8) uint64_t ri_datalen;
|
||||
@ -153,8 +156,8 @@ typedef struct {
|
||||
struct {
|
||||
_Alignas(8) uint64_t condvar;
|
||||
_Alignas(8) uint64_t lock;
|
||||
_Alignas(1) cloudabi_mflags_t condvar_scope;
|
||||
_Alignas(1) cloudabi_mflags_t lock_scope;
|
||||
_Alignas(1) cloudabi_scope_t condvar_scope;
|
||||
_Alignas(1) cloudabi_scope_t lock_scope;
|
||||
} condvar;
|
||||
struct {
|
||||
_Alignas(4) cloudabi_fd_t fd;
|
||||
@ -162,7 +165,7 @@ typedef struct {
|
||||
} fd_readwrite;
|
||||
struct {
|
||||
_Alignas(8) uint64_t lock;
|
||||
_Alignas(1) cloudabi_mflags_t lock_scope;
|
||||
_Alignas(1) cloudabi_scope_t lock_scope;
|
||||
} lock;
|
||||
struct {
|
||||
_Alignas(4) cloudabi_fd_t fd;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016 Nuxi, https://nuxi.nl/
|
||||
// Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
@ -20,8 +20,9 @@
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
// SUCH DAMAGE.
|
||||
|
||||
//
|
||||
// This file is automatically generated. Do not edit.
|
||||
//
|
||||
// Source: https://github.com/NuxiNL/cloudabi
|
||||
|
||||
#ifndef CLOUDABI_TYPES_COMMON_H
|
||||
@ -47,6 +48,7 @@ typedef uint8_t cloudabi_advice_t;
|
||||
typedef uint32_t cloudabi_auxtype_t;
|
||||
#define CLOUDABI_AT_ARGDATA 256
|
||||
#define CLOUDABI_AT_ARGDATALEN 257
|
||||
#define CLOUDABI_AT_BASE 7
|
||||
#define CLOUDABI_AT_CANARY 258
|
||||
#define CLOUDABI_AT_CANARYLEN 259
|
||||
#define CLOUDABI_AT_NCPUS 260
|
||||
@ -298,6 +300,10 @@ typedef uint8_t cloudabi_sa_family_t;
|
||||
#define CLOUDABI_AF_INET6 2
|
||||
#define CLOUDABI_AF_UNIX 3
|
||||
|
||||
typedef uint8_t cloudabi_scope_t;
|
||||
#define CLOUDABI_SCOPE_PRIVATE 4
|
||||
#define CLOUDABI_SCOPE_SHARED 8
|
||||
|
||||
typedef uint8_t cloudabi_sdflags_t;
|
||||
#define CLOUDABI_SHUT_RD 0x01
|
||||
#define CLOUDABI_SHUT_WR 0x02
|
||||
|
@ -1,6 +1,6 @@
|
||||
$FreeBSD$
|
||||
|
||||
; Copyright (c) 2016 Nuxi, https://nuxi.nl/
|
||||
; Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
@ -22,8 +22,9 @@
|
||||
; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
; SUCH DAMAGE.
|
||||
|
||||
;
|
||||
; This file is automatically generated. Do not edit.
|
||||
;
|
||||
; Source: https://github.com/NuxiNL/cloudabi
|
||||
|
||||
#include <sys/sysent.h>
|
||||
@ -44,7 +45,7 @@
|
||||
|
||||
2 AUE_NULL STD { void cloudabi_sys_condvar_signal( \
|
||||
cloudabi_condvar_t *condvar, \
|
||||
cloudabi_mflags_t scope, \
|
||||
cloudabi_scope_t scope, \
|
||||
cloudabi_nthreads_t nwaiters); }
|
||||
|
||||
3 AUE_NULL STD { void cloudabi_sys_fd_close( \
|
||||
@ -196,7 +197,7 @@
|
||||
|
||||
31 AUE_NULL STD { void cloudabi_sys_lock_unlock( \
|
||||
cloudabi_lock_t *lock, \
|
||||
cloudabi_mflags_t scope); }
|
||||
cloudabi_scope_t scope); }
|
||||
|
||||
32 AUE_NULL STD { void cloudabi_sys_mem_advise( \
|
||||
void *addr, \
|
||||
@ -301,7 +302,7 @@
|
||||
|
||||
54 AUE_NULL STD { void cloudabi_sys_thread_exit( \
|
||||
cloudabi_lock_t *lock, \
|
||||
cloudabi_mflags_t scope); }
|
||||
cloudabi_scope_t scope); }
|
||||
|
||||
55 AUE_NULL STD { void cloudabi_sys_thread_tcb_set( \
|
||||
void *tcb); }
|
||||
|
Loading…
Reference in New Issue
Block a user