Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ashton/relibc
  • vincent/relibc
  • 4lDO2/relibc
  • boomshroom/relibc
  • njskalski/relibc
  • bjorn3/relibc
  • microcolonel/relibc
  • gmacd/relibc
  • feliwir/relibc
  • devnexen/relibc
  • jamesgraves/relibc
  • oddcoder/relibc
  • andar1an/relibc
  • gugz0r/relibc
  • matijaskala/relibc
  • zen3ger/relibc
  • josh/relibc
  • redox-os/relibc
  • Majoneza/relibc
  • enygmator/relibc
  • JustAnotherDev/relibc
  • doriancodes/relibc
  • adamantinum/relibc
  • wiredtv/relibc
  • stratact/relibc
  • Ramla-I/relibc
  • martin/relibc
  • bitstr0m/relibc
  • henritel/relibc
  • smckay/relibc
  • xTibor/relibc
  • devajithvs/relibc
  • andypython/relibc
  • t-nil/relibc
  • DataTriny/relibc
  • ids1024/relibc
  • SteveLauC/relibc
  • dlrobertson/relibc
  • AgostonSzepessy/relibc
  • TheDarkula/relibc
  • willnode/relibc
  • bamontan/relibc
  • redoxeon/relibc
  • ayf/relibc
  • heghe/relibc
  • Ivan/relibc
  • hasheddan/relibc
  • dahc/relibc
  • auwardoctor/relibc
  • kodicraft/relibc
  • arthurpaulino/relibc
  • jasonhansel/relibc
  • bpisch/relibc
  • kel/relibc
  • GrayJack/relibc
  • darley/relibc
  • sahitpj/relibc
  • plimkilde/relibc
  • BjornTheProgrammer/relibc
  • defra/relibc
  • Schyrsivochter/relibc
  • ebalalic/relibc
  • adchacon/relibc
  • aaronjanse/relibc
  • josh_williams/relibc
  • 8tab/relibc
  • nicoan/relibc
  • athei/relibc
  • carrot93/relibc
  • RA_GM1/relibc
  • zhaozhao/relibc
  • JCake/relibc
  • KGrewal1/relibc
  • emturner/relibc
  • LuigiPiucco/relibc
  • bfrascher/relibc
  • starsheriff/relibc
  • kcired/relibc
  • jamespcfrancis/relibc
  • neallred/relibc
  • omar-mohamed-khallaf/relibc
  • jD91mZM2/relibc
  • rw_van/relibc
  • Skallwar/relibc
  • matt-vdv/relibc
  • mati865/relibc
  • SoyaOhnishi/relibc
  • ArniDagur/relibc
  • tlam/relibc
  • glongo/relibc
  • kamirr/relibc
  • abdullah/relibc
  • saeedtabrizi/relibc
  • sajattack/relibc
  • lmiskiew/relibc
  • seanpk/relibc
  • MaikuZ/relibc
  • jamadazi/relibc
  • coolreader18/relibc
  • wt/relibc
  • lebensterben/relibc
  • uuuvn/relibc
  • vadorovsky/relibc
  • raffaeleragni/relibc
  • freewilll/relibc
  • LLeny/relibc
  • alfredoyang/relibc
  • batonius/relibc
  • TornaxO7/relibc
  • Arcterus/relibc
  • Tommoa/relibc
  • samuela/relibc
  • mindriot101/relibc
  • lygstate/relibc
114 results
Show changes
Showing
with 745 additions and 76 deletions
//! grp implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/grp.h.html
#![no_std]
extern crate platform;
use platform::types::*;
#[repr(C)]
pub struct group {
pub gr_name: *mut c_char,
pub gr_passwd: *mut c_char,
pub gr_gid: gid_t,
pub gr_mem: *mut *mut c_char,
}
#[no_mangle]
pub extern "C" fn getgrgid(gid: gid_t) -> *mut group {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn getgrnam(name: *const c_char) -> *mut group {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn getgrgid_r(
gid: gid_t,
grp: *mut group,
buffer: *mut c_char,
bufsize: usize,
result: *mut *mut group,
) -> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn getgrnam_r(
name: *const c_char,
grp: *mut group,
buffer: *mut c_char,
bufsize: usize,
result: *mut *mut group,
) -> c_int {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn getgrent() -> *mut group {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn endgrent() {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn setgrent() {
unimplemented!();
}
/*
#[no_mangle]
pub extern "C" fn func(args) -> c_int {
unimplemented!();
}
*/
sys_includes = []
include_guard = "_RELIBC_AIO_H"
language = "C"
style = "Tag"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true
use crate::{
header::time::{sigevent, timespec},
platform::types::*,
};
pub struct aiocb { pub struct aiocb {
pub aio_fildes: libc::c_int, pub aio_fildes: c_int,
pub aio_lio_opcode: libc::c_int, pub aio_lio_opcode: c_int,
pub aio_reqprio: libc::c_int, pub aio_reqprio: c_int,
pub aio_buf: *mut libc::c_void, pub aio_buf: *mut c_void,
pub aio_nbytes: usize, pub aio_nbytes: usize,
pub aio_sigevent: sigevent, pub aio_sigevent: sigevent,
} }
#[no_mangle] // #[no_mangle]
pub extern "C" fn aio_read(aiocbp: *mut aiocb) -> libc::c_int { pub extern "C" fn aio_read(aiocbp: *mut aiocb) -> c_int {
unimplemented!(); unimplemented!();
} }
#[no_mangle] // #[no_mangle]
pub extern "C" fn aio_write(aiocbp: *mut aiocb) -> libc::c_int { pub extern "C" fn aio_write(aiocbp: *mut aiocb) -> c_int {
unimplemented!(); unimplemented!();
} }
#[no_mangle] // #[no_mangle]
pub extern "C" fn lio_listio( pub extern "C" fn lio_listio(
mode: libc::c_int, mode: c_int,
list: *const *const aiocb, list: *const *const aiocb,
nent: libc::c_int, nent: c_int,
sig: *mut sigevent, sig: *mut sigevent,
) -> libc::c_int { ) -> c_int {
unimplemented!(); unimplemented!();
} }
#[no_mangle] // #[no_mangle]
pub extern "C" fn aio_error(aiocbp: *const aiocb) -> libc::c_int { pub extern "C" fn aio_error(aiocbp: *const aiocb) -> c_int {
unimplemented!(); unimplemented!();
} }
#[no_mangle] // #[no_mangle]
pub extern "C" fn aio_return(aiocbp: *mut aiocb) -> usize { pub extern "C" fn aio_return(aiocbp: *mut aiocb) -> usize {
unimplemented!(); unimplemented!();
} }
#[no_mangle] // #[no_mangle]
pub extern "C" fn aio_cancel(fildes: libc::c_int, aiocbp: *mut aiocb) -> libc::c_int { pub extern "C" fn aio_cancel(fildes: c_int, aiocbp: *mut aiocb) -> c_int {
unimplemented!(); unimplemented!();
} }
#[no_mangle] // #[no_mangle]
pub extern "C" fn aio_suspend( pub extern "C" fn aio_suspend(
list: *const *const aiocb, list: *const *const aiocb,
nent: libc::c_int, nent: c_int,
timeout: *const timespec, timeout: *const timespec,
) -> libc::c_int { ) -> c_int {
unimplemented!(); unimplemented!();
} }
#[no_mangle] // #[no_mangle]
pub extern "C" fn aio_fsync(operation: libc::c_int, aiocbp: *mut aiocb) -> libc::c_int { pub extern "C" fn aio_fsync(operation: c_int, aiocbp: *mut aiocb) -> c_int {
unimplemented!(); unimplemented!();
} }
sys_includes = ["stdint.h", "sys/types.h"]
include_guard = "_RELIBC_FENV_H"
language = "C"
style = "Tag"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true
//! fenv.h implementation for Redox, following
//! http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fenv.h.html
use crate::platform::types::*;
pub const FE_ALL_EXCEPT: c_int = 0;
pub const FE_TONEAREST: c_int = 0;
pub type fexcept_t = u64;
#[repr(C)]
pub struct fenv_t {
pub cw: u64,
}
// #[no_mangle]
pub unsafe extern "C" fn feclearexcept(excepts: c_int) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn fegenenv(envp: *mut fenv_t) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn fegetexceptflag(flagp: *mut fexcept_t, excepts: c_int) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn fegetround() -> c_int {
FE_TONEAREST
}
// #[no_mangle]
pub unsafe extern "C" fn feholdexcept(envp: *mut fenv_t) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn feraiseexcept(except: c_int) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn fesetenv(envp: *const fenv_t) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn fesetexceptflag(flagp: *const fexcept_t, excepts: c_int) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn fesetround(round: c_int) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn fetestexcept(excepts: c_int) -> c_int {
unimplemented!();
}
// #[no_mangle]
pub unsafe extern "C" fn feupdateenv(envp: *const fenv_t) -> c_int {
unimplemented!();
}
sys_includes = []
include_guard = "_RELIBC_TEMPLATE_H"
language = "C"
style = "Tag"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true
//! template implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/template.h.html //! template implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/template.h.html
#![no_std]
extern crate platform;
use platform::types::*; use platform::types::*;
/* /*
......
sys_includes = [] sys_includes = []
include_guard = "_CTYPE_H" include_guard = "_AARCH64_USER_H"
language = "C" language = "C"
style = "Tag"
[enum] [enum]
prefix_with_name = true prefix_with_name = true
use crate::platform::types::*;
#[repr(C)]
pub struct user_regs_struct {
pub regs: [c_ulonglong; 31],
pub sp: c_ulonglong,
pub pc: c_ulonglong,
pub pstate: c_ulonglong,
}
#[repr(C)]
pub struct user_fpsimd_struct {
pub vregs: [c_double; 32], // BUG: rust doesn't have f128 which is equivalent for long double
pub fpsr: c_uint,
pub fpcr: c_uint,
}
pub type elf_greg_t = c_ulong;
pub type elf_gregset_t = [c_ulong; 34];
pub type elf_fpregset_t = user_fpsimd_struct;
#[no_mangle]
pub extern "C" fn _cbindgen_export_aarch64_user(
a: user_regs_struct,
b: user_fpsimd_struct,
c: elf_gregset_t,
d: elf_greg_t,
e: elf_fpregset_t,
) {
}
sys_includes = [] sys_includes = []
include_guard = "_GRP_H" include_guard = "_RISCV64_USER_H"
language = "C" language = "C"
style = "Tag"
[enum] [enum]
prefix_with_name = true prefix_with_name = true
use crate::platform::types::*;
#[repr(C)]
pub struct user_regs_struct {
pub regs: [c_ulong; 31], // x1-x31
pub pc: c_ulong,
}
#[repr(C)]
pub struct user_fpregs_f_struct {
pub fpregs: [c_float; 32],
pub fcsr: c_uint,
}
#[repr(C)]
pub struct user_fpregs_g_struct {
pub fpregs: [c_double; 32],
pub fcsr: c_uint,
}
#[repr(C)]
pub struct user_fpregs_struct {
pub f_regs: user_fpregs_f_struct,
pub g_regs: user_fpregs_g_struct,
}
pub type elf_greg_t = c_ulong;
pub type elf_gregset_t = user_regs_struct;
pub type elf_fpregset_t = user_fpregs_struct;
#[no_mangle]
pub extern "C" fn _cbindgen_only_generates_structs_if_they_are_mentioned_which_is_dumb_riscv64_user(
a: user_regs_struct,
b: user_fpregs_struct,
c: elf_gregset_t,
d: elf_greg_t,
e: elf_fpregset_t,
) {
}
sys_includes = [] sys_includes = []
include_guard = "_MMAN_H" include_guard = "_X64_USER_H"
language = "C" language = "C"
style = "Tag"
[enum] [enum]
prefix_with_name = true prefix_with_name = true
//! A part of the ptrace compatibility for Redox OS
use crate::platform::types::*;
#[repr(C)]
pub struct user_fpregs_struct {
pub cwd: u16,
pub swd: u16,
pub ftw: u16,
pub fop: u16,
pub rip: u64,
pub rdp: u64,
pub mxcsr: u32,
pub mxcr_mask: u32,
pub st_space: [u32; 32],
pub xmm_space: [u32; 64],
pub padding: [u32; 24],
}
#[repr(C)]
pub struct user_regs_struct {
pub r15: c_ulong,
pub r14: c_ulong,
pub r13: c_ulong,
pub r12: c_ulong,
pub rbp: c_ulong,
pub rbx: c_ulong,
pub r11: c_ulong,
pub r10: c_ulong,
pub r9: c_ulong,
pub r8: c_ulong,
pub rax: c_ulong,
pub rcx: c_ulong,
pub rdx: c_ulong,
pub rsi: c_ulong,
pub rdi: c_ulong,
pub orig_rax: c_ulong,
pub rip: c_ulong,
pub cs: c_ulong,
pub eflags: c_ulong,
pub rsp: c_ulong,
pub ss: c_ulong,
pub fs_base: c_ulong,
pub gs_base: c_ulong,
pub ds: c_ulong,
pub es: c_ulong,
pub fs: c_ulong,
pub gs: c_ulong,
}
pub type elf_greg_t = c_ulong;
pub type elf_gregset_t = [c_ulong; 27];
pub type elf_fpregset_t = user_fpregs_struct;
#[repr(C)]
pub struct user {
pub regs: user_regs_struct,
pub u_fpvalid: c_int,
pub i387: user_fpregs_struct,
pub u_tsize: c_ulong,
pub u_dsize: c_ulong,
pub u_ssize: c_ulong,
pub start_code: c_ulong,
pub start_stack: c_ulong,
pub signal: c_long,
pub reserved: c_int,
pub u_ar0: *mut user_regs_struct,
pub u_fpstate: *mut user_fpregs_struct,
pub magic: c_ulong,
pub u_comm: [c_char; 32],
pub u_debugreg: [c_ulong; 8],
}
#[no_mangle]
pub extern "C" fn _cbindgen_export_x86_user(
a: user_fpregs_struct,
b: user_regs_struct,
c: user,
d: elf_gregset_t,
e: elf_greg_t,
f: elf_fpregset_t,
) {
}
sys_includes = ["stddef.h", "sys/socket.h", "netinet/in.h"]
include_guard = "_ARPA_INET_H"
language = "C"
style = "Tag"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true
[export.rename]
"in_addr" = "struct in_addr"
//! `arpa/inet.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/arpa_inet.h.html>.
// TODO: set this for entire crate when possible
#![deny(unsafe_op_in_unsafe_fn)]
use core::{
ptr, slice,
str::{self, FromStr},
};
use crate::{
c_str::CStr,
header::{
errno::*,
netinet_in::{in_addr, in_addr_t, INADDR_NONE},
sys_socket::{constants::*, socklen_t},
},
platform::{self, types::*},
};
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/htonl.html>.
#[no_mangle]
pub extern "C" fn htonl(hostlong: uint32_t) -> uint32_t {
hostlong.to_be()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/htonl.html>.
#[no_mangle]
pub extern "C" fn htons(hostshort: uint16_t) -> uint16_t {
hostshort.to_be()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/inet_addr.html>.
///
/// # Deprecated
/// The `inet_addr()` function was marked obsolescent in the Open Group Base
/// Specifications Issue 8.
#[deprecated]
#[no_mangle]
pub unsafe extern "C" fn inet_addr(cp: *const c_char) -> in_addr_t {
let mut val: in_addr = in_addr { s_addr: 0 };
if unsafe { inet_aton(cp, &mut val) } > 0 {
val.s_addr
} else {
INADDR_NONE
}
}
/// Non-POSIX, see <https://www.man7.org/linux/man-pages/man3/inet_aton.3.html>.
#[no_mangle]
pub unsafe extern "C" fn inet_aton(cp: *const c_char, inp: *mut in_addr) -> c_int {
// TODO: octal/hex
unsafe { inet_pton(AF_INET, cp, inp as *mut c_void) }
}
/// See <https://pubs.opengroup.org/onlinepubs/7908799/xns/inet_lnaof.html>.
///
/// # Deprecation
/// The `inet_lnaof()` function was specified in Networking Services Issue 5,
/// but not in the Open Group Base Specifications Issue 6 and later.
#[deprecated]
#[no_mangle]
pub extern "C" fn inet_lnaof(r#in: in_addr) -> in_addr_t {
if r#in.s_addr >> 24 < 128 {
r#in.s_addr & 0xff_ffff
} else if r#in.s_addr >> 24 < 192 {
r#in.s_addr & 0xffff
} else {
r#in.s_addr & 0xff
}
}
/// See <https://pubs.opengroup.org/onlinepubs/7908799/xns/inet_makeaddr.html>.
///
/// # Deprecation
/// The `inet_makeaddr()` function was specified in Networking Services Issue
/// 5, but not in the Open Group Base Specifications Issue 6 and later.
#[deprecated]
#[no_mangle]
pub extern "C" fn inet_makeaddr(net: in_addr_t, lna: in_addr_t) -> in_addr {
let mut output: in_addr = in_addr { s_addr: 0 };
if net < 256 {
output.s_addr = lna | net << 24;
} else if net < 65536 {
output.s_addr = lna | net << 16;
} else {
output.s_addr = lna | net << 8;
}
output
}
/// See <https://pubs.opengroup.org/onlinepubs/7908799/xns/inet_netof.html>.
///
/// # Deprecation
/// The `inet_netof()` function was specified in Networking Services Issue 5,
/// but not in the Open Group Base Specifications Issue 6 and later.
#[deprecated]
#[no_mangle]
pub extern "C" fn inet_netof(r#in: in_addr) -> in_addr_t {
if r#in.s_addr >> 24 < 128 {
r#in.s_addr & 0xff_ffff
} else if r#in.s_addr >> 24 < 192 {
r#in.s_addr & 0xffff
} else {
r#in.s_addr & 0xff
}
}
/// See <https://pubs.opengroup.org/onlinepubs/7908799/xns/inet_network.html>.
///
/// # Deprecation
/// The `inet_network()` function was specified in Networking Services Issue 5,
/// but not in the Open Group Base Specifications Issue 6 and later.
#[deprecated]
#[no_mangle]
pub unsafe extern "C" fn inet_network(cp: *const c_char) -> in_addr_t {
ntohl(unsafe { inet_addr(cp) })
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/inet_addr.html>.
///
/// # Deprecation
/// The `inet_ntoa()` function was marked obsolescent in the Open Group Base
/// Specifications Issue 8.
#[deprecated]
#[no_mangle]
pub unsafe extern "C" fn inet_ntoa(r#in: in_addr) -> *const c_char {
static mut NTOA_ADDR: [c_char; 16] = [0; 16];
unsafe {
inet_ntop(
AF_INET,
&r#in as *const in_addr as *const c_void,
NTOA_ADDR.as_mut_ptr(),
16,
)
}
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/inet_ntop.html>.
#[no_mangle]
pub unsafe extern "C" fn inet_ntop(
af: c_int,
src: *const c_void,
dst: *mut c_char,
size: socklen_t,
) -> *const c_char {
if af != AF_INET {
platform::ERRNO.set(EAFNOSUPPORT);
ptr::null()
} else if size < 16 {
platform::ERRNO.set(ENOSPC);
ptr::null()
} else {
let s_addr = unsafe {
slice::from_raw_parts(
&(*(src as *const in_addr)).s_addr as *const _ as *const u8,
4,
)
};
let addr = format!("{}.{}.{}.{}\0", s_addr[0], s_addr[1], s_addr[2], s_addr[3]);
unsafe {
ptr::copy(addr.as_ptr() as *const c_char, dst, addr.len());
}
dst
}
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/inet_ntop.html>.
#[no_mangle]
pub unsafe extern "C" fn inet_pton(af: c_int, src: *const c_char, dst: *mut c_void) -> c_int {
if af != AF_INET {
platform::ERRNO.set(EAFNOSUPPORT);
-1
} else {
let s_addr = unsafe {
slice::from_raw_parts_mut(&mut (*(dst as *mut in_addr)).s_addr as *mut _ as *mut u8, 4)
};
let src_cstr = unsafe { CStr::from_ptr(src) };
let mut octets = unsafe { str::from_utf8_unchecked(src_cstr.to_bytes()).split('.') };
for i in 0..4 {
if let Some(n) = octets.next().and_then(|x| u8::from_str(x).ok()) {
s_addr[i] = n;
} else {
return 0;
}
}
if octets.next() == None {
1 // Success
} else {
0
}
}
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/htonl.html>.
#[no_mangle]
pub extern "C" fn ntohl(netlong: uint32_t) -> uint32_t {
u32::from_be(netlong)
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/htonl.html>.
#[no_mangle]
pub extern "C" fn ntohs(netshort: uint16_t) -> uint16_t {
u16::from_be(netshort)
}
sys_includes = ["features.h"]
include_guard = "_RELIBC_ASSERT_H"
trailer = "#include <bits/assert.h>"
language = "C"
style = "Tag"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true
//! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html
// TODO: set this for entire crate when possible
#![deny(unsafe_op_in_unsafe_fn)]
use crate::{c_str::CStr, platform::types::*};
#[no_mangle]
pub unsafe extern "C" fn __assert_fail(
func: *const c_char,
file: *const c_char,
line: c_int,
cond: *const c_char,
) -> ! {
let func = unsafe { CStr::from_ptr(func) }.to_str().unwrap();
let file = unsafe { CStr::from_ptr(file) }.to_str().unwrap();
let cond = unsafe { CStr::from_ptr(cond) }.to_str().unwrap();
eprintln!("{}: {}:{}: Assertion `{}` failed.", func, file, line, cond);
core::intrinsics::abort();
}
sys_includes = ["bits/sched.h"]
include_guard = "_RELIBC_BITS_PTHREAD_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
# TODO: Any better way to implement pthread_cleanup_push/pthread_cleanup_pop?
after_includes = """
#define PTHREAD_COND_INITIALIZER ((pthread_cond_t){0})
#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t){0})
#define PTHREAD_ONCE_INIT ((pthread_once_t){0})
#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t){0})
#define pthread_cleanup_push(ROUTINE, ARG) do { \\
struct { \\
void (*routine)(void *); \\
void *arg; \\
void *prev; \\
} __relibc_internal_pthread_ll_entry = { \\
.routine = (void (*)(void *))(ROUTINE), \\
.arg = (void *)(ARG), \\
}; \\
__relibc_internal_pthread_cleanup_push(&__relibc_internal_pthread_ll_entry);
#define pthread_cleanup_pop(EXECUTE) \\
__relibc_internal_pthread_cleanup_pop((EXECUTE)); \\
} while(0)
"""
[export.rename]
"sched_param" = "struct sched_param"
"AtomicInt" = "int"
"AtomicUint" = "unsigned"
[export]
include = [
"pthread_attr_t",
"pthread_rwlockattr_t",
"pthread_rwlock_t",
"pthread_barrier_t",
"pthread_barrierattr_t",
"pthread_mutex_t",
"pthread_mutexattr_t",
"pthread_condattr_t",
"pthread_cond_t",
"pthread_spinlock_t",
"pthread_once_t",
"pthread_t",
"pthread_key_t",
]
[enum]
prefix_with_name = true
#![allow(non_camel_case_types)]
use crate::platform::types::*;
// XXX: https://github.com/eqrion/cbindgen/issues/685
//
// We need to write the opaque types ourselves, and apparently cbindgen doesn't even support
// expanding macros! Instead, we rely on checking that the lengths are correct, when these headers
// are parsed in the regular compilation phase.
#[repr(C)]
pub union pthread_attr_t {
__relibc_internal_size: [c_uchar; 32],
__relibc_internal_align: size_t,
}
#[repr(C)]
pub union pthread_rwlockattr_t {
__relibc_internal_size: [c_uchar; 1],
__relibc_internal_align: c_uchar,
}
#[repr(C)]
pub union pthread_rwlock_t {
__relibc_internal_size: [c_uchar; 4],
__relibc_internal_align: c_int,
}
#[repr(C)]
pub union pthread_barrier_t {
__relibc_internal_size: [c_uchar; 24],
__relibc_internal_align: c_int,
}
#[repr(C)]
pub union pthread_barrierattr_t {
__relibc_internal_size: [c_uchar; 4],
__relibc_internal_align: c_int,
}
#[repr(C)]
pub union pthread_mutex_t {
__relibc_internal_size: [c_uchar; 12],
__relibc_internal_align: c_int,
}
#[repr(C)]
pub union pthread_mutexattr_t {
__relibc_internal_size: [c_uchar; 20],
__relibc_internal_align: c_int,
}
#[repr(C)]
pub union pthread_cond_t {
__relibc_internal_size: [c_uchar; 8],
__relibc_internal_align: c_int,
}
#[repr(C)]
pub union pthread_condattr_t {
__relibc_internal_size: [c_uchar; 8],
__relibc_internal_align: c_int,
}
#[repr(C)]
pub union pthread_spinlock_t {
__relibc_internal_size: [c_uchar; 4],
__relibc_internal_align: c_int,
}
#[repr(C)]
pub union pthread_once_t {
__relibc_internal_size: [c_uchar; 4],
__relibc_internal_align: c_int,
}
macro_rules! assert_equal_size(
($export:ident, $wrapped:ident) => {
const _: () = unsafe {
type Wrapped = crate::header::pthread::$wrapped;
// Fail at compile-time if sizes differ.
// TODO: Is this UB?
let export = $export { __relibc_internal_align: 0 };
let _: Wrapped = core::mem::transmute(export.__relibc_internal_size);
// Fail at compile-time if alignments differ.
let a = [0_u8; core::mem::align_of::<$export>()];
let b: [u8; core::mem::align_of::<Wrapped>()] = core::mem::transmute(a);
};
// TODO: Turn into a macro?
#[cfg(all(target_os = "redox", feature = "check_against_libc_crate"))]
const _: () = unsafe {
use ::__libc_only_for_layout_checks as libc;
let export = $export { __relibc_internal_align: 0 };
let _: libc::$export = core::mem::transmute(export.__relibc_internal_size);
let a = [0_u8; core::mem::align_of::<$export>()];
let b: [u8; core::mem::align_of::<libc::$export>()] = core::mem::transmute(a);
};
}
);
assert_equal_size!(pthread_attr_t, RlctAttr);
assert_equal_size!(pthread_rwlock_t, RlctRwlock);
assert_equal_size!(pthread_rwlockattr_t, RlctRwlockAttr);
assert_equal_size!(pthread_barrier_t, RlctBarrier);
assert_equal_size!(pthread_barrierattr_t, RlctBarrierAttr);
assert_equal_size!(pthread_mutex_t, RlctMutex);
assert_equal_size!(pthread_mutexattr_t, RlctMutexAttr);
assert_equal_size!(pthread_cond_t, RlctCond);
assert_equal_size!(pthread_condattr_t, RlctCondAttr);
assert_equal_size!(pthread_spinlock_t, RlctSpinlock);
assert_equal_size!(pthread_once_t, RlctOnce);
pub type pthread_t = *mut c_void;
pub type pthread_key_t = c_ulong;
sys_includes = []
include_guard = "_RELIBC_BITS_SCHED_H"
language = "C"
style = "tag"
no_includes = true
cpp_compat = true
[export]
include = [
"sched_param",
]