Thread View: comp.sys.next.sysadmin
2 messages
2 total messages
Started by Shane M Zatezalo
Mon, 31 Aug 1992 15:26
NNTP Compiling - type mismatch in initialization
Author: Shane M Zatezalo
Date: Mon, 31 Aug 1992 15:26
Date: Mon, 31 Aug 1992 15:26
77 lines
2312 bytes
2312 bytes
I'm trying to compile NNTP, and when the compiler is doing the file "misc.c"
it bombs out with this:
(btw... thanks to Tim Gurbick for helping me with my first problem!)
>make server
cd server; make "LIBS=-ldbm" "CFLAGS=-O "
cc -O -c misc.c
misc.c:955: type mismatch in initialization
misc.c:955: type mismatch in initialization
Here is the code from the file where it seems to be boming: (approximately)
/*
** GETLA -- get the current load average
**
** This code stolen from la.c. (And subsequently stolen from sendmail,
** conf.c for nntpd.)
**
** Parameters:
** none.
**
** Returns:
** The current load average as an integer.
**
** Side Effects:
** none.
*/
#ifdef USG
getla()
{
return(0);
}
#else
#include <nlist.h>
#include <sys/ioctl.h>
struct nlist Nl[] =
{
{ "_avenrun" },
#define X_AVENRUN 0
{ 0 },
};
getla()
{
static int kmem = -1;
# ifdef FSCALE
long avenrun[3];
# else
double avenrun[3];
# endif
extern off_t lseek();
if (kmem < 0)
{
kmem = open("/dev/kmem", 0, 0);
if (kmem < 0)
return (-1);
(void) ioctl(kmem, (int) FIOCLEX, (char *) 0);
nlist("/vmunix", Nl);
if (Nl[0].n_type == 0)
return (-1);
}
any ideas?
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
: Shane M. Zatezalo : i-net> szatezal@magnus.acs.ohio-state.edu :
: CIS Eng Ohio State : NeXTMail> shane@kiwi.shws.ohio-state.edu :
:GS:::: Apple II forever!! ::::::GO BUCKS!::::::: Play Lacrosse! :::::::GS:
Re: NNTP Compiling - type mismatch in initialization
Author: Eric P. Scott
Date: Tue, 01 Sep 1992 10:26
Date: Tue, 01 Sep 1992 10:26
46 lines
1901 bytes
1901 bytes
[comp.sys.next.sysadmin is an inappropriate newsgroup for this
question; followups have been redirected to
comp.sys.next.programmer]
In article <1992Aug31.152659.15528@magnus.acs.ohio-state.edu>
szatezal@magnus.acs.ohio-state.edu (Shane M Zatezalo)
writes:
>I'm trying to compile NNTP, and when the compiler is doing the file "misc.c"
>it bombs out with this:
>misc.c:955: type mismatch in initialization
>struct nlist Nl[] =
>{
> { "_avenrun" },
(1) You need to add another layer of braces to nlist vectors
before they'll compile, e.g.
{ { "_avenrun" } },
[I suggest using #if[n]def NeXT conditionals as warranted]
(2) Mining load average out of kmem is the WRONG approach on the
NeXT. A better way is to use the table() call, which also
doesn't require exceptional access privileges. This example
ought to be in the programmers' FAQ; the question seems to come
up about every other month.
#include <stdio.h>
#include <sys/types.h>
#include <sys/table.h>
main() {
struct tbl_loadavg avg;
(void)table(TBL_LOADAVG, 0, (caddr_t)&avg, 1, sizeof avg);
(void)printf("load average:%5.2f,%5.2f,%5.2f\n",
(double)avg.tl_avenrun[0]/(double)avg.tl_lscale,
(double)avg.tl_avenrun[1]/(double)avg.tl_lscale,
(double)avg.tl_avenrun[2]/(double)avg.tl_lscale);
exit(0);
}
Valid for 1.0
Valid for 2.0
Not verified for 3.0
-=EPS=-
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads