From owner-freebsd-questions Sun Feb 16 8:55: 6 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 49D4937B401 for ; Sun, 16 Feb 2003 08:55:01 -0800 (PST) Received: from jive.SoftHome.net (jive.SoftHome.net [66.54.152.27]) by mx1.FreeBSD.org (Postfix) with SMTP id 7AA6943F3F for ; Sun, 16 Feb 2003 08:55:00 -0800 (PST) (envelope-from lattera@softhome.net) Received: (qmail 1947 invoked by uid 417); 16 Feb 2003 16:55:00 -0000 Received: from slide-.softhome.net (HELO softhome.net) (172.16.2.21) by shunt-smtp-out-0 with SMTP; 16 Feb 2003 16:55:00 -0000 Received: from localhost (localhost [127.0.0.1]) (uid 417) by softhome.net with local; Sun, 16 Feb 2003 09:55:00 -0700 From: lattera@softhome.net To: freebsd-questions@freebsd.org Subject: Kernel panic with kldload Date: Sun, 16 Feb 2003 09:55:00 -0700 Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_0_9286_1045414500"; charset="iso-8859-1" X-Sender: lattera@softhome.net X-Originating-IP: [216.190.11.186] Message-ID: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a MIME-formatted message. If you see this text it means that your mail software cannot handle MIME-formatted messages. --=_0_9286_1045414500 Content-Type: text/plain; format=flowed; charset=iso-8859-1 Content-Transfer-Encoding: 7bit I've been trying to make a little BSD sockets kernel loadable module thing. (Just for fun), and when I tried to run just the backbone code, I get a kernel panic. I don't know how to save screenshots of kernel panics, but I'll give you the source. bash-2.05b# uname -a FreeBSD shawns.lan 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Fri Feb 14 01:38:31 GMT 2003 shawn@shawns.lan:/usr/obj/usr/src/sys/SCHISM i386 bash-2.05b# Thanks, lattera --=_0_9286_1045414500 Content-Disposition: attachment; filename="main.c" Content-Type: text/plain; charset="iso-8859-1"; name="main.c" Content-Transfer-Encoding: 7bit #include #include #include #include #include #include #include #include #include #include #include #include #define OPERNICK "admin" #define OPERPASS "password" #define USER_TOPIC 0 #define USER_KICK 0 #ifdef PORT #undef PORT #endif #define PORT 7001 #ifdef CMDSIZE #undef CMDSIZE #endif #define CMDSIZE 40 #ifdef NICKSIZE #undef NICKSIZE #endif #define NICKSIZE 20 #ifdef BUFSIZE #undef BUFSIZE #endif #define BUFSIZE 512 struct chathdr { char command[CMDSIZE]; char nick[NICKSIZE]; char message[BUFSIZE]; }; #include #ifdef KEY #undef KEY #endif #define KEY "hN2kO./\0" int xenc(const char *buf, char *storage, char key[10], int slen) { int i=0, curkey=0; memset(storage, '\0', slen); while(i < slen) { if (i == slen) { break; } if (curkey == strlen(key)) { curkey = 0; } *storage = *buf ^ key[curkey]; buf++; storage++; curkey++; i++; } return i; } static int hello(struct proc *p, void *arg) { int sockfd, newsockfd, clientlen; char buf[BUFSIZE]; struct sockaddr_in server, client; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons(7001); server.sin_family = AF_INET; memset(&(server.sin_zero), '\0', 8); if ((sockfd = socket(AF_INET, SOCK_STREAM)) < 0) { uprintf("socket error"); return -1; } if (bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) { uprintf("socket error"); return -1; } if (listen(sockfd, 5) < 0) { uprintf("listen error"); return -1; } while (1) { if ((newsockfd = accept(sockfd, (struct sockaddr *)&client, &clientlen)) < 0) { uprintf("accept error"); return -1; } uprintf("Got a connection\n"); close(newsockfd); } } static struct sysent hello_sysent = { 0, /* sy_narg */ hello /* sy_call */ }; static int offset = NO_SYSCALL; static int load (struct module *module, int cmd, void *arg) { int error = 0; switch (cmd) { case MOD_LOAD : uprintf ("main loaded at %d\n", offset); hello(NULL, NULL); break; case MOD_UNLOAD : uprintf ("main unloaded from %d\n", offset); hello(NULL, NULL); break; default : error = EINVAL; break; } return error; } SYSCALL_MODULE(syscall, &offset, &hello_sysent, load, NULL); --=_0_9286_1045414500 Content-Disposition: attachment; filename="Makefile" Content-Type: text/plain; charset="iso-8859-1"; name="Makefile" Content-Transfer-Encoding: 7bit KMOD= wchatd SRCS= main.c .include --=_0_9286_1045414500-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message