aboutsummaryrefslogtreecommitdiff
path: root/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/write_devlog.c
blob: 103915f9504e32030ee317f30c1eec5a0cfdb503 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include "str_defs.h"

void write_devlog(void *buf, int len)  /*EXTRACT_INCL*/{
  struct sockaddr_un sa;
  int fd= socket(AF_UNIX, SOCK_DGRAM, 0);
  if( fd == -1) return;
  sa.sun_family = AF_UNIX;
  str_copynz(sa.sun_path, "/dev/log", 10);
  if (connect(fd, (struct sockaddr*)&sa, sizeof sa))
    { close(fd); return; }
  send(fd, buf, len, 0);
  close(fd);
}