// Incomplete shims that we "stub out" just to get pre-main initialization code to work.
// These shims are enabled only when the caller is in the standard library.
- | "pthread_attr_init"
- | "pthread_attr_destroy"
- | "pthread_attr_setstacksize"
- | "pthread_condattr_init"
- | "pthread_condattr_setclock"
- | "pthread_cond_init"
- | "pthread_condattr_destroy"
- | "pthread_cond_destroy" if this.frame().instance.to_string().starts_with("std::sys::unix::")
- => {
- this.write_null(dest)?;
- }
- "pthread_attr_getguardsize" if this.frame().instance.to_string().starts_with("std::sys::unix::")
- => {
+ "pthread_attr_getguardsize"
+ if this.frame().instance.to_string().starts_with("std::sys::unix::") => {
let &[_attr, guard_size] = check_arg_count(args)?;
let guard_size = this.deref_operand(guard_size)?;
let guard_size_layout = this.libc_ty_layout("size_t")?;
this.write_null(dest)?;
}
+ | "pthread_attr_init"
+ | "pthread_attr_destroy"
+ | "pthread_condattr_init"
+ | "pthread_condattr_destroy"
+ | "pthread_cond_destroy"
+ if this.frame().instance.to_string().starts_with("std::sys::unix::") => {
+ let &[_] = check_arg_count(args)?;
+ this.write_null(dest)?;
+ }
+ | "pthread_cond_init"
+ | "pthread_attr_setstacksize"
+ | "pthread_condattr_setclock"
+ if this.frame().instance.to_string().starts_with("std::sys::unix::") => {
+ let &[_, _] = check_arg_count(args)?;
+ this.write_null(dest)?;
+ }
+
| "signal"
- | "sigaction"
| "sigaltstack"
- | "mprotect" if this.frame().instance.to_string().starts_with("std::sys::unix::")
- => {
+ if this.frame().instance.to_string().starts_with("std::sys::unix::") => {
+ let &[_, _] = check_arg_count(args)?;
+ this.write_null(dest)?;
+ }
+ | "sigaction"
+ | "mprotect"
+ if this.frame().instance.to_string().starts_with("std::sys::unix::") => {
+ let &[_, _, _] = check_arg_count(args)?;
this.write_null(dest)?;
}
// Just fake a HANDLE
this.write_scalar(Scalar::from_machine_isize(1, this), dest)?;
}
- "GetModuleHandleW" if this.frame().instance.to_string().starts_with("std::sys::windows::")
- => {
+ "GetModuleHandleW" if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
#[allow(non_snake_case)]
let &[_lpModuleName] = check_arg_count(args)?;
// Pretend this does not exist / nothing happened, by returning zero.
this.write_null(dest)?;
}
- "GetProcAddress" if this.frame().instance.to_string().starts_with("std::sys::windows::")
- => {
+ "GetProcAddress" if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
#[allow(non_snake_case)]
let &[_hModule, _lpProcName] = check_arg_count(args)?;
// Pretend this does not exist / nothing happened, by returning zero.
this.write_null(dest)?;
}
- "SetConsoleTextAttribute" if this.frame().instance.to_string().starts_with("std::sys::windows::")
- => {
+ "SetConsoleTextAttribute" if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
#[allow(non_snake_case)]
let &[_hConsoleOutput, _wAttribute] = check_arg_count(args)?;
// Pretend these does not exist / nothing happened, by returning zero.
| "InitializeCriticalSection"
| "EnterCriticalSection"
| "LeaveCriticalSection"
- | "DeleteCriticalSection" if this.frame().instance.to_string().starts_with("std::sys::windows::")
- => {
+ | "DeleteCriticalSection"
+ if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
#[allow(non_snake_case)]
let &[_lpCriticalSection] = check_arg_count(args)?;
assert_eq!(this.get_total_thread_count()?, 1, "concurrency on Windows not supported");
// (Windows locks are reentrant, and we have only 1 thread,
// so not doing any futher checks here is at least not incorrect.)
}
- "TryEnterCriticalSection" if this.frame().instance.to_string().starts_with("std::sys::windows::")
- => {
+ "TryEnterCriticalSection"
+ if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
#[allow(non_snake_case)]
let &[_lpCriticalSection] = check_arg_count(args)?;
assert_eq!(this.get_total_thread_count()?, 1, "concurrency on Windows not supported");
| "atomic_singlethreadfence_acqrel"
| "atomic_singlethreadfence"
=> {
+ let &[] = check_arg_count(args)?;
// we are inherently singlethreaded and singlecored, this is a nop
}