Re: 2 questions: getter/setter use and streams use
| From: | George Schlossnagle | Date: | Mon, 14 Apr 2003 17:17:44 +0000 |
| Subject: | Re: 2 questions: getter/setter use and streams use | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-911@lists.php.net to get a copy of this message | ||
On Monday, April 14, 2003, at 12:09 PM, Wez Furlong wrote:
On the contrary, it's easy to underestimate the problem :) If you are using a stdio replacement, (such as sfio), then you are more-or-less safe from the problem. The problem is that the native libc will not allow file descriptors with a numerical value > 255, regardless of your per-process file descriptor limit.I don't think this is true. #include "stdio.h" #include "fcntl.h" int main() {
int i = 0;
int fd = 0;
while(1) {
char path[11];
snprintf(path, 11, "/tmp/t/%d", i++);
if((fd = open(path, O_RDWR|O_CREAT, 0)) < 0 ) {
return;
}
printf("Opened fd: %d number %d\n", fd, i);
}
}
created me 1021 fd's as a non-priv'd user on my Sol 2.6 system (with it's standard libc).
The problem is with the stdio routines (fopen et. al.). As long as you don't use fopen you're set.