pmdagetoptions(3)

NAME

   pmdaGetOpt,  pmdaGetOptions  -  get  options  from  arguments,  parsing
   generic PMDA options

C SYNOPSIS

   #include <pcp/pmapi.h>
   #include <pcp/impl.h>
   #include <pcp/pmda.h>

   int pmdaGetOptions(int argc, char *const *argv, pmdaOptions *opts,
           pmdaInterface *dispatch);

   int pmdaGetOpt(int argc, char *const *argv, const char *optstring,
           pmdaInterface *dispatch, int *err);

   cc ... -lpcp_pmda -lpcp

DESCRIPTION

   These functions are wrappers for pmgetopt_r(3).  The behavior  of  each
   function  is  that  certain  options  are  assumed to have a predefined
   behavior  which  initializes  several  fields  in   the   pmdaInterface
   structure.   The  pmdaGetOptions  interface  allows both short and long
   options to be given, whereas pmdaGetOpt allows for short  form  options
   only.

   The options that both pmdaGetOptions and pmdaGetOpt will trap are:

   -Dtrace        Set  the  PMAPI(3)  debug  control variable (pmDebug) to
                  trace.  Used for  controlling  levels  of  trace  output
                  while debugging.

   -ddomain       Set the domain number of this agent.

   -hhelpfile     Obtain  the  help text (see pmdaText(3)) for the metrics
                  from this file rather than from the path specified  with
                  pmdaDSO(3) or pmdaDaemon(3).

   -iport         Expect PMCD to connect on inet port (number or name).

   -6port         Expect PMCD to connect on ipv6 port (number or name).

   -llogfile      Redirect diagnostics and trace output to logfile.

   -p             Expect PMCD to supply stdin/stdout pipe.

   -usocket       Expect PMCD to connect on unix domain socket.

   The  pmdaGetOptions  interface will also capture the following options,
   and store them within the opts parameter:

   -Uusername     Set the user account name under which  the  PMDA  should
                  execute.

   Only one of -i, -6, -p and -u may be specified.  If none of these three
   options is given, a pipe (-p)  is  assumed.   When  these  options  are
   encountered  by pmdaGetOpt, the option is processed and the next option
   is examined.  Therefore, pmdaGetOpt will only  return  when  an  option
   other  than  those  listed  above  is  found, or the end of the list is
   reached.  The returned value will be the argument or EOF, respectively.

   A PMDA can control which of these options the program will accept  with
   either  the opts or optstring argument.  To accept all the options, the
   PMDA should call pmdaGetOptions with the  short_options  field  of  the
   opts  structure  set  to the PMDA_OPTIONS macro, or pmdaGetOpt with the
   option string "D:d:h:i:l:pu:".  Any PMDA  specific  options  should  be
   added  to these strings in the style of getopt(3), and will be returned
   by both pmdaGetOptions and pmdaGetOpt if encountered.

   When  a  command  line  option  usage  error   is   detected   in   the
   pmdaGetOptions  interface,  the  error field of the opts structure will
   contain a non-zero error count.

   pmdaGetOpt takes a pointer to an int, err, which is used  as  an  error
   count.   This  variable should be initialized to zero before pmdaGetOpt
   is first called, and tested when pmdaGetOpt returns EOF.

   Neither  pmdaGetOptions  nor  pmdaGetOpt  modify  their  argc  or  argv
   parameters.

   The  global  variables used by the system getopt (3) interface may also
   be used by the caller of pmdaGetOpt within the argument parsing loop.

   On the other hand, the pmdaGetOptions interface does not utilize global
   variables  at all (neither reading nor modifying them).  Instead, these
   variables can be access via the opts fields of the same name.

DIAGNOSTICS

   Both pmdaGetOptions and pmdaGetOpt will display the same error messages
   as getopt.

CAVEAT

   The  options  -D,  -d,  -i,  -l,  -p  and -u cannot be reused for other
   purposes by the PMDA, unless using the override method provided by  the
   pmdaGetOptions  interface,  which operates in the same way as described
   for the pmGetOptions(3) interface used by PMAPI client tools.

   The PMDA must be using PMDA_INTERFACE_2 or later, as specified  in  the
   call to pmdaDSO(3) or pmdaDaemon(3).

SEE ALSO

   pmdbg(1), getopt(3), pmgetopt_r(3), pmGetOptions(3), PMAPI(3), PMDA(3),
   pmdaDaemon(3), pmdaDSO(3) and pmdaText(3).



Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.


Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.


Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.