Date: Mon, 24 Nov 2003 00:11:35 +0100 From: Ronald Klop <ronald-freebsd3@klop.yi.org> To: FreeBSD Current <freebsd-current@freebsd.org> Subject: repeatable panic with truss Message-ID: <opry35dlxy87l8rq@outgoing.local>
next in thread | raw e-mail | index | archive | help
------------kRUvObaPkXInc1EH4xKhmp
Content-Type: text/plain; format=flowed; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hello,
While running the next commands on the attached program I get a panic
everytime.
gcc rfk-smtpd.c
truss ./a.out cat
<ctrl-c>
--panic--
Running 5.1-CURRENT from today. I did a 'make world' in a clean /usr/obj
dir.
System P-II 400Mhz UP, 256 MB, IDE, no acpi enabled.
I hope somebody can repeat this and maybe it helps getting FreeBSD more
and more stable. (Or maybe it's a known issue.)
Ronald.
PS: I don't have a debugger enabled kernel, so can't give any more output
for now. But I'm willing to make one if it's needed.
--
Ronald Klop
Amsterdam, The Netherlands
------------kRUvObaPkXInc1EH4xKhmp
Content-Disposition: attachment; filename=rfk-smtpd.c
Content-Type: application/octet-stream; name=rfk-smtpd.c
Content-Transfer-Encoding: 8bit
#include <stdio.h>
#include <string.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#define TRUE (1)
#define FALSE (0)
#define BUF_SIZE 80
void showUsage() {
fprintf(stderr, "Usage: rfk-smtpd <command> [<command-args>]*\n");
}
int process(char *buf, char *tmp) {
if (strncmp(buf, "rcpt", 4) == 0) {
strcpy(tmp, "553 Recipient is unknown.\r\n");
return FALSE;
}
return TRUE;
}
int doIt(char* prog) {
FILE *smtpd;
char buf[BUF_SIZE + 1];
fd_set fds;
int go = TRUE;
int error = FALSE;
smtpd = popen(prog, "r+");
if (smtpd == NULL) {
fprintf(stderr, "Cannot create process '%s'\n", prog);
return FALSE;
}
while(go) {
FD_ZERO(&fds);
FD_SET(fileno(stdin), &fds);
FD_SET(fileno(smtpd), &fds);
int res = select(FD_SETSIZE, &fds, NULL, NULL, NULL);
if (res == -1) {
fprintf(stderr, "Select: error.\n");
error = TRUE;
go = FALSE;
}
if (res == 0) {
fprintf(stderr, "Select: timeout.\n");
}
while(!error && res--) {
size_t nr;
if (FD_ISSET(fileno(stdin), &fds)) {
nr = read(fileno(stdin), buf, BUF_SIZE);
if (nr <= 0) {
error = TRUE;
go = FALSE;
} else {
char tmp[BUF_SIZE + 1];
int ok;
buf[nr] = '\0';
ok = process(buf, tmp);
if (ok) {
fprintf(smtpd, "%s", buf);
fflush(smtpd);
} else {
fprintf(stdout, "%s", tmp);
fflush(stdout);
}
}
}
if (FD_ISSET(fileno(smtpd), &fds)) {
nr = read(fileno(smtpd), buf, BUF_SIZE);
if (nr <= 0) {
error = TRUE;
go = FALSE;
} else {
buf[nr] = '\0';
fprintf(stdout, "%s", buf);
fflush(stdout);
}
}
}
}
pclose(smtpd);
return !error;
}
int main(int argc, char **argv) {
char prog[1024];
int error;
int i, ind;
if (argc < 2) {
showUsage();
return 1;
}
ind = 0;
strcpy(&prog[ind], argv[1]);
ind = strlen(argv[1]);
for(i = 2; i < argc; i++) {
prog[ind++] = ' ';
strcpy(&prog[ind], argv[i]);
ind += strlen(argv[i]);
}
error = !doIt(prog);
return error;
}
------------kRUvObaPkXInc1EH4xKhmp--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?opry35dlxy87l8rq>
