Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 727

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

\section{ost::Process Class Reference}
\label{classost_1_1_process}\index{ost::Process@{ost::Process}}
A class for containing portable process related functions that help create portable code.Peocess wrapper class.  


{\tt \#include $<$process.h$>$}

\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef RETSIGTYPE($\ast$ {\bf Trap} )(int)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
bool {\bf lock} (bool future=true)
\begin{CompactList}\small\item\em Lock a process in memory. \item\end{CompactList}\item 
void {\bf unlock} (void)
\begin{CompactList}\small\item\em Unlock process pages. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static void {\bf detach} (void)
\begin{CompactList}\small\item\em Detach current process into a daemon, posix only. \item\end{CompactList}\item 
static void {\bf attach} (const char $\ast$devname)
\begin{CompactList}\small\item\em Attach the current process to another device or i/o session. \item\end{CompactList}\item 
static {\bf Trap} {\bf set\-Posix\-Signal} (int signo, {\bf Trap} handler)
\begin{CompactList}\small\item\em Set a posix compliant signal handler. \item\end{CompactList}\item 
static {\bf Trap} {\bf set\-Interrupt\-Signal} (int signo, {\bf Trap} handler)
\begin{CompactList}\small\item\em Set system call interuptable signal handler. \item\end{CompactList}\item 
static int {\bf spawn} (const char $\ast$exec, const char $\ast$$\ast$argv, bool wait=true)
\begin{CompactList}\small\item\em Spawn a process and wait for it's exit code. \item\end{CompactList}\item 
static int {\bf join} (int pid)
\begin{CompactList}\small\item\em Get the exit status of another process, waiting for it to exit. \item\end{CompactList}\item 
static bool {\bf cancel} (int pid, int sig=0)
\begin{CompactList}\small\item\em Cancel a running child process. \item\end{CompactList}\item 
static const char $\ast$ {\bf get\-Env} (const char $\ast$name)
\begin{CompactList}\small\item\em Get system environment. \item\end{CompactList}\item 
static void {\bf set\-Env} (const char $\ast$name, const char $\ast$value, bool overwrite)
\begin{CompactList}\small\item\em Set system environment in a standard manner. \item\end{CompactList}\item 
static const char $\ast$ {\bf get\-Config\-Dir} (void)
\begin{CompactList}\small\item\em Get etc prefix path. \item\end{CompactList}\item 
static const char $\ast$ {\bf get\-Home\-Dir} (void)
\begin{CompactList}\small\item\em Get home directory. \item\end{CompactList}\item 
static const char $\ast$ {\bf get\-User} (void)
\begin{CompactList}\small\item\em Get user name. \item\end{CompactList}\item 
static bool {\bf set\-User} (const char $\ast$id, bool grp=true)
\begin{CompactList}\small\item\em Set user id by name. \item\end{CompactList}\item 
static bool {\bf set\-Group} (const char $\ast$id)
\begin{CompactList}\small\item\em Set the effective group id by name. \item\end{CompactList}\item 
static size\_\-t {\bf get\-Page\-Size} (void)
\begin{CompactList}\small\item\em Return the effective operating system page size. \item\end{CompactList}\item 
static void {\bf set\-Priority} (int pri)
\begin{CompactList}\small\item\em Used to set process priority and optionally enable realtime. \item\end{CompactList}\item 
static void {\bf set\-Scheduler} (const char $\ast$policy)
\begin{CompactList}\small\item\em Used to set process scheduling policy. \item\end{CompactList}\item 
static void {\bf set\-Realtime} (int pri=0)
\begin{CompactList}\small\item\em Portable shortcut for setting realtime. \item\end{CompactList}\item 
static bool {\bf is\-Scheduler} (void)
\begin{CompactList}\small\item\em Return true if scheduler settable. \item\end{CompactList}\item 
static bool {\bf is\-Realtime} (void)
\begin{CompactList}\small\item\em Return true if realtime scheduling. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
A class for containing portable process related functions that help create portable code.Peocess wrapper class. 

These are typically referenced thru Process::xxx static member functions. Many of these members are used both for win32 and posix systems although some may be platform specific.

\begin{Desc}
\item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc}




\subsection{Member Typedef Documentation}
\index{ost::Process@{ost::Process}!Trap@{Trap}}
\index{Trap@{Trap}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef RETSIGTYPE($\ast$ {\bf ost::Process::Trap})(int)}\label{classost_1_1_process_0d09148ffbdd15032056c1ae2510a741}




\subsection{Member Function Documentation}
\index{ost::Process@{ost::Process}!attach@{attach}}
\index{attach@{attach}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void ost::Process::attach (const char $\ast$ {\em devname})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_65113d14afb60393a852c859e0ddf037}


Attach the current process to another device or i/o session. 

It is deamonified and dissasociated with the prior parent process and controlling terminal.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em devname}]path to attach to. \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!cancel@{cancel}}
\index{cancel@{cancel}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static bool ost::Process::cancel (int {\em pid}, int {\em sig} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_6a94b9da9e6f879663520f774b140249}


Cancel a running child process. 

\begin{Desc}
\item[Returns:]0 on success. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pid}]process id. \item[{\em sig}]cancel signal to apply. \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!detach@{detach}}
\index{detach@{detach}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void ost::Process::detach (void)\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_43102f60a1dd16da2d812e9c6d77d2b9}


Detach current process into a daemon, posix only. 

Perhaps a similar method can be used for creating win32 \char`\"{}services\char`\"{}? \index{ost::Process@{ost::Process}!getConfigDir@{getConfigDir}}
\index{getConfigDir@{getConfigDir}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static const char$\ast$ ost::Process::get\-Config\-Dir (void)\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_9d7c073f3c473f7eead6a6613ff98c00}


Get etc prefix path. 

\begin{Desc}
\item[Returns:]etc prefix. \end{Desc}
\index{ost::Process@{ost::Process}!getEnv@{getEnv}}
\index{getEnv@{getEnv}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static const char$\ast$ ost::Process::get\-Env (const char $\ast$ {\em name})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_24a26249ddd3dd99104d71d37bf02064}


Get system environment. 

\begin{Desc}
\item[Returns:]system environ symbol. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]of symbol. \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!getHomeDir@{getHomeDir}}
\index{getHomeDir@{getHomeDir}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static const char$\ast$ ost::Process::get\-Home\-Dir (void)\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_3d99258c5b247accaaf8fa5344288428}


Get home directory. 

\begin{Desc}
\item[Returns:]user home directory. \end{Desc}
\index{ost::Process@{ost::Process}!getPageSize@{getPageSize}}
\index{getPageSize@{getPageSize}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static size\_\-t ost::Process::get\-Page\-Size (void)\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_00d16fe1c73744546658a1a0f13906df}


Return the effective operating system page size. 

\begin{Desc}
\item[Returns:]system page size. \end{Desc}
\index{ost::Process@{ost::Process}!getUser@{getUser}}
\index{getUser@{getUser}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static const char$\ast$ ost::Process::get\-User (void)\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_1d1fd732ed82e74b8f749ad2e171361a}


Get user name. 

\begin{Desc}
\item[Returns:]user login id. \end{Desc}
\index{ost::Process@{ost::Process}!isRealtime@{isRealtime}}
\index{isRealtime@{isRealtime}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static bool ost::Process::is\-Realtime (void)\hspace{0.3cm}{\tt  [inline, static]}}\label{classost_1_1_process_5f2fe33d0088b1c2db43613581fe04e2}


Return true if realtime scheduling. 

\index{ost::Process@{ost::Process}!isScheduler@{isScheduler}}
\index{isScheduler@{isScheduler}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static bool ost::Process::is\-Scheduler (void)\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_fdd74b2a47c76ad88df0ba81991ef947}


Return true if scheduler settable. 

\index{ost::Process@{ost::Process}!join@{join}}
\index{join@{join}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static int ost::Process::join (int {\em pid})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_cc251d46caa853b285ba1d4e19d500ac}


Get the exit status of another process, waiting for it to exit. 

\begin{Desc}
\item[Returns:]exit code from process. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pid}]process id. \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!lock@{lock}}
\index{lock@{lock}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::Process::lock (bool {\em future} = {\tt true})}\label{classost_1_1_process_3f8660a112bf25128a743fb599681cf2}


Lock a process in memory. 

Ideally you should be deep enough where additional memallocs for functions will not kill you, or use false for future.

\begin{Desc}
\item[Returns:]true if successful. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em future}]pages as well... \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!setEnv@{setEnv}}
\index{setEnv@{setEnv}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void ost::Process::set\-Env (const char $\ast$ {\em name}, const char $\ast$ {\em value}, bool {\em overwrite})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_94a4b4f321b076d59b0fe8902c6ba794}


Set system environment in a standard manner. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]of environment symbol to set. \item[{\em value}]of environment symbol. \item[{\em overwrite}]true if replace existing symbol. \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!setGroup@{setGroup}}
\index{setGroup@{setGroup}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static bool ost::Process::set\-Group (const char $\ast$ {\em id})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_bf659310fab24472fb1b8f9797383b8e}


Set the effective group id by name. 

\begin{Desc}
\item[Returns:]true if successful. \end{Desc}
\index{ost::Process@{ost::Process}!setInterruptSignal@{setInterruptSignal}}
\index{setInterruptSignal@{setInterruptSignal}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static {\bf Trap} ost::Process::set\-Interrupt\-Signal (int {\em signo}, {\bf Trap} {\em handler})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_df3c850256b0e817298ddeb95f4b4630}


Set system call interuptable signal handler. 

return previous handler. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em signo}]signal no. \item[{\em handler}]trap handler. \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!setPosixSignal@{setPosixSignal}}
\index{setPosixSignal@{setPosixSignal}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static {\bf Trap} ost::Process::set\-Posix\-Signal (int {\em signo}, {\bf Trap} {\em handler})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_d864f14f892fd2ff09483748e7d6a328}


Set a posix compliant signal handler. 

\begin{Desc}
\item[Returns:]previous handler. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em signo}]signal no. \item[{\em handler}]trap handler. \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!setPriority@{setPriority}}
\index{setPriority@{setPriority}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void ost::Process::set\-Priority (int {\em pri})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_6b17c10f9f12ba9a965400c87e17a62a}


Used to set process priority and optionally enable realtime. 

\index{ost::Process@{ost::Process}!setRealtime@{setRealtime}}
\index{setRealtime@{setRealtime}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void ost::Process::set\-Realtime (int {\em pri} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_26cf80b6ae71b5baa323fe8e0ede944b}


Portable shortcut for setting realtime. 

.. \index{ost::Process@{ost::Process}!setScheduler@{setScheduler}}
\index{setScheduler@{setScheduler}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void ost::Process::set\-Scheduler (const char $\ast$ {\em policy})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_4751f7ca53e7c15ae0ab5e29952fe65d}


Used to set process scheduling policy. 

\index{ost::Process@{ost::Process}!setUser@{setUser}}
\index{setUser@{setUser}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static bool ost::Process::set\-User (const char $\ast$ {\em id}, bool {\em grp} = {\tt true})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_2682d8f8aec63d61201b247b4d437aa3}


Set user id by name. 

\begin{Desc}
\item[Returns:]true if successful. \end{Desc}
\index{ost::Process@{ost::Process}!spawn@{spawn}}
\index{spawn@{spawn}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static int ost::Process::spawn (const char $\ast$ {\em exec}, const char $\ast$$\ast$ {\em argv}, bool {\em wait} = {\tt true})\hspace{0.3cm}{\tt  [static]}}\label{classost_1_1_process_f689ef760fdefb3dfb998950ad1c62a9}


Spawn a process and wait for it's exit code. 

In win32 this is done with the spawn system call. In posix, this is done with a fork, an execvp, and a waitpid.

\begin{Desc}
\item[Warning:]The implementation differences between posix and win32 systems may cause side effects. For instance, if you use atexit() and this spawn method, on posix systems the function set up with atexit() will be called when the parent process of the fork exits, which will not happen on Win32 systems.\end{Desc}
\begin{Desc}
\item[Returns:]error code from process. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em exec}]name of executable. \item[{\em argv}]list of command arguments. \item[{\em wait}]for process to exit before return. \end{description}
\end{Desc}
\index{ost::Process@{ost::Process}!unlock@{unlock}}
\index{unlock@{unlock}!ost::Process@{ost::Process}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Process::unlock (void)}\label{classost_1_1_process_3cc2b549525e914931a2829faccc4f44}


Unlock process pages. 



The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf process.h}\end{CompactItemize}