Subject: Fwd: Re: socklog-unix problem, on netbsd
To: None <tech-kern@netbsd.org>
From: George Georgalis <george@galis.org>
List: tech-kern
Date: 01/23/2006 11:14:18
Below is an issue with using an alternate to syslogd.  I'm not
sure exactly where this bug is, but I have a workaround.  I'll
followup with a solution to my issue...

Seems like there is a problem with direct vs parameter reference
to the log socket. Some code must be out of sync -- and the
problem exposed by moving /dev/log to /var/run/log (or vice
versa).

As an aside, I prefer the /dev/log over /var/run/log location.
Not sure why would use the latter.

// George


----- Forwarded message from George Georgalis <george@galis.org> -----

Date: Sat, 21 Jan 2006 11:13:21 -0500
Message-ID: <20060121161321.GA20500@sta.duo>
From: George Georgalis <george@galis.org>
To: misc@list.smarden.org
Subject: Re: socklog-unix problem, on netbsd

BTW - the ktruss when syslogd is running is below...

On Sat, Jan 21, 2006 at 12:16:10AM -0500, George Georgalis wrote:
>I've narrowed this as much as I can, but I cannot
>determine why my socklog-unix process is not working
>under NetBSD 3.0. A few times before I've give up at
>this point... socklog-klog works fine.
>
>A standard install with a couple minor attempts to fix,
>
>head  /var/service/socklog-unix/run  /var/service/socklog-unix/log/run 
>==> /var/service/socklog-unix/run <==
>#!/bin/sh
>exec 2>&1
>exec socklog
>exec socklog unix /dev/log
>exec chpst -Unobody socklog unix /dev/log
>
>==> /var/service/socklog-unix/log/run <==
>#!/bin/sh
>#exec chpst -ulog svlogd \
>exec svlogd -tt \
>  main/main main/auth main/cron main/daemon main/debug main/ftp \
>  main/kern main/local main/mail main/news main/syslog main/user
>
>
>it starts okay...
>
># cat /var/log/socklog/main/current                                                   
>listening on /dev/log, gid=39, uid=32767, starting.
>listening on /dev/log, starting.
>listening on /dev/log, starting.
>2006-01-21_00:07:35.45559 listening on /dev/log, starting.
>2006-01-21_00:15:34.64792 listening on /dev/log, starting.
>
>But it won't log anything. /dev/log does indeed seem
>the socket syslogd uses, and syslogd is defiantly
>stopped (though it does work when running). Below is
>the output of "truss logger hello" -- any ideas?
>
>// George
>
>
># ktruss logger hello
>  5343 ktruss   emul(netbsd)
>  5343 ktruss   fcntl(0x4, 0x3, 0)                 = 1
>  5343 ktruss   fcntl(0x4, 0x4, 0x1)               = 0
>  5343 ktruss   execve("/sbin/logger", 0xbfbfe9d0, 0xbfbfe9dc) Err#2 ENOENT
>  5343 ktruss   execve("/usr/sbin/logger", 0xbfbfe9d0, 0xbfbfe9dc) Err#2 ENOENT
>  5343 ktruss   execve("/bin/logger", 0xbfbfe9d0, 0xbfbfe9dc) Err#2 ENOENT
>  5343 logger   emul(netbsd)
>  5343 logger   execve("/usr/bin/logger", 0xbfbfe9d0, 0xbfbfe9dc) JUSTRETURN
>  5343 logger   mmap(0, 0x8000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbdbeb000
>  5343 logger   open("/etc/ld.so.conf", 0, 0)      = 3
>  5343 logger   __fstat13(0x3, 0xbfbfe8d8)         = 0
>  5343 logger   mmap(0, 0x37, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbdbea000
>  5343 logger   close(0x3)                         = 0
>  5343 logger   munmap(0xbdbea000, 0x37)           = 0
>  5343 logger   open("/usr/lib/libc.so.12", 0, 0)  = 3
>  5343 logger   __fstat13(0x3, 0xbfbfe5d8)         = 0
>  5343 logger   mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbdbea000
>  5343 logger   munmap(0xbdbea000, 0x1000)         = 0
>  5343 logger   mmap(0, 0xc2000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbdb29000
>  5343 logger   mmap(0xbdbd5000, 0x7000, 0x3, 0x12, 0x3, 0, 0xab000, 0) = 0xbdbd5000
>  5343 logger   mmap(0xbdbdc000, 0xf000, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbdbdc000
>  5343 logger   close(0x3)                         = 0
>  5343 logger   __getlogin(0xbdbe0cac, 0x10)       = 0
>  5343 logger   close(0x1)                         = 0
>  5343 logger   gettimeofday(0xbfbfd848, 0)        = 0
>  5343 logger   __sysctl(0xbfbfd728, 0x2, 0xbfbfd720, 0xbfbfd724, 0, 0) = 0
>  5343 logger   readlink("/etc/malloc.conf", 0xbfbfd7a0, 0x3f) Err#2 ENOENT
>  5343 logger   mmap(0, 0x1000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbdb28000
>  5343 logger   break(0x804a4f4)                   = 0
>  5343 logger   break(0x804b4f4)                   = 0
>  5343 logger   break(0x804c000)                   = 0
>  5343 logger   break(0x804e000)                   = 0
>  5343 logger   access("/etc/localtime", 0x4)      = 0
>  5343 logger   open("/etc/localtime", 0, 0)       = 1
>  5343 logger   read(0x1, 0xbfbfb4f0, 0x1f08)      = 73
>       "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\^B\0\0\0\^B\0\0\0\0\0\0\0\^A\0\0\0\^B"
>  5343 logger   close(0x1)                         = 0
>  5343 logger   socket(0x1, 0x2, 0)                = 1
>  5343 logger   fcntl(0x1, 0x2, 0x1)               = 0
>  5343 logger   connect(0x1, 0xbdbe9420, 0xe)      Err#2 ENOENT
>  5343 logger   close(0x1)                         = 0
>  5343 logger   sendto(0xffffffff, 0xbfbfdcc0, 0x1f, 0, 0, 0) Err#9 EBADF
>  5343 logger   close(0xffffffff)                  Err#9 EBADF
>  5343 logger   socket(0x1, 0x2, 0)                = 1
>  5343 logger   fcntl(0x1, 0x2, 0x1)               = 0
>  5343 logger   connect(0x1, 0xbdbe9420, 0xe)      Err#2 ENOENT
>  5343 logger   close(0x1)                         = 0
>  5343 logger   sendto(0xffffffff, 0xbfbfdcc0, 0x1f, 0, 0, 0) Err#9 EBADF
>  5343 logger   close(0xffffffff)                  Err#9 EBADF
>  5343 logger   exit(0)

with socklog-klog stopped and syslogd running...

# ktruss logger hello
  1339 ktruss   emul(netbsd)
  1339 ktruss   fcntl(0x4, 0x3, 0)                 = 1
  1339 ktruss   fcntl(0x4, 0x4, 0x1)               = 0
  1339 logger   emul(netbsd)
  1339 logger   execve("/usr/bin/logger", 0xbfbfee54, 0xbfbfee60) JUSTRETURN
  1339 logger   mmap(0, 0x8000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbdbeb000
  1339 logger   open("/etc/ld.so.conf", 0, 0)      = 3
  1339 logger   __fstat13(0x3, 0xbfbfed58)         = 0
  1339 logger   mmap(0, 0x37, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbdbea000
  1339 logger   close(0x3)                         = 0
  1339 logger   munmap(0xbdbea000, 0x37)           = 0
  1339 logger   open("/usr/lib/libc.so.12", 0, 0)  = 3
  1339 logger   __fstat13(0x3, 0xbfbfea58)         = 0
  1339 logger   mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbdbea000
  1339 logger   munmap(0xbdbea000, 0x1000)         = 0
  1339 logger   mmap(0, 0xc2000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbdb29000
  1339 logger   mmap(0xbdbd5000, 0x7000, 0x3, 0x12, 0x3, 0, 0xab000, 0) = 0xbdbd5000
  1339 logger   mmap(0xbdbdc000, 0xf000, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbdbdc000
  1339 logger   close(0x3)                         = 0
  1339 logger   __getlogin(0xbdbe0cac, 0x10)       = 0
  1339 logger   close(0x1)                         = 0
  1339 logger   gettimeofday(0xbfbfdcc8, 0)        = 0
  1339 logger   __sysctl(0xbfbfdba8, 0x2, 0xbfbfdba0, 0xbfbfdba4, 0, 0) = 0
  1339 logger   readlink("/etc/malloc.conf", 0xbfbfdc20, 0x3f) Err#2 ENOENT
  1339 logger   mmap(0, 0x1000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbdb28000
  1339 logger   break(0x804a4f4)                   = 0
  1339 logger   break(0x804b4f4)                   = 0
  1339 logger   break(0x804c000)                   = 0
  1339 logger   break(0x804e000)                   = 0
  1339 logger   access("/etc/localtime", 0x4)      = 0
  1339 logger   open("/etc/localtime", 0, 0)       = 1
  1339 logger   read(0x1, 0xbfbfb970, 0x1f08)      = 73
       "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\^B\0\0\0\^B\0\0\0\0\0\0\0"
  1339 logger   close(0x1)                         = 0
  1339 logger   socket(0x1, 0x2, 0)                = 1
  1339 logger   fcntl(0x1, 0x2, 0x1)               = 0
  1339 logger   connect(0x1, 0xbdbe9420, 0xe)      = 0
  1339 logger   sendto(0x1, 0xbfbfe140, 0x1f, 0, 0, 0) = 31
       "<13>Jan 21 06:33:43 root: hello"
  1339 logger   exit(0)


// George

-- 
George Georgalis, systems architect, administrator <IXOYE><
http://galis.org/ cell:646-331-2027 mailto:george@galis.org


----- End forwarded message -----

-- 
George Georgalis, systems architect, administrator <IXOYE><
http://galis.org/ cell:646-331-2027 mailto:george@galis.org