[PATCH] [FreeBSD 13] Modified version of get_freebsd_corepath()

Timur I. Bakeyev timur at com.bat.ru
Sun Jun 7 13:51:31 GMT 2009


Release of Samba 3.4.0pre2 introduced new function to get the location,
where core file will be actually dumped. In FreeBSD this os controlled
by kernel tunable and, in general, not necessary it is a CWD.

There is a function in source3/lib/fault.c called get_freebsd_corepath()
that tries to analyse that tunable and present it to the end user. There
are two problems with it.

One, simple, is that that function uses sysctlbyname() which is defined
in sys/sysctl.h. So, this header HAS to be included. That affects both
compilation of param/loadparam.c and lib/fault.c. Basically, they failed
to compile. I suspect, this is addressed in the git, as it's a showstopper
for FreeBSD compilation, but just in case - little fix for it.

The next problem is with the get_freebsd_corepath() itself. Kernel tunable
can use expandable variables %N, %P and %U to reflect name of the program,
it's PID and UID. So, if we want to use that kernel tunable, we have to
do expansion ourselves.

The reimplementation of the get_freebsd_corepath() does the expansion. I
hope, that I did talloc_*() magic right, as I have no experience with it.
Please, fix it accordingly, if it's wrong...

With regards,
Timur Bakeyev.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-param__loadparam.c
Type: text/x-csrc
Size: 310 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090607/035b4274/patch-param__loadparam.bin
-------------- next part --------------
--- ./source3/configure.in.orig	2009-04-30 07:53:01.000000000 +0000
+++ ./source3/configure.in	2009-06-01 11:49:40.000000000 +0000
@@ -692,7 +682,7 @@
 AC_CHECK_HEADERS(unistd.h grp.h sys/id.h memory.h alloca.h)
 AC_CHECK_HEADERS(limits.h float.h pthread.h libintl.h)
 AC_CHECK_HEADERS(rpc/rpc.h rpcsvc/nis.h rpcsvc/ypclnt.h)
-AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h)
+AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h sys/sysctl.h)
 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h)
 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-source3__lib__fault.c
Type: text/x-csrc
Size: 4323 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090607/035b4274/patch-source3__lib__fault.bin


More information about the samba-technical mailing list