Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 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 |
#[macro_use] |
| 11 |
extern crate sc; |
| 12 |
|
| 13 |
#[cfg(target_os = "linux")] |
| 14 |
#[test] |
| 15 |
fn ebadf() { |
| 16 |
static MESSAGE: &'static str = "Hello, world!"; |
| 17 |
|
| 18 |
unsafe { |
| 19 |
assert_eq!(syscall!(WRITE, 4, MESSAGE.as_ptr(), MESSAGE.len()) as isize, |
| 20 |
-9) |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
// getpid() is POSIX but that doesn't guarantee it's a system call. |
| 25 |
#[cfg(any(target_os = "linux", target_os = "freebsd"))] |
| 26 |
#[test] |
| 27 |
fn getpid() { |
| 28 |
unsafe { |
| 29 |
assert!(0 < sc::syscall0(sc::nr::GETPID)); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
#[cfg(any(target_os = "linux", target_os = "freebsd"))] |
| 34 |
#[test] |
| 35 |
fn getpid_macro() { |
| 36 |
unsafe { |
| 37 |
assert!(0 < syscall!(GETPID)); |
| 38 |
} |
| 39 |
} |