Skip to content

Instantly share code, notes, and snippets.

@nuta
nuta / gist:b152682d43f9e4f2c056
Created November 21, 2014 08:38
Resea kernel panic log
Makefile:101: recipe for target 'clean' failed
GEN include/version.h
C hal/intel64/start.o (from .S)
C hal/intel64/c.o (from .S)
C hal/intel64/handler.o (from .S)
C hal/intel64/init.o
C hal/intel64/print.o
C hal/intel64/cpu.o
C hal/intel64/gdt.o
C hal/intel64/idt.o
@nuta
nuta / log
Created November 23, 2014 14:35
Resea: bugs in synchronized recv()
GEN include/version.h
CC hal/intel64/start.o (from .S)
CC hal/intel64/c.o (from .S)
CC hal/intel64/handler.o (from .S)
CC hal/intel64/init.o
CC hal/intel64/print.o
CC hal/intel64/cpu.o
CC hal/intel64/gdt.o
CC hal/intel64/idt.o
CC hal/intel64/tss.o
@nuta
nuta / gist:fafbebf5a707af2a27ea
Created December 8, 2014 09:08
dtruss `rails s`
dtrace: 1467 dynamic variable drops with non-empty dirty list
SYSCALL(args) = return
shm_open(0x7FFF9110ECCA, 0x0, 0x0) = 3 0
mmap(0x0, 0x1000, 0x1, 0x1, 0x3, 0x0) = 0x1053C8000 0
close_nocancel(0x3) = 0 0
geteuid(0x3, 0x1000, 0x1) = 0 0
thread_selfid(0x0, 0x0, 0x0) = 1935562 0
open("/Library/Ruby/Site/2.0.0/rubygems.rb\0", 0x1000000, 0x0) = -1 Err#2
open("/Library/Ruby/Site/2.0.0/x86_64-darwin14/rubygems.rb\0", 0x1000000, 0x0) = -1 Err#2
open("/Library/Ruby/Site/2.0.0/universal-darwin14/rubygems.rb\0", 0x1000000, 0x0) = -1 Err#2
#include <stdio.h>
static inline void _main (void){
}
typedef unsigned long long u64;
static inline u64 cycle (void){
u64 stamp;
__asm__ __volatile__("rdtscp; shl $32,%%rdx; or %%rdx,%%rax" : "=a"(stamp));
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
43.39 32.368699 103414 313 2 select
41.75 31.148654 200959 155 poll
13.88 10.355962 4428 2339 558 futex
0.56 0.417796 6 72348 68571 open
0.12 0.087338 5 16358 804 lstat
0.04 0.031954 7 4733 862 stat
0.04 0.031695 7 4875 170 read
0.04 0.027923 7 3774 mprotect
This file has been truncated, but you can view the full file.
21669 execve("/bin/rails", ["rails", "s"], [/* 26 vars */]) = 0
21669 brk(0) = 0xea3000
21669 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
21669 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
21669 fstat(3, {st_mode=S_IFREG|0644, st_size=67904, ...}) = 0
21669 mmap(NULL, 67904, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f0b30e91000
21669 close(3) = 0
21669 open("/usr/lib/libruby.so.2.2", O_RDONLY|O_CLOEXEC) = 3
21669 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\316\2\0\0\0\0\0"..., 832) = 832
21669 fstat(3, {st_mode=S_IFREG|0755, st_size=2541112, ...}) = 0

lwIPの移植

修正BSDライセンスでかなり良い感じのTCP/IPプロトコルスタック。 MinixもVirtualBoxも使っている様子。主な実装済みプロトコルは以下の通り。

  • DNS, DHCP
  • TCP, UDP
  • IPv4, IPv6, ICMP
  • ARP
@nuta
nuta / unix.md
Last active August 29, 2015 14:15

UNIX

GNU/Hurd

Machベース。Hurd自体はMachのカーネルサーバたち。 Debian GNU/Hurd(ディスクイメージ)を試した。

Machを隠そうとはせず、POSIX APIを使いたい時にHurdのサーバを使うという雰囲気。

(seiya@seiya-cybozu-thinkpad): [master]~/libc
% make test
LD_R libc.o
[FAIL] functional/argv.test
Output:
GDB:
Reading symbols from functional/argv.test...done.
functional/argv.c:11: argc == 1 failed: argc should be 1
[kernel/log] DEBUG: type=alloc_memory, group=0, size=4096
[kernel/init_base] INFO: Resea v0.1-0
[kernel/log] DEBUG: type=alloc_memory, group=0, size=4096
[kernel/log] DEBUG: type=alloc_memory, group=0, size=20480
[kernel/log] DEBUG: type=alloc_memory, group=0, size=4096
[kernel/log] DEBUG: type=alloc_memory, group=0, size=4096
[kernel/log] DEBUG: type=alloc_memory, group=0, size=4096
[kernel/log] DEBUG: type=alloc_memory, group=0, size=4096
[kernel/log] DEBUG: type=new_memory_area, size=16777216
[kernel/log] DEBUG: type=alloc_memory, group=0, size=20480