From owner-freebsd-current Tue Mar 7 03:29:37 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id DAA13058 for current-outgoing; Tue, 7 Mar 1995 03:29:37 -0800 Received: from sbstark.cs.sunysb.edu (sbstark.cs.sunysb.edu [130.245.1.47]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id DAA13052 for ; Tue, 7 Mar 1995 03:29:36 -0800 Received: from starkhome.UUCP (root@localhost) by sbstark.cs.sunysb.edu (8.6.9/8.6.9) with UUCP id GAA19893 for current@freebsd.org; Tue, 7 Mar 1995 06:29:24 -0500 Received: by starkhome.cs.sunysb.edu (8.6.10/1.34) id GAA02337; Tue, 7 Mar 1995 06:27:44 -0500 Date: Tue, 7 Mar 1995 06:27:44 -0500 From: starkhome!gene@sbstark.cs.sunysb.edu (Gene Stark) Message-Id: <199503071127.GAA02337@starkhome.cs.sunysb.edu> To: current@FreeBSD.org Subject: How to deadlock your -current system Sender: current-owner@FreeBSD.org Precedence: bulk (Second posting. I guess the first one was lost in the "freefall accident".) Here is a fairly reliable way to cause a deadlock on my 16MB system running -current. I tried to make the size of the file comparable to the size of my RAM. I don't know if other sizes cause the same problem. - Gene ------------- #include #include #include #include #include #define PSIZE 4096 main() { char *name = "testfile"; off_t max = 4000*PSIZE; char buf[PSIZE]; caddr_t addr; int f; if((f = open(name, O_CREAT | O_RDWR, 0644)) < 0) { perror("Can't open test file"); exit(1); } if(lseek(f, max-PSIZE, SEEK_SET) < 0) { perror("Seek failed"); exit(1); } if(write(f, buf, PSIZE) < 0) { perror("Initial write failed"); exit(1); } if((addr = mmap(0, max, PROT_READ | PROT_WRITE, MAP_SHARED, f, 0)) == NULL) { perror("mmap failed"); exit(1); } while(1) { int r = random() % max - 1; *(addr + r) = 0; } }