wiki:Dev

Version 54 (modified by mitty, 8 years ago) (diff)

--

Malbolge

Grass

Python

OCaml

  • Module Pervasives OCaml

    The initially opened module.

    This module provides the basic operations over the built-in types (numbers, booleans, strings, exceptions, references, lists, arrays, input-output channels, ...).

    This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by Pervasives.

  • OCaml プログラミング入門 (インストール)

    ledit

    OCaml の対話的環境を提供するコマンド: ocaml は ライセンス上の問題から、 C-a で行頭に戻ったりする事や、ヒストリ機能、 などと言った GNU の readline ライブラリを使った便利な機能がありません。 emacs から対話的環境を使うのが一つには考えられます が、どうしてもターミナルから実行したい人は、 ledit と言うコマンドを使えば大丈夫です。 ledit ocaml と起動するだけです。

Makefile

System Programming

  • sockets: AF_PACKET versus PF_PACKET

    Yes. AF_foo means address family foo, and PF_foo means protocol family foo. In Linux, they are always been the same values, I believe. Traditionally, the PF_foo constants were used for socket(), but AF_foo in the struct sockaddr structure.

    Thus, today, there really should be no difference between AF_foo and PF_foo.

  • PF_PACKETの仕組み - めもめも

    Socketをオープンする際のお作法(呪文?)は次のとおりで、通常は、第一引数に「PF_INET」(もしくはAF_INET)を指定します。

    sock = socket(PF_INET, SOCK_STREAM, htons(ETH_P_IP));
    

    ここに「PF_PACKET」を指定することで、受信直後の生パケットをユーザ空間のアプリケーションで受け取ることができるようになります。これは、パケットのコピーを受け取っているだけなので、このパケットを受け取るべき本来のアプリケーションにもちゃんと同じパケットは届きます。

  • TCP socketではwriteの後すぐにcloseしてはいけない - Togetter

    TCP socketではwriteの後すぐにcloseしてはいけない。 相手側に全てのデータが届いてからcloseする必要がある。 shutdown で書き込み側だけハーフクローズするとよい。 相手側がcloseしてから、こちらをcloseする。相手側がcloseしたことは、readを呼んでブロックさせておくと、読み込みバイト数==0 つまりEOFになったことでわかる。

  • how to use epoll with data->ptr, instead of data.fd? - Stack Overflow

    You can put whatever you want in data. It's not used by epoll itself, it just returns it when the event occurs on the fd specified in the argument list.

    • epoll_event構造体は以下のように定義されていた
      typedef union epoll_data {
          void        *ptr;
          int          fd;
          uint32_t     u32;
          uint64_t     u64;
      } epoll_data_t;
      
      struct epoll_event {
          uint32_t     events;      /* epoll イベント */
          epoll_data_t data;        /* ユーザデータ変数 */
      };