[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /dev/log



In article <[🔎] 3B8D4AB9.7374CBA9@seranoa.com>,
Andrew Dixon  <andrew.dixon@seranoa.com> wrote:
>Hi All,
>Could anyone enlighten me as to what type of file /dev/log is?  ls -l
>gives the following:
>
>	dixon@rowling:/usr/include/linux$  ls -l /dev/log
>	srw-rw-rw-    1 root     root            0 Aug 29 08:54 /dev/log
>        ^
>Specifically I was wondering what the leading "s" means.  

It's a UNIX socket. It's created by syslogd, it listens on it, and
program connect through it to log to syslog. Usually they use the
standard syslog() call provided by libc to do the actual work.

>Also, how would I create a file of this type?

	#include <sys/types.h>
	#include <sys/socket.h>
	#include <sys/un.h>

	int s;
	struct sockaddr_un sun;

	s = socket(AF_UNIX, SOCK_STREAM, 0);
	sun.sun_family = AF_UNIX;
	strcpy(sun.sun_path, "/tmp/unixsocket");
	if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
		perror(sun.sun_path);
		exit(1);
	}

>P.S. Please cc me as I'm not on the list.

Excellent. I'm posting this through a news-to-mail gateway from
which it is almost impossible to add Cc's. So sorry, No.
Besides, a mailinglist is not a one-way helpdesk. It's a forum.

Mike.
-- 
"Answering above the the original message is called top posting. Sometimes
 also called the Jeopardy style. Usenet is Q & A not A & Q." -- Bob Gootee



Reply to: