From mboxrd@z Thu Jan 1 00:00:00 1970 From: dvr Subject: Get the socket id Date: Wed, 7 Aug 2013 14:14:19 +0800 (CST) Message-ID: <77584a69.d001.1405769661d.Coremail.jinxiu.1006@163.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_196321_2091359227.1375856059933" To: dev-VfR2kkLFssw@public.gmane.org Return-path: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" ------=_Part_196321_2091359227.1375856059933 Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: 7bit 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 ------=_Part_196321_2091359227.1375856059933 Content-Type: text/html; charset=GBK Content-Transfer-Encoding: 7bit
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
  


------=_Part_196321_2091359227.1375856059933--