Using Linux ioctl with Mono

ioctl, mono

Solution

Mono does not contain a wrapper for ioctl in Mono.Unix, because ioctl call parameters vary greatly and such a wrapper would be almost useless. You should declare a DllImport for each ioctl you need.

You probably don't need a helper library written in C, however, you may need it during development to extract actual values hidden behind different C preprocessor macros. For example, to expand C header:

#define FE_GET_INFO                _IOR('o', 61, struct dvb_frontend_info)

compile and execute this helper:

#include <linux/dvb/frontend.h>
#include <stdio.h>

int main()
{
  printf("const int FE_GET_INFO = %d;\n", FE_GET_INFO);
  return 0;
}

A short mono mailing list discussion on the topic.

Problem

I'm trying to do ioctl command through Mono framework, but I cant find what I'm looking for. I'm trying to send command to a DVB card that has a kernel module. I hope someone can link or explain clearly how this can be done. Any example with Mono using kernel modules would be useful I guess.

Original source

Related problems