Hello Everyone,
I am trying to get my userspace pid into ioctl function through ifreq, but I am unknown of adding a member into structure of ifreq
here is my code:
Code:
...
int my_ioctl (struct net_device* dev, struct ifreq *ifr, int cmd)
{
int errorCode = 0;
struct hInfo *hostInfo;
struct netInfo *netInfo;
switch (cmd) {
case SIOTRYTOGETDEVICEINFO:
/* Working fine and I am getting required information */
break;
case SIOTRYTOGETNETWORKINFO:
/* Working fin and I am getting required information*/
break;
case SIOTRYTOGETPIDINFO:
int pid = copy_from_user(pid, ifr->ifr_pid, sizeof(pid)); // here i want to add ifr_pid into ifreq structure
break;
default:
break;
}
return errorCode;
}
so i want to know that is it possible to get pid using this way into virtual interface?
if it is possible then how can i add this ifr_pid member into structure of ifreq without edditing linux/if.h file.
I am not so good with C language, so pardon me and make me correct if i made any technical mistake..
Thank you so much in advance..
Sindhu