Skip to content

Instantly share code, notes, and snippets.

$ systool -v -m netmap
Module = "netmap"

  Attributes:
    coresize            = "143360"
    initsize            = "0"
    initstate           = "live"
    refcnt              = "0"
    srcversion          = "5F4F49C43161A16E4F13BC0"

Lunar IR

Lunar言語の中間表現であり、ここからLLVM IRへ変換。

構文

  • IR := TOP*
  • TOP := GLOBAL | THREADLOCAL | IMPORT | TOPSTATEMENT | DEFUN | EXPR
  • TOPSTATEMENT := LET | COND | WHILE | SELECT | BLOCK | STRUCT | CUNION | UNION
  • STATEMENT := LET | COND | WHILE | BREAK | SELECT | RETURN | STRUCT | CUNION | UNION | BLOCK | LEAP
#include <stdio.h>
#include <thread>
#include <functional>
class myclass {
public:
myclass() {
auto th = std::thread(std::bind(&myclass::print, this));
th.join();
}
@ytakano
ytakano / insmod_netmap.yaml
Last active November 25, 2015 10:21
ansible for insmod netmap.ko
# command:
# ansible-playbook -i /etc/ansible/hosts --ask-sudo-pass insmod_netmap.yaml
- hosts: netmap
sudo: yes
vars:
work_dir: /root/down
netmap_dir: "{{work_dir}}/netmap"
tasks:
- name: rmmod
@ytakano
ytakano / netmap.yaml
Last active April 22, 2016 02:03
ansible for netmap
# command:
# ansible-playbook -i /etc/ansible/hosts --ask-sudo-pass netmap.yaml
- hosts: netmap
sudo: yes
vars:
work_dir: /root/down
netmap_dir: "{{work_dir}}/netmap"
kernel_src_dir: /usr/src/linux-source
kernel_headers_dir: /usr/src/linux-headers

statusがexitedなcontainerを削除

docker rm $(docker ps -a --filter 'status=exited' -q)

Ubuntu 15.10のコンテナを起動

sudo docker run -it --name ansible ubuntu:15.10 bash
  • -i: interactive
  • -t: allocate tty
@ytakano
ytakano / fabs_skel.py
Last active November 22, 2015 20:03
skelton for the flow abstractor (TCP)
import socket
import sys
class fabs_skel:
def openif(self, path):
self._path = path
self._session = {}
self.__sock = socket.socket(socket.AF_UNIX)
@ytakano
ytakano / stm.hs
Created October 2, 2015 12:41
STMの実験
import System.Random
import Data.Sequence (Seq)
import Data.Sequence as Seq
import Data.Word
import Data.IORef
import Control.Concurrent.STM.TVar
import Control.Concurrent.STM
import Control.Concurrent
data Session = Session { ip1 :: Word32, port1 :: Word16,
@ytakano
ytakano / skel.pl
Last active October 6, 2015 07:52
use Socket;
my @sessions;
# connect IF by UNIX domain socket
my $path = "/tmp/sf-tap/tcp/http";
my $s;
socket($s, AF_UNIX, SOCK_STREAM, 0);
connect($s, pack_sockaddr_un($path)) or die "cannot connect to $path";
@ytakano
ytakano / rtm_test.c
Created April 10, 2015 10:32
Intel TSX RTM
#include <stdio.h>
int main()
{
volatile int i = 0;
while (i < 100000000) {
asm ("xbegin ABORT");
i++;
asm ("xend");
asm ("ABORT:");