move sys select bits to cbindgen
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
#ifndef _BITS_SYS_SELECT_H
|
||||
#define _BITS_SYS_SELECT_H
|
||||
|
||||
// from musl license MIT {
|
||||
#define FD_SETSIZE 1024
|
||||
|
||||
typedef unsigned long fd_mask;
|
||||
|
||||
typedef struct {
|
||||
unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
|
||||
} fd_set;
|
||||
|
||||
#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0)
|
||||
#define FD_SET(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
|
||||
#define FD_CLR(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
|
||||
#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define NFDBITS (8*(int)sizeof(long))
|
||||
#endif
|
||||
// } from musl license MIT
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,24 @@
|
||||
sys_includes = ["bits/sys/select.h", "time.h", "signal.h"]
|
||||
sys_includes = ["time.h", "signal.h"]
|
||||
after_includes = """
|
||||
// from musl license MIT {
|
||||
#define FD_SETSIZE 1024
|
||||
|
||||
typedef unsigned long fd_mask;
|
||||
|
||||
typedef struct {
|
||||
unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
|
||||
} fd_set;
|
||||
|
||||
#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0)
|
||||
#define FD_SET(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
|
||||
#define FD_CLR(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
|
||||
#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define NFDBITS (8*(int)sizeof(long))
|
||||
#endif
|
||||
// } from musl license MIT
|
||||
"""
|
||||
include_guard = "_SYS_SELECT_H"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
@@ -9,5 +29,5 @@ cpp_compat = true
|
||||
prefix_with_name = true
|
||||
|
||||
[export]
|
||||
# fd_set is also defined in C because cbindgen is incompatible with mem::size_of booo
|
||||
# fd_set is also defined in C (above) because cbindgen is incompatible with mem::size_of
|
||||
exclude = ["FD_SETSIZE", "fd_set"]
|
||||
|
||||
Reference in New Issue
Block a user