LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to add a new member into ifreq? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-add-a-new-member-into-ifreq-945897/)

sindhu4sind 05-19-2012 11:19 AM

how to add a new member into ifreq?
 
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


All times are GMT -5. The time now is 08:56 AM.