Cygwinで"Bad system call"が出るときは

IPCを使ったりすると出ます。自分の場合は共有メモリーのテストをしようとしたときに出てしまいました。対処方法としては、cygserverを起動して環境変数CYGWIN=serverの設定をすればOKとのこと。

$ cygserver-config
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)
(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!

サービス起動後の状態はこんな感じ。

$ cygrunsrv -Q cygserver
Service             : cygserver
Display name        : CYGWIN cygserver
Current State       : Running
Controls Accepted   : Stop
Command             : /usr/sbin/cygserver