Skip to content

Instantly share code, notes, and snippets.

@SumiTomohiko
SumiTomohiko / kqueue_daemon.c
Last active May 21, 2020 13:46
Simple daemon example using kqueue
/*
* This is public domain.
*/
#include <sys/types.h>
#include <sys/event.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <errno.h>
#include <libgen.h>
#include <netinet/in.h>
@SumiTomohiko
SumiTomohiko / fd_passing.c
Created September 24, 2015 06:10
File descriptor passing with sendmsg(2) and recvmsg(2) over Unix domain socket
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@SumiTomohiko
SumiTomohiko / credentials.c
Created September 6, 2015 19:19
Sample code for retrieving unix domain socket's credentials
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>