Cool. So basically we need to implement KERN_PROC_CWD on OpenBSD,
although I don't think I would do it the way DragonFly does, I would
probably add a new level 3 sysctl like KERN_PROC_ARGS.

Lemme see if I have time to look at it this week.


On Mon, Dec 05, 2011 at 10:08:55AM +0100, marcel partap wrote:
> ..just for reference, from konsole/src/ProcessInfo.cpp, includes omitted:
> 
> >     virtual bool LinuxProcessInfo::readCurrentDir(int pid)
> >     {
> >         QFileInfo info( QString("/proc/%1/cwd").arg(pid) );
> >
> >         const bool readable = info.isReadable();
> >
> >         if ( readable && info.isSymLink() )
> >         {
> >             setCurrentDir( info.symLinkTarget() );
> >             return true;
> >         }
> >         else
> >         {
> >             if ( !readable )
> >                 setError( PermissionsError );
> >             else
> >                 setError( UnknownError );
> >
> >             return false;
> >         }
> >     }
> 
> 
> >     virtual bool FreeBSDProcessInfo::readCurrentDir(int pid)
> >     {
> > #if defined(__DragonFly__)
> >         char buf[PATH_MAX];
> >         int managementInfoBase[4];
> >         size_t len;
> >
> >         managementInfoBase[0] = CTL_KERN;
> >         managementInfoBase[1] = KERN_PROC;
> >         managementInfoBase[2] = KERN_PROC_CWD;
> >         managementInfoBase[3] = pid;
> >
> >         len = sizeof(buf);
> >         if (sysctl(managementInfoBase, 4, buf, &len, NULL, 0) == -1)
> >             return false;
> >
> >         setCurrentDir(buf);
> >
> >         return true;
> > #else
> >         int numrecords;
> >         struct kinfo_file* info = 0;
> >
> >         info = kinfo_getfile(pid, &numrecords);
> >
> >         if (!info)
> >             return false;
> >
> >         for (int i = 0; i < numrecords; ++i)
> >         {
> >             if (info[i].kf_fd == KF_FD_TYPE_CWD)
> >             {
> >                 setCurrentDir(info[i].kf_path);
> >
> >                 free(info);
> >                 return true;
> >             }
> >         }
> >
> >         free(info);
> >         return false;
> > #endif
> >     }
> 
> >     virtual bool SolarisProcessInfo::readCurrentDir(int pid)
> >     {
> >         QFileInfo info( QString("/proc/%1/path/cwd").arg(pid) );
> >         const bool readable = info.isReadable();
> >
> >         if ( readable && info.isSymLink() )
> >         {
> >             setCurrentDir( info.symLinkTarget() );
> >             return true;
> >         }
> >         else
> >         {
> >             if ( !readable )
> >                 setError( PermissionsError );
> >             else
> >                 setError( UnknownError );
> >
> >             return false;
> >         }
> >     }
> 
> 
> >     virtual bool MacProcessInfo::readCurrentDir(int pid)
> >     {
> >         struct proc_vnodepathinfo vpi;
> >         int nb = proc_pidinfo(pid, PROC_PIDVNODEPATHINFO, 0, &vpi, 
> > sizeof(vpi));
> >         if (nb == sizeof(vpi))
> >         {
> >             setCurrentDir(QString(vpi.pvi_cdir.vip_path));
> >             return true;
> >         }
> >         return false;
> >     }
> >     virtual bool readEnvironment(int pid)
> >     {
> >         Q_UNUSED(pid);
> >         return false;
> >     }
> 
> ...cross platform FAiL ^^
> #regards|marcel C;
> 
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure 
> contains a definitive record of customers, application performance, 
> security threats, fraudulent activity, and more. Splunk takes this 
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to