cygwin "Bad System Call"
上記の内容を会社のcygwinでも実現しようと思ったところApacheを起動するとかなり謎なエラーになる。
% apachectl2 start Bad System Call $HTTPD -k $ARGV %
そう言えば以前も同じメッセージを見たことがあったがどうやって解決したっけ?と思い再度調べた。忘れないように書いておく。
(no)server - 設定された場合、クライアントアプリケーションは Cygserver の機能を利用します。このオプションは明示的にクライアントサイドで有効化されるべきものであり、そうでなければアプリケーションは XSI IPC 関数呼び出し(msgget、semget、shmget 及びそれに類するもの)を利用出来ません。設定されていない場合、これらの関数群は ENOSYS(Bad system call)を返すでしょう。
ということで、Apacheに限らずmsgget, semget, shmget等の関数を使うプログラムを実行するためには、Cygserverを有効にした上で、CYGWIN環境変数にserverを指定する必要がある。Cygserverを有効にするためには、まずシェルでcygserver-configを実行する。ついで、net start cygserverを実行するか、もしそれがうまくいかなければPCを再起動すれば良い。この操作は一度行えば以降は不要だ。
% cygserver-config Overwrite existing /etc/cygserver.conf file? (yes/no) yes Generating /etc/cygserver.conf file Warning: The following function requires administrator privileges! Do you want to install cygserver as service? (Say "no" if it's already installed as service) (yes/no) yes The service has been installed under LocalSystem account. To start it, call `net start cygserver' or `cygrunsrv -S cygserver'. Further configuration options are available by editing the configuration file /etc/cygserver.conf. Please read the inline information in that file carefully. The best option for the start is to just leave it alone. Please keep in mind, that a client application which wants to use the services provided by cygserver *must* have the environment variable CYGWIN set so that it contains the word "server". So, if you don't need any other special CYGWIN setting, just set it to "server". It is advisable to add this setting to the Windows system environment. Basic Cygserver configuration finished. Have fun! %
ここで書いた内容は"bad system call" cygserverのように検索すると該当するものが多数見つかるが、"bad system call" apacheのように検索してもなかなかたどりつけない。迷える魂が救われんことを(なんて)。