Skip to content

Instantly share code, notes, and snippets.

@kondratev
kondratev / mmap_zcopy
Created February 10, 2024 00:08 — forked from laoar/mmap_zcopy
an example of kernel space to user space zero-copy via mmap, and also the comparing mmap with read/write
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <asm/uaccess.h>
#define MAX_SIZE (PAGE_SIZE * 2) /* max size mmaped to userspace */
#define DEVICE_NAME "mchar"
@kondratev
kondratev / epoll.go
Created April 7, 2021 17:58 — forked from tevino/epoll.go
An example of using epoll in Go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (