Skip to content

Commit

Permalink
Adds sysconf to the list of supported builtins
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
  • Loading branch information
feliperodri committed Jun 22, 2023
1 parent b36121a commit 0bc7547
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cprover_bindings/src/goto_program/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub enum BuiltinFn {
Sinf,
Sqrt,
Sqrtf,
Sysconf,
Trunc,
Truncf,
Unlink,
Expand Down Expand Up @@ -122,6 +123,7 @@ impl ToString for BuiltinFn {
Sinf => "sinf",
Sqrt => "sqrt",
Sqrtf => "sqrtf",
Sysconf => "sysconf",
Trunc => "trunc",
Truncf => "truncf",
Unlink => "unlink",
Expand Down Expand Up @@ -185,6 +187,7 @@ impl BuiltinFn {
Sinf => vec![Type::float()],
Sqrt => vec![Type::double()],
Sqrtf => vec![Type::float()],
Sysconf => vec![Type::c_int()],
Trunc => vec![Type::double()],
Truncf => vec![Type::float()],
Unlink => vec![Type::c_char().to_pointer()],
Expand Down Expand Up @@ -247,6 +250,7 @@ impl BuiltinFn {
Sinf => Type::float(),
Sqrt => Type::double(),
Sqrtf => Type::float(),
Sysconf => Type::c_long_int(),
Trunc => Type::double(),
Truncf => Type::float(),
Unlink => Type::c_int(),
Expand Down Expand Up @@ -309,6 +313,7 @@ impl BuiltinFn {
Sinf,
Sqrt,
Sqrtf,
Sysconf,
Trunc,
Truncf,
Unlink,
Expand Down
11 changes: 11 additions & 0 deletions tests/kani/Intrinsics/Sysconf/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
//! Check support for `sysconf`.

use libc;

#[kani::proof]
fn main() {
let page_size = unsafe { libc::sysconf(libc::_SC_PAGESIZE) } as usize;
}

0 comments on commit 0bc7547

Please sign in to comment.