title: Get name from PID?
body: <p>I am on OSX Mountain Lion and am trying to retrieve a processes' name using its PID.</p>
  
  <p>The following is the code I am using:</p>
  
  <pre><code>pid_t pid = 10687;
  char pathBuffer [PROC_PIDPATHINFO_MAXSIZE] = "";
  char nameBuffer [256] = "";
  
  int sizeOfVal = sizeof(nameBuffer);
  proc_pidpath(pid, pathBuffer, sizeof(pathBuffer));
  proc_name(pid, nameBuffer, sizeof(nameBuffer));
  
  NSLog(@"Path: %s\n Name: %s\n", pathBuffer, nameBuffer);
  </code></pre>
  
  <p>The code above is able to retrieve the name properly, however it only retrieves the first 15 characters and "ignores" the rest. Note this is not a problem with displaying the name, but with <em>retrieving</em> it. The problem is not with the rest of my application as I am testing the above code in a standalone application. Also note that I tried changing the PID, but regardless of what PID I try the code only retrieves the first 15 characters of the name. Path retrieval works perfectly.</p>
  
  <p>Does anyone have any ideas about what I am doing wrong?</p>