ioctl() is a system call, just like read() or write(). All of these act on files, and in the case of ioctl, on device-special files (like /dev/dsp or /dev/mixer) that control the flow of data between a user program and a piece of hardware.
Basically, beep is trying to perform an I/O control operation on a file that doesn't support it, or upon which it doesn't have write access to.
I can't tell from your post which file it could be, or what kind of ioctl() it's trying to do. About all I can suggest is that you might look at the file permissions on /dev/dsp and /dev/mixer (which are normally the only two files for sound output), or to try using alternative output modes like OSS, ALSA or SDL if it supports them.
You would probably be better off asking this question in a BMP forum (see http://www.sosdg.org/~larne/w/BMP_Homepage
) as people there will know the code and be more able to help you.