| 1 |
// Copyright 2014 The syscall.rs Project Developers. See the |
| 2 |
// COPYRIGHT file at the top-level directory of this distribution. |
| 3 |
// |
| 4 |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 5 |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 6 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 7 |
// option. This file may not be copied, modified, or distributed |
| 8 |
// except according to those terms. |
| 9 |
|
| •10 |
#![cfg(any(target_arch = "aarch64", target_arch = "riscv64", target_arch = "x86_64"))] |
| 11 |
|
| 12 |
#[macro_use] |
| 13 |
extern crate scrust-analyzer cargo sc 0.2.7 sc/; |
| 14 |
|
| 15 |
#[cfg(target_os = "linux")] |
| 16 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 17 |
fn ebadfrust-analyzer cargo sc 0.2.7 ebadf().() { |
| 18 |
static MESSAGErust-analyzer cargo sc 0.2.7 MESSAGE.: &'static str = "Hello, world!"; |
| 19 |
|
| 20 |
unsafe { |
| 21 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(syscallrust-analyzer cargo sc 0.2.7 macros/syscall!!(WRITErust-analyzer cargo sc 0.2.7 platform/nr/WRITE., 4, MESSAGErust-analyzer cargo sc 0.2.7 MESSAGE..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_ptr().(), MESSAGErust-analyzer cargo sc 0.2.7 MESSAGE..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()) as isize, |
| 22 |
-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().9) |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
// getpid() is POSIX but that doesn't guarantee it's a system call. |
| 27 |
#[cfg(any(target_os = "linux", target_os = "freebsd"))] |
| 28 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 29 |
fn getpidrust-analyzer cargo sc 0.2.7 getpid().() { |
| 30 |
unsafe { |
| 31 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(0 <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). scrust-analyzer cargo sc 0.2.7 crate/::syscall0rust-analyzer cargo sc 0.2.7 platform/syscall0().(scrust-analyzer cargo sc 0.2.7 crate/::nrrust-analyzer cargo sc 0.2.7 platform/nr/::GETPIDrust-analyzer cargo sc 0.2.7 platform/nr/GETPID.)); |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
#[cfg(any(target_os = "linux", target_os = "freebsd"))] |
| 36 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 37 |
fn getpid_macrorust-analyzer cargo sc 0.2.7 getpid_macro().() { |
| 38 |
unsafe { |
| 39 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(0 <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). syscallrust-analyzer cargo sc 0.2.7 macros/syscall!!(GETPIDrust-analyzer cargo sc 0.2.7 platform/nr/GETPID.)); |
| 40 |
} |
| 41 |
} |