Subject: pkg/10077: unproven-pthreads users cannot set h_errno
To: None <>
From: Andrew Brown <>
List: netbsd-bugs
Date: 05/08/2000 15:17:13
>Number:         10077
>Category:       pkg
>Synopsis:       unproven-pthreads users cannot set h_errno, only read it
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon May 08 15:18:00 PDT 2000
>Originator:     TheMan
>Release:        1.4X of 20000504
System: NetBSD ebola 1.4X NetBSD 1.4X (RESTON) #7: Mon May 8 16:42:28 EDT 2000 andrew@ebola:/usr/src/sys/arch/i386/compile/RESTON i386
	(haven't updated for a few days)


	unproven-pthreads package's definitions of h_errno

# grep h_errno /usr/pkg/pthreads/include/*.h
/usr/pkg/pthreads/include/netdb.h:extern int h_errno;
/usr/pkg/pthreads/include/netdb.h: * (left in extern int h_errno).
/usr/pkg/pthreads/include/resolv.h:#define h_errno (_res_get_error())

	conflict, and are incompatible with the man page's
	(man gethostbyname) definition of h_errno

# grep h_errno /usr/include/*.h
/usr/include/netdb.h:extern int h_errno;
/usr/include/netdb.h: * (left in extern int h_errno).

	thus leaving the actual behavior of such an application a
	mystery to me, but definitely rendering h_errno as something
	that can't be used as an lvalue.


	decide to play with sendmail's filtering api.  read docs.
	attempt to build fresh sendmail outside of tree.

# cd /usr/local/src/sendmail-8.10.1
# cat > devtools/Site/site.config.m4
dnl Milter
APPENDDEF(`conf_sendmail_ENVDEF', `-D_FFR_MILTER=1 -I/usr/pkg/pthreads/include')
APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER=1 -I/usr/pkg/pthreads/include') 
# make
cc -O -I. -I../../include -DNEWDB -DNIS -DMAP_REGEX  -DNETISO -D_FFR_MILTER=1 -I/usr/pkg/pthreads/include   -c daemon.c
daemon.c: In function `makeconnection':
daemon.c:1554: invalid lvalue in assignment
daemon.c: In function `host_map_lookup':
daemon.c:2795: invalid lvalue in assignment
# more +1554 sendmail/daemon.c
        h_errno = 0;


	dunno.  i assume *we* could come up with a patch to the
	unproven-pthreads package to work this properly (i think
	h_errno should be a function that returns a pointer to
	an int, although i don't know how to make it non-volatile
	off the top of my head), but really the threads package
	shouldn't be violating the api like that.  imo.