Re: Compile squid1.2beta15 with pthreads/libc_r on FreeBSD

From: Arjan de Vet <Arjan.deVet@dont-contact.us>
Date: Sun, 22 Feb 1998 16:37:19 +0100 (CET)

In article <34EF9C3E.6923E7B5@ver1.telmex.net.mx> you write:

>Mario Sergio Fujikawa Ferreira wrote:
>>
>> Dear Ed,
>>
>> > What do I need to compile squid1.2beta15 --enable-async-io
>> > under FreeBSD Current.
>> >
>> > I haven't been able to compile it. It dies en aiops.c.
>>
>> The source file aiops.c requires pthreads functions.
>> I am not sure about current, yet under stable and release:
>> You need to compile FreeBSD libc_r that supports the MIT pthreads
>> standard. Make sure you have the libraries sources installed.
>> cd /usr/src/lib/libc_r && make depend && make && make install
>>
>> There you have it. Try configuring again.
>>
>That worked fine and now I have the libc_r libraries. Thanks alot, I
>never
>realized that they weren't built automatically with a make world.

You can define WANT_LIBC_R=yes in /etc/make.conf

>That isn't my only problem. It looks like there are some include files
>that don't exist or aren't being found. I'll keep at it. Thanks Again.

I also did some experiments with getting squid 1.2beta15 to compile on
FreeBSD-stable. Indeed some include stuff is missing. I found an extra
pthread_private.h file in /usr/src/lib/libc_r/uthread which contains these
missing things. However just #include'ing it gave some strange errors, so I
made a local pthread_local.h containing just the stuff I needed:

pthread_local.h:

    struct sched_param {
            int sched_priority;
            void *no_data;
    };

    /*
     * Scheduling definitions.
     */
    enum schedparam_policy {
            SCHED_RR,
            SCHED_IO,
            SCHED_FIFO,
            SCHED_OTHER
    };

The following patch was needed to get it to compile:

--- ../../squid-1.2.beta15/src/aiops.c Mon Feb 2 22:16:16 1998
+++ aiops.c Sun Feb 22 16:28:32 1998
@@ -1,6 +1,6 @@
 
 /*
- * $Id: aiops.c,v 1.7 1998/02/02 21:16:16 wessels Exp $
+ * $Id: aiops.c,v 1.8 1998/02/17 23:05:38 wessels Exp $
  *
  * DEBUG: section 43 AIOPS
  * AUTHOR: Stewart Forster <slf@connect.com.au>
@@ -36,6 +36,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <pthread.h>
+#include "pthread_local.h"
 #include <errno.h>
 #include <dirent.h>
 #include <signal.h>
@@ -141,12 +142,14 @@
         return;
 
     pthread_attr_init(&globattr);
+#ifndef __FreeBSD__
     pthread_attr_setscope(&globattr, PTHREAD_SCOPE_SYSTEM);
     globsched.sched_priority = 1;
     self = pthread_self();
     pthread_setschedparam(self, SCHED_OTHER, &globsched);
     globsched.sched_priority = 2;
     pthread_attr_setschedparam(&globattr, &globsched);
+#endif
 
     /* Create threads and get them to sit in their wait loop */
 
This makes it compile, but not working yet.

I'm Cc:-ing freebsd-hackers (so be careful with replies), maybe someone
there knows better ways to get Squid 1.2beta to compile with libc_r. I
recently saw some other applications mentioned over there which do work
with libc_r successfully.

There's also work being done on async IO in the FreeBSD kernel (3.0),
haven't tried that yet.

Arjan
Received on Sun Feb 22 1998 - 07:42:50 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:38:56 MST