もじもじと申します。

最近色々なトラップに引っかかってます。勉強不足です。

どんな設定をしたのか良く分かってないのですが、なんせ、ports
から postfix を install したら、Bus error で落ちます。

で、色々調べているのですが、結局の所、closefrom 関数をシ
ステムコールして落ちているようです。
# もしかしたら、その先にもトラップはあるかもしれません。

closefrom(3); で落ちるのです。

この、3 という引数にどんな意味があるのかは知りません。

これは、
/usr/src/tools/regression/file/closefrom
にあるプログラムを実行して分かりました。

# pwd
/usr/src/tools/regression/file/closefrom
# ./closefrom
1..15
ok 1 - open
ok 2 - highest_fd
Bad system call (core dumped)

# gdb
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd".
(gdb) file closefrom
Reading symbols from closefrom...done.
(gdb) run
Starting program: /usr/src/tools/regression/file/closefrom/closefrom
1..15
ok 1 - open
ok 2 - highest_fd

Program received signal SIGSYS, Bad system call.
0x280d0d67 in closefrom () from /lib/libc.so.7
(gdb) bt
#0  0x280d0d67 in closefrom () from /lib/libc.so.7
#1  0x08048bc3 in main () at closefrom.c:163
(gdb) list
163             closefrom(3);
164             fd = highest_fd();
165             if (fd != 2)
166                     fail("closefrom", "highest fd %d", fd);
167             ok("closefrom");
168
169             /* Eat up 16 descriptors. */
170             for (i = 0; i < 16; i++)
171                     (void)devnull();
172             fd = highest_fd();

ちなみに、ソース(一部抜粋)は

148         printf("1..15\n");
149
150         /* We better start up with fd's 0, 1, and 2 open. */
151         fd = devnull();
152         if (fd != 3)
153                 fail("open", "bad descriptor %d", fd);
154         ok("open");
155
156         /* Make sure highest_fd() works. */
157         fd = highest_fd();
158         if (fd != 3)
159                 fail("highest_fd", "bad descriptor %d", fd);
160         ok("highest_fd");
161
162         /* Try to use closefrom() for just closing fd 3. */
163         closefrom(3);
164         fd = highest_fd();
165         if (fd != 2)
166                 fail("closefrom", "highest fd %d", fd);
167         ok("closefrom");

となっています。

さらに man を見ると・・・

The closefrom() function first appeared in FreeBSD 8.0.

などと言われます。
こうなってくると、私にはさっぱりわかりません。

どなたかヒントやきっかけでも構いませんので、何をどうすれ
ば良いのかアドバイス頂けませんでしょうか?

-- 
もじもじ <mojimoji...@yahoo.co.jp>

メールによる返信