From owner-freebsd-current Mon Mar 6 17:45:51 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id RAA28906 for current-outgoing; Mon, 6 Mar 1995 17:45:51 -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 RAA28900 for ; Mon, 6 Mar 1995 17:45:50 -0800 Received: from starkhome.UUCP (root@localhost) by sbstark.cs.sunysb.edu (8.6.9/8.6.9) with UUCP id UAA19468 for current@freebsd.org; Mon, 6 Mar 1995 20:45:40 -0500 Received: by starkhome.cs.sunysb.edu (8.6.10/1.34) id UAA00178; Mon, 6 Mar 1995 20:31:32 -0500 Date: Mon, 6 Mar 1995 20:31:32 -0500 From: starkhome!gene@sbstark.cs.sunysb.edu (Gene Stark) Message-Id: <199503070131.UAA00178@starkhome.cs.sunysb.edu> To: current@freebsd.org Subject: How to deadlock your -current system Sender: current-owner@freebsd.org Precedence: bulk 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; } }