Mailing List Archive

util.c:796: `LOCK_SH' undeclared (first use this function)
I just downlaoded apache-pre.tar.Z and tried to build it
on my HP UX 712/80 (if I had the chance I'd dump the HP in
favour of a Sun)


gcc -c -DXBITHACK -O -I/usr/include -DNSCACHE -DHPUX util.c
util.c: In function `search_nameserver_cache':
util.c:796: `LOCK_SH' undeclared (first use this function)
util.c:796: (Each undeclared identifier is reported only once
util.c:796: for each function it appears in.)
util.c:808: `LOCK_UN' undeclared (first use this function)
util.c: In function `write_nameserver_cache':
util.c:829: `LOCK_EX' undeclared (first use this function)
util.c:860: `LOCK_UN' undeclared (first use this function)
*** Error code 1

If I explicitly add (taken from a SunOs system. A bad idea I suspect)

#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
#define LOCK_NB 4 /* don't block when locking */
#define LOCK_UN 8 /* unlock */

I then end up with

gcc -o httpd http_config.o httpd.o http_request.o util.o http_dir.o http_alias.o http_log.o http_mime.o http_access.o http_auth.o http_get.o http_post.o http_script.o http_include.o rfc931.o http_put.o http_delete.o stream.o
/bin/ld: Unsatisfied symbols:
flock (code)
collect: ld returned 1 exit status
*** Error code 1


Any suggestions ?


rob h
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
> I just downlaoded apache-pre.tar.Z and tried to build it
> on my HP UX 712/80 (if I had the chance I'd dump the HP in
> favour of a Sun)
>
> gcc -c -DXBITHACK -O -I/usr/include -DNSCACHE -DHPUX util.c

I'd take the -DNSCACHE out. It will take quite a bit of effort to
rewrite that code in a reasonably portable fashion.
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
>
> > I just downlaoded apache-pre.tar.Z and tried to build it
> > on my HP UX 712/80 (if I had the chance I'd dump the HP in
> > favour of a Sun)
> >
> > gcc -c -DXBITHACK -O -I/usr/include -DNSCACHE -DHPUX util.c
>
> I'd take the -DNSCACHE out. It will take quite a bit of effort to
> rewrite that code in a reasonably portable fashion.

Ok, that's better.

If anyone is interested, the only error/warning this time was..

stream.c: In function `nread':
stream.c:190: warning: passing arg 2 of `select' from incompatible pointer type


rob h
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
Date: Mon, 13 Mar 1995 11:31:47 -0600
From: Frank Peters <fwp@jester.cc.msstate.edu>

I'd take the -DNSCACHE out. It will take quite a bit of effort to
rewrite that code in a reasonably portable fashion.

Not a *whole* lot, considering that it only took me a couple of hours
to write in the first place, but I do see the point. (That's why the
#ifdefs are there in the first place).

The really unportable piece of the code, BTW (and the thing that was
tripping up Rob Hartill) is the use of the BSDish flock(), instead of
the SYSVish fcntl(... F_SETLK ...) --- the latter is far more widely
supported.

Fixing this would make the code about as portable as mmap(), which is
supported on at least HP-UX, SunOS, Solaris, Linux, and IRIX. Are
there any significant systems on which shared memory is supported, but
only through the SYSV IPC mechanism?

(NB, there are systems which don't support shared memory at all, and
on those systems, NSCACHE is just about hopeless).

rst
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
Can you send me the output of a "uname -a" of the system? It must
be a pretty old OS :-) It should be safe to remove the locking, but I
sure hope you DMB library does safe updates (places data before
setting pointers) :-/.

Cliff

On Mar 13, 10:20am, Rob Hartill wrote:
} Subject: util.c:796: `LOCK_SH' undeclared (first use this function)
}
} I just downlaoded apache-pre.tar.Z and tried to build it
} on my HP UX 712/80 (if I had the chance I'd dump the HP in
} favour of a Sun)
.....
} gcc -o httpd http_config.o httpd.o http_request.o util.o http_dir.o http_alias.o http_log.o http_mime.o http_access.o http_auth.o http_get.o http_post.o http_script.o http_include.o rfc931.o http_put.o http_delete.o stream.o
} /bin/ld: Unsatisfied symbols:
} flock (code)
} collect: ld returned 1 exit status
} *** Error code 1
}
}
} Any suggestions ?
}
}
} rob h
}-- End of excerpt from Rob Hartill
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
No...but there are systems (like BSDI) where mmap is there and
does not work right :-(. If memory falls short, you get zero filled
pages instead of pages form the backing store.

Cliff

}
} Fixing this would make the code about as portable as mmap(), which is
} supported on at least HP-UX, SunOS, Solaris, Linux, and IRIX. Are
} there any significant systems on which shared memory is supported, but
} only through the SYSV IPC mechanism?
}-- End of excerpt from Robert S. Thau
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
>
> Can you send me the output of a "uname -a" of the system? It must
> be a pretty old OS :-) It should be safe to remove the locking, but I
> sure hope you DMB library does safe updates (places data before
> setting pointers) :-/.
>

It's not old, its just crap. I think Nicolas Pioch summed it up
nicely.. replacing the '-' with a 's' in HP-UX.

HP-UX ooo A.09.05 A 9000/712 2008941368 two-user license
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
From: cliffs@steam.com (Cliff Skolnick)
Date: Mon, 13 Mar 1995 19:33:22 PST
Precedence: bulk
Reply-To: new-httpd@hyperreal.com

No...but there are systems (like BSDI) where mmap is there and
does not work right :-(. If memory falls short, you get zero filled
pages instead of pages form the backing store.

Cliff

OK, then, let me rephrase the question --- are there systems where
there's a shared memory mechanism that works, and mmap() doesn't?

rst
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
>
> Rob wrote:
> >If anyone is interested, the only error/warning this time was..
> >stream.c: In function `nread':
> >stream.c:190: warning: passing arg 2 of `select' from incompatible pointer type
>
> Hmm, that shouldn't happen. How is select() declared under HP/UX? What synopsis
> does the man page give?
>

man page ?, what man page ? :-)

I think the boss was on a tight budget when he bought this system.
We'll be getting a bigger, faster HP soon (it'll just annoy me more quickly).
Hopefully we can have all the mod-cons on that one ;-)

rob.
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
Rob wrote:
>If anyone is interested, the only error/warning this time was..
>stream.c: In function `nread':
>stream.c:190: warning: passing arg 2 of `select' from incompatible pointer type

Hmm, that shouldn't happen. How is select() declared under HP/UX? What synopsis
does the man page give?

David.
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
FWIW, here's the declaration I get from "man select" on the local
HP-UX box:

#include <time.h>

int select(
size_t nfds,
int *readfds,
int *writefds,
int *exceptfds,
const struct timeval *timeout
);

rst
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
On Mar 14, 8:48am, Robert S. Thau wrote:
} OK, then, let me rephrase the question --- are there systems where
} there's a shared memory mechanism that works, and mmap() doesn't?
}
} rst

Yes...Linux used to fall into this catagory about 1 years ago...it
may be fixed now though.

Cliff
Re: util.c:796: `LOCK_SH' undeclared (first use this function) [ In reply to ]
rst wrote:
>FWIW, here's the declaration I get from "man select" on the local
>HP-UX box:
>
> #include <time.h>
>
> int select(
> size_t nfds,
> int *readfds,
> int *writefds,
> int *exceptfds,
> const struct timeval *timeout
> );

Solaris has
#include <sys/time.h>
#include <sys/types.h>

int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);

Presumably hp/ux actually has an fd_set type, otherwise the program wouldn't
have compiled. I think the warning can be ignored.

David.