📄 open_max
字号:
From - Thu Jun 7 00:06:49 2001Return-Path: <gpm-admin@mir.prosa.it>Delivered-To: nico@schottelius.orgReceived: (qmail 2518 invoked by uid 0); 24 May 2001 02:14:58 -0000Received: from dns.pcsystems.de (HELO pcsystems.de) (212.63.44.1) by www.schottelius.org with SMTP; 24 May 2001 02:14:58 -0000Received: (qmail 22323 invoked by uid 577); 24 May 2001 02:30:59 -0000Delivered-To: nicos@pcsystems.deReceived: (qmail 22320 invoked by uid 0); 24 May 2001 02:30:57 -0000Received: from unknown (HELO mir.prosa.it) (217.57.75.5) by dns.pcsystems.de with SMTP; 24 May 2001 02:30:57 -0000Received: from mir.ascensit.com (localhost [127.0.0.1]) by mir.prosa.it (Postfix) with ESMTP id 9B59F202; Thu, 24 May 2001 04:34:02 +0200 (CEST)Delivered-To: gpm@mir.prosa.itReceived: from marine.sonic.net (marine.sonic.net [208.201.224.37]) by mir.prosa.it (Postfix) with SMTP id 5E61E1F0 for <gpm@mir.prosa.it>; Thu, 24 May 2001 04:33:00 +0200 (CEST)Received: (qmail 11060 invoked from network); 24 May 2001 02:32:58 -0000Received: from ultra.sonic.net (208.201.224.22) by marine.sonic.net with SMTP; 24 May 2001 02:32:58 -0000Received: from thune.mrc-home.org (adsl-209-204-178-126.sonic.net [209.204.178.126]) by ultra.sonic.net (8.11.2/8.8.5) with ESMTP id f4O2Wuc10136 for <gpm@lists.prosa.it>; Wed, 23 May 2001 19:32:57 -0700X-envelope-info: <dalgoda@ix.netcom.com>Received: by thune.mrc-home.org (8.10.0) id f4O2WuA14534; Wed, 23 May 2001 19:32:56 -0700From: Mike Castle <dalgoda@ix.netcom.com>To: gpm@mir.prosa.itMessage-ID: <20010523193256.A8573@thune.mrc-home.com>Mime-Version: 1.0Content-Type: text/plain; charset=us-asciiContent-Disposition: inlineUser-Agent: Mutt/1.3.18iSubject: [Gpm] another OPEN_MAX patchSender: gpm-admin@lists.prosa.itErrors-To: gpm-admin@lists.prosa.itX-BeenThere: gpm@lists.prosa.itX-Mailman-Version: 2.0.3Precedence: bulkReply-To: gpm@lists.prosa.itX-Reply-To: Mike Castle <dalgoda@ix.netcom.com>List-Help: <mailto:gpm-request@lists.prosa.it?subject=help>List-Post: <mailto:gpm@lists.prosa.it>List-Subscribe: <http://lists.prosa.it/cgi-bin/mailman/listinfo/gpm>, <mailto:gpm-request@lists.prosa.it?subject=subscribe>List-Id: <gpm.lists.prosa.it>List-Unsubscribe: <http://lists.prosa.it/cgi-bin/mailman/listinfo/gpm>, <mailto:gpm-request@lists.prosa.it?subject=unsubscribe>List-Archive: <http://lists.prosa.it/pipermail/gpm/>Date: Wed, 23 May 2001 19:32:56 -0700X-Mozilla-Status: 8001X-Mozilla-Status2: 00000000X-UIDL: 990670498.2521.suppeHaving finally gotten around to recompiling gpm-1.19.3 with a recent glibc,I came across the OPEN_MAX not being defined problem.I didn't like any of the patches I saw on debian and redhat (granted Ididn't look too hard).--- gpm-1.19.3.orig/special.c Mon Jan 17 13:34:00 2000+++ gpm-1.19.3/special.c Wed May 23 19:16:43 2001@@ -35,6 +35,7 @@ #include <time.h> #include <errno.h> #include <sys/param.h>+#include <limits.h> #include "gpmInt.h" @@ -61,13 +62,25 @@ static char *commandM="shutdown -h now"; static char *commandR="shutdown -r now"; +/* More or less out of Stevens */+static long int gpm_open_max(void)+{+#ifdef OPEN_MAX+ return OPEN_MAX;+#else+ long int rc = sysconf(_SC_OPEN_MAX);+ if (rc==-1) rc = 256;+ return rc;+#endif+}+ /* * The return value is 0 if the event has been eaten, * 1 if the event is passed on */ int processSpecial(Gpm_Event *event) {- char *command=NULL; int i;+ char *command=NULL; FILE *consolef; if ((event->type & GPM_TRIPLE)@@ -145,6 +158,7 @@ switch(fork()) {+ long int i; case -1: /* error */ fprintf(stderr,"%s: fork(): %s\n", prgname, strerror(errno)); return 0; /* Hmmm.... error */@@ -154,7 +168,7 @@ open("/dev/null",O_RDONLY); /* stdin */ open("/dev/tty0",O_WRONLY); /* stdout */ dup(1); /* stderr */- for (i=3;i<OPEN_MAX; i++) close(i);+ for (i=3;i<gpm_open_max(); i++) close(i); execl("/bin/sh","sh","-c",command,(char *)NULL); exit(1); /* shouldn't happen */ @@ -162,8 +176,3 @@ return 0; } }------- Mike Castle Life is like a clock: You can work constantly dalgoda@ix.netcom.com and be right all the time, or not work at allwww.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc We are all of us living in the shadow of Manhattan. -- Watchmen__Gpm mailing list at Gpm@lists.prosa.itSend help as subject to gpm-request@lists.prosa.it for helpArchives at http://lists.prosa.it/pipermail/gpm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -