Revision: 2682
http://tmux.svn.sourceforge.net/tmux/?rev=2682&view=rev
Author: nicm
Date: 2012-01-27 09:01:06 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
Fill in osdep_get_cwd on Darwin, from Alex Ernst.
Modified Paths:
--------------
trunk/osdep-darwin.c
Modified: trunk/osdep-darwin.c
===================================================================
--- trunk/osdep-darwin.c 2012-01-23 13:20:14 UTC (rev 2681)
+++ trunk/osdep-darwin.c 2012-01-27 09:01:06 UTC (rev 2682)
@@ -20,6 +20,7 @@
#include <sys/sysctl.h>
#include <event.h>
+#include <libproc.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -52,6 +53,16 @@
char *
osdep_get_cwd(pid_t pid)
{
+ static char wd[PATH_MAX];
+ struct proc_vnodepathinfo pathinfo;
+ int ret;
+
+ ret = proc_pidinfo(
+ pid, PROC_PIDVNODEPATHINFO, 0, &pathinfo, sizeof pathinfo);
+ if (ret == sizeof pathinfo) {
+ strlcpy(wd, pathinfo.pvi_cdir.vip_path, sizeof wd);
+ return (wd);
+ }
return (NULL);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs