Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Dec 1996 18:20:51 -0500 (EST)
From:      Brad Parker <brad@american.com>
To:        freebsd-current@FreeBSD.org (FreeBSD-current users)
Subject:   some fixes to libc_r (RELENG_2_2)
Message-ID:  <199612092320.SAA15038@muir-woods.american.com>

next in thread | raw e-mail | index | archive | help

[is anyone else using libc_r?]

I've been trying to use libc_r on RELENG_2_2 (is there a doc anywhere
which describes the tags available and what they *really* mean? I
assume RELENG_2_2 is 2.2-alpha)

Anyway, I found some problems building libc_r;  there where some missing
functions and some makefiles which were out of date.  If I'm out of rev
or there is a better tree please let me know.  I noticed some other missing
functions - I only added the ones I'm using.

Also, building with libc_r is a pain as you need to use -nostlib, include
/usr/lib/crt0.o at the start and "/usr/lib/libgcc.a -lc_r /usr/lib/libgcc.a"
at the end.  A flag to "cc" would be better.


New files:

*** new file: gen/readdir_r.c
#include <sys/param.h>
#include <dirent.h>


/* fake readdir_r using thread-safe readdir */

int
readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
{
    struct dirent *dp;
    if ((dp = readdir(dirp)) == 0)
	return -1;
    *entry = *dp;
    *result = dp;
    return 0;
}

*** new file: uthread/uthread_attr_setdetachstate.c
#include <errno.h>
#ifdef _THREAD_SAFE
#include <pthread.h>
#include "pthread_private.h"

int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
{
	int	ret;
	if (attr == NULL || *attr == NULL) {
		errno = EINVAL;
		ret = -1;
	} else {
		(*attr)->flags = ((*attr)->flags & ~(PTHREAD_DETACHED)) |
			(detachstate & PTHREAD_DETACHED);
		ret = 0;
	}
	return(ret);
}
#endif

Diffs:
*** uthread/Makefile.inc.~1~	Tue Aug 20 04:20:59 1996
--- uthread/Makefile.inc	Mon Dec  9 14:08:39 1996
***************
*** 7,13 ****
--- 7,19 ----
  
  SRCS+= \
  	uthread_accept.c \
+ 	uthread_attr_destroy.c \
+ 	uthread_attr_init.c \
+ 	uthread_attr_setcreatesuspend.c \
  	uthread_attr_setcreatesuspend_np.c \
+ 	uthread_attr_setdetachstate.c \
+ 	uthread_attr_setprio.c \
+ 	uthread_attr_setstacksize.c \
  	uthread_autoinit.cc \
  	uthread_bind.c \
  	uthread_clean.c \
*** sys/Makefile.inc.~1~	Thu Aug 22 00:25:09 1996
--- sys/Makefile.inc	Mon Dec  9 16:39:16 1996
***************
*** 6,12 ****
  
  # modules with non-default implementations on at least one architecture:
  SRCS+=	Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.S reboot.S \
! 	sbrk.S setlogin.S sigpending.S sigprocmask.S sigreturn.S \
  	sigsuspend.S syscall.S __error.c
  
  # glue to provide compatibility between GCC 1.X and 2.X
--- 6,12 ----
  
  # modules with non-default implementations on at least one architecture:
  SRCS+=	Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.S reboot.S \
! 	rfork.S sbrk.S setlogin.S sigpending.S sigprocmask.S sigreturn.S \
  	sigsuspend.S syscall.S __error.c
  
  # glue to provide compatibility between GCC 1.X and 2.X
***************
*** 27,33 ****
  	setpgid.o setpriority.o setregid.o setreuid.o setrlimit.o \
  	setsid.o settimeofday.o setuid.o shmsys.o stat.o statfs.o \
  	swapon.o symlink.o sync.o sysarch.o umask.o unlink.o \
! 	unmount.o utimes.o vadvise.o __syscall.o __sysctl.o
  
  # Syscalls renamed as _thread_sys_{syscall}.
  THREADASM=	accept.o bind.o close.o connect.o dup.o dup2.o \
--- 27,33 ----
  	setpgid.o setpriority.o setregid.o setreuid.o setrlimit.o \
  	setsid.o settimeofday.o setuid.o shmsys.o stat.o statfs.o \
  	swapon.o symlink.o sync.o sysarch.o umask.o unlink.o \
! 	unmount.o utimes.o utrace.o vadvise.o __syscall.o __sysctl.o
  
  # Syscalls renamed as _thread_sys_{syscall}.
  THREADASM=	accept.o bind.o close.o connect.o dup.o dup2.o \
*** gen/Makefile.inc.~1~	Sun Jan 21 19:22:18 1996
--- gen/Makefile.inc	Mon Dec  9 15:24:19 1996
***************
*** 2,8 ****
  #	$Id: Makefile.inc,v 1.1 1996/01/22 00:22:18 julian Exp $
  
  # machine-independent gen sources
! .PATH: ${.CURDIR}/../libc/${MACHINE}/gen ${.CURDIR}/../libc/gen
  
  SRCS+=	alarm.c assert.c clock.c closedir.c config.c confstr.c crypt.c \
  	ctermid.c daemon.c devname.c disklabel.c err.c errlst.c \
--- 2,8 ----
  #	$Id: Makefile.inc,v 1.1 1996/01/22 00:22:18 julian Exp $
  
  # machine-independent gen sources
! .PATH: ${.CURDIR}/../libc/${MACHINE}/gen ${.CURDIR}/../libc/gen ${.CURDIR}/gen
  
  SRCS+=	alarm.c assert.c clock.c closedir.c config.c confstr.c crypt.c \
  	ctermid.c daemon.c devname.c disklabel.c err.c errlst.c \
***************
*** 20,25 ****
--- 20,28 ----
  	telldir.c termios.c time.c times.c timezone.c ttyname.c ttyslot.c \
  	ualarm.c uname.c unvis.c usleep.c utime.c valloc.c vis.c wait.c \
  	wait3.c waitpid.c
+ 
+ #
+ SRCS+=  readdir_r.c
  
  # *rand48 family, from 1.1.5
  SRCS+=	_rand48.c drand48.c erand48.c jrand48.c lcong48.c lrand48.c \
*** yp/Makefile.inc.~1~	Sun Jan 21 19:23:58 1996
--- yp/Makefile.inc	Mon Dec  9 15:59:26 1996
***************
*** 4,8 ****
  # yp sources
  .PATH: ${.CURDIR}/../libc/yp
  
! SRCS+=	xdryp.c yplib.c
  
--- 4,18 ----
  # yp sources
  .PATH: ${.CURDIR}/../libc/yp
  
! SRCS+=		xdryp.c yp_xdr.c yplib.c
! CLEANFILES+=	yp_xdr.c yp.h
! 
! RPCSRC= ${.DESTDIR}/usr/include/rpcsvc/yp.x
! RPCGEN= rpcgen
! 
! yp_xdr.c: ${RPCSRC} yp.h
! 	${RPCGEN} -c -o ${.TARGET} ${RPCSRC}
! 
! yp.h: ${RPCSRC}
! 	${RPCGEN} -h -o ${.TARGET} ${RPCSRC}
  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612092320.SAA15038>