Hello

My IRC chatbot – SeeBorg.

My dance music podcast.

Some undocumented bits

  • close(2) with enabled SO_LINGER results in block even if socket is nonblocking, blocks for 'linger_timeout' at most.
  • To fix iosnoop dynamic variable drops, edit it and add this:
    #pragma D option dynvarsize=16m

    Tweak this value up until you stop getting dynamic variable drops.

Sendfile overview

Mach Sendfile

int sendfile(int fd, int s, off_t offset, off_t *len, struct sf_hdtr* hdtr, int flags);

  • Offset can't fall beyond EOF
  • len can't be NULL
  • on return, len is number of bytes successfully sent
  • returns EAGAIN on non-blocking fd
  • on EINTR, len of 0 does not mean everything was copied
  • len 0 → till EOF
  • FD must point to regular file
  • s must be sock_stream socket

FreeBSD sendfile()

int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags);

  • offset can't fall beyond EOF
  • nbytes 0 → till eof
  • sbytes – total bytes sent
  • flags sf_nodiskio – no blocking or return EBUSY
  • fd must be file descriptor
  • s must be sock_stream descriptor
  • on EINTR, some data might be already sent

Sun Solaris sendfile()

ssize_t sendfile(int out, int in, off_t *off, size_t len);

  • in must be regular file
  • out must be sock_stream socket
  • off is pointer to offset
  • on return, off points to byte following last byte that was read
  • does not modify in_fd offset
  • does modify out_fd offset
  • on EINTR, no data was transferred

Linux sendfile()

ssize_t sendfile(int out, int in, off_t *offset, size_t count);

  • If offset is set to NULL, update in_fd's offset
  • else write to offset
  • in_fd must support mmap()
  • in_fd can't be socket
  • count can't be zero
  • user should fall back to read()/write() if sendfile() failes with EINVAL or ENOSYS
  • returns EAGAIN on non-blocking FD


My Twitter

(1 hour, 40 mins ago) Хочу в твиттер встроенный фильтр, чтобы выфильтровать нафиг сообщения кто где подписался в ютубе и кто где зачекинился в 4sq.
(1 day, 1 hour ago) Кашляющие наступают. Теперь ещё и сзади кашляют. И сам покашливаю :(