[dpdk-dev] Get the socket id

dvr jinxiu.1006 at 163.com
Wed Aug 7 08:14:19 CEST 2013


hi,
   all
   I'm confused with the following code(Eal_memory.c in lib\librte_eal\linuxapp\eal directory, LINE 373):
 
   nodestr = strstr(buf," N");
   if(nodestr == NULL) {...}
   nodestr += 2;
   end = strstr(nodestr,"=");
   if(end == NULL) {...}
   // here nodestr = "0=1"
   end[0] = '\0';
   end = NULL;
  // here nodestr = "0"
   socket_id = strtoul(nodestr,&end,0);
 
   Through "printf", I know that:
   buf = "00200000 default file=/mnt/dpdk/huge/rtemap_1 huge dirty=1 N0=1"
   And finally socket_id=0
   My question is :why we get the socket_id before "=" instead of after "=" ?
   and if we want to get the character after "N", isn't this code too complex?
 
   I will be very appreciate for any help.
   Regards!
 
Maria
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://dpdk.org/ml/archives/dev/attachments/20130807/4692c3d4/attachment.html>


More information about the dev mailing list