1 // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include <fcntl.h> 6 #include <stdlib.h> 7 #include <unistd.h> 8 #include <asm/unistd.h> 9 10 #define SIZE 1024 11 12 int main(int argc, char **argv) { 13 char buf[SIZE]; 14 int fd_z = syscall(__NR_open, "/dev/zero", O_RDONLY); 15 int fd_n = syscall(__NR_open, "/dev/null", O_RDONLY); 16 int nr = syscall(__NR_read, fd_z, buf, SIZE); 17 int nw = syscall(__NR_write, fd_n, buf, SIZE); 18 syscall(__NR_close, fd_z); 19 syscall(__NR_close, fd_n); 20 syscall(__NR_exit, 0); 21 } 22