[parisc-linux] squid pb with glibc-2.3.1 and pthread (pb reproduced now)

Joel Soete jsoe0708@tiscali.be
Wed, 19 Mar 2003 07:53:00 +0100


--========/3E68A12A0000337E/mail.tiscali.be
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit


>
>> So it doesn't yet help here. Never the less I think that I reach to produce
>> enough simple material which Carlos could analyse (in its time) :)
>
>If you send me a test case I can look at it. I don't even see why -l
>pthread would break the previous code :)
>

Don't even more but it is a rare case where I encounter mallopt usage?

Anyway here it is:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

/* getpid(), geteuid()  */
#include <sys/types.h>
#include <unistd.h>

/* setgroups() */
#include <grp.h>

/* mkdir() */
#include <sys/stat.h>
#define MAXPATHLEN 256

/* waitpid() */
#include <sys/wait.h>

/* mallopt() */
#include <malloc.h>

#define SQUID_MAXFD 4096

/* autoconf.h */
/* Define if you have the mallopt function.  */
#define HAVE_MALLOPT 1

/* dlmalloc.c */
#define M_GRAIN   3    /* UNUSED in this malloc */
#define M_MXFAST  1    /* UNUSED in this malloc */

int Squid_MaxFD;		/* SQUID_MAXFD */

FILE *debug_log = NULL;

int
main(int argc, char **argv)
{
    int errcount = 0;
    mode_t oldmask;

    debug_log = stderr;
    if (FD_SETSIZE < Squid_MaxFD)
	Squid_MaxFD = FD_SETSIZE;

    fprintf(stderr, "nb_err: %d\n", errcount);
    /* call mallopt() before anything else */

#ifdef HAVE_MALLOPT
    fprintf(stderr, "  HAVE_MALLOPT \n");
#ifdef M_GRAIN
    /* Round up all sizes to a multiple of this */
    fprintf(stderr, " M_GRAIN seti: %d\n", M_GRAIN);
    mallopt(M_GRAIN, 16);
#endif
#ifdef M_MXFAST
    /* biggest size that is considered a small block */
    fprintf(stderr, " M_MXFAST seti: %d\n", M_MXFAST);
    mallopt(M_MXFAST, 256);
#endif
#ifdef M_NBLKS
    /* allocate this many small blocks at once */
    fprintf(stderr, " M_NBLKS set: %d\n", M_NBLKS);
    mallopt(M_NLBLKS, 32);
#endif
#endif /* HAVE_MALLOPT */

/*
    oldmask = umask(S_IRWXO);
 */

    return 0;
}

compile it with cmd:
gcc -o foo -l pthread foo.c

(the simple gcc -o foo foo.c do not present the pb;
neither gcc -static -o foo -l pthread foo.c [previously it makes a segv])

Thanks for your attention,
    Joel



---------------------------------
Vous surfez avec une ligne classique ?
Economisez jusqu'à 25% avec Tiscali Complete !
Offre spéciale : première année d'abonnement offerte.
... Plus d'info sur http://complete.tiscali.be



--========/3E68A12A0000337E/mail.tiscali.be
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="foo.c"

Ci8qCiAqICRJZDogbWFpbi5jLHYgMS4zNDUuMi40IDIwMDIvMDcvMTQgMTc6MjA6NDkgaG5vIEV4
cCAkCiAqCiAqIERFQlVHOiBzZWN0aW9uIDEgICAgIFN0YXJ0dXAgYW5kIE1haW4gTG9vcAogKiBB
VVRIT1I6IEhhcnZlc3QgRGVyaXZlZAogKgogKiBTUVVJRCBXZWIgUHJveHkgQ2FjaGUgICAgICAg
ICAgaHR0cDovL3d3dy5zcXVpZC1jYWNoZS5vcmcvCiAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICoKICogIFNxdWlkIGlzIHRoZSBy
ZXN1bHQgb2YgZWZmb3J0cyBieSBudW1lcm91cyBpbmRpdmlkdWFscyBmcm9tCiAqICB0aGUgSW50
ZXJuZXQgY29tbXVuaXR5OyBzZWUgdGhlIENPTlRSSUJVVE9SUyBmaWxlIGZvciBmdWxsCiAqICBk
ZXRhaWxzLiAgIE1hbnkgb3JnYW5pemF0aW9ucyBoYXZlIHByb3ZpZGVkIHN1cHBvcnQgZm9yIFNx
dWlkJ3MKICogIGRldmVsb3BtZW50OyBzZWUgdGhlIFNQT05TT1JTIGZpbGUgZm9yIGZ1bGwgZGV0
YWlscy4gIFNxdWlkIGlzCiAqIC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