Java for Linux の open の謎
下のエントリがなぜ FreeBSD での検証なのかって、Linux だとファイルがcloseされていないことは確認できるのに、結局「Too many open files」を確認できなかったからだったりする。こんな感じ。
% ulimit -n 20 % strace java PrintWriterTest 2>&1 | grep -E 'open|close' open("/etc/ld.so.cache", O_RDONLY) = 3 close(3) = 0 open("/lib/tls/i686/cmov/libpthread.so.0", O_RDONLY) = 3 close(3) = 0 (略) open("tmp/00000", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 5 open("tmp/00001", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 6 open("tmp/00002", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 7 open("tmp/00003", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 8 open("tmp/00004", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 9 open("tmp/00005", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 10 open("tmp/00006", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 11 open("tmp/00007", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 12 open("tmp/00008", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 13 open("tmp/00009", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 14 open("tmp/00010", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 7 open("tmp/00011", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 8 open("tmp/00012", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 9 open("tmp/00013", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 10 open("tmp/00014", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 11 open("tmp/00015", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 12 open("tmp/00016", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 13 open("tmp/00017", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 7 open("tmp/00018", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 8 open("tmp/00019", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 9 open("tmp/00020", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 10 (略)
どうみても close してないのに EMFILE がかえってこないし、close していない File Descriptor と同じ数字を返してる。
どういうことっすか、これ。教えてえらい人。