This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
extern crate core; | |
use core::mem; | |
use core::ptr; | |
use core::ptr::null_mut; | |
use core::str; | |
/// Implements an `Iterator` which returns on either newline or EOF. | |
pub struct RawLineBuffer { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libc_fn!(unsafe gethostent() -> Result<*const hostent> { | |
if hostdb == 0 { | |
hostdb = syscall::open("/etc/hosts", syscall::O_RDONLY).unwrap(); | |
} | |
let mut line = RawLineBuffer::new(hostdb); | |
let mut host_aliases: [*const u8; MAXALIASES] = [0 as *const u8; MAXALIASES]; | |
let hostaddr: [usize; (MAXADDRS+mem::size_of::<u64>()-1)/mem::size_of::<u64>()] = [0; (MAXADDRS+mem::size_of::<u64>()-1)/mem::size_of::<u64>()]; | |
let mut host_addrs: [*mut libc::c_char;2] = [0 as *mut libc::c_char; 2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libc_fn!(unsafe getprotoent() -> Result <*const protoent> { | |
if protodb == 0 { | |
protodb = syscall::open("/etc/protocols", syscall::O_RDONLY).unwrap(); | |
LINE = RawLineBuffer::new(protodb); | |
} | |
let mut r = match LINE.next() { | |
Some(Ok(s)) => s, | |
Some(Err(_)) => panic!(), | |
None => panic!() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsafe fn lookup_addr(addr: *const in_addr) -> Result<LookupAddr> { | |
// XXX better error handling | |
let ip_string = String::from_utf8(::file_read_all("/etc/net/ip")?).or(Err( | |
Error::new(syscall::EIO), | |
))?; | |
let ip: Vec<u8> = ip_string | |
.trim() | |
.split(".") | |
.map(|part| part.parse::<u8>().unwrap_or(0)) | |
.collect(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.C:0810 00 BRK | |
.C:0811 28 PLP | |
.C:0812 50 78 BVC $088C | |
.C:0814 A0 C8 LDY #$C8 | |
.C:0816 F0 18 BEQ $0830 | |
.C:0818 40 RTI | |
.C:0819 68 PLA | |
.C:081a 90 B8 BCC $07D4 | |
.C:081c E0 08 CPX #$08 | |
.C:081e 30 58 BMI $0878 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern "C" { | |
pub fn access(arg1: *const libc::c_char, | |
arg2: libc::c_int) -> libc::c_int; | |
} | |
extern "C" { | |
pub fn alarm(arg1: libc::c_uint) -> libc::c_uint; | |
} | |
extern "C" { | |
pub fn brk(arg1: *mut libc::c_void) -> libc::c_int; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains any messages produced by compilers while | |
running configure, to aid debugging if configure makes a mistake. | |
It was created by TiMidity++ configure 2.14.0, which was | |
generated by GNU Autoconf 2.69. Invocation command line was | |
$ ./configure --host=x86_64-unknown-redox --prefix= | |
## --------- ## | |
## Platform. ## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fallocate -l 1G /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo '/swapfile none swap sw 0 0' >> /etc/fstab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* \file | |
* | |
* \brief SAM Direct Memory Access Controller Driver | |
* | |
* Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries. | |
* | |
* \asf_license_start | |
* | |
* \page License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[path = "../../utils.rs"] | |
mod utils; | |
use crate::utils::*; | |
use std::boxed::Box; | |
use std::collections::HashMap; | |
fn main() { | |
let input: String = get_input(6).expect("Failed to retrieve input"); |