0001 TPINIT(3)
0002 =========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 tpinit - Initialize Enduro/x environment
0009
0010
0011 SYNOPSIS
0012 --------
0013 #include <atmi.h>
0014
0015 int tpinit(TPINIT *'tpinfo');
0016
0017
0018 For XATMI client link with '-latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm'
0019
0020 For XATMI server link with '-latmisrv|-latmisrvnomain|-latmisrvinteg -latmi
0021 -lubf -lnstd -lpthread -lrt -lm'
0022
0023 DESCRIPTION
0024 -----------
0025 Function is intended to be called by XATMI clients, to initialize XATMI session.
0026 'tpinfo' is defined as:
0027
0028 --------------------------------------------------------------------------------
0029 struct tpinfo_t
0030 {
0031 char usrname[MAXTIDENT+2];
0032 char cltname[MAXTIDENT+2];
0033 char passwd[MAXTIDENT+2];
0034 char grpname[MAXTIDENT+2];
0035 long flags;
0036 long datalen;
0037 long data;
0038 };
0039 typedef struct tpinfo_t TPINIT;
0040 --------------------------------------------------------------------------------
0041
0042 If 'tpinfo->cltname' is set, then it is using for client process identification.
0043 If it is not set, then client process is identified as executable name.
0044 Other fields of 'tpinfo' are reserved for future use. 'tpinfo' can bet set to *NULL*.
0045 Function can be used also by ATMI server's worker threads, to initialize them.
0046 How ever call of *tpinit()* is optional, as it is automatically issued, then
0047 any of tp\* commands are invoked. At current Enduro/X version it is
0048 recommended to use *tpinit()* with NULL parameter. Also when client process
0049 does threading, then each thread needs to call *tpinit()* or it will be
0050 automatically invoked as described before. Each new thread have it's own thread
0051 local storage (TLS), which describes Enduro/X state, thus new thread will
0052 get un-initialised TLS which results in need of calling *tpinit()*.
0053
0054 Internally function opens any Posix queues needed by client, reads the environment
0055 variables and initializes XA sub-system, if configured and not set to lazy.
0056
0057 *Valid flags for TPINIT.flags*
0058
0059 *TPU_IGN* Ignore (drop) incoming unsolicited messages.
0060
0061 RETURN VALUE
0062 ------------
0063 On success, *tpinit()* returns 0. On error, -1 is returned, with *tperrno* set
0064 to indicate the error.
0065
0066 ERRORS
0067 ------
0068 Note that *tpstrerror()* returns generic error message plus custom message with
0069 debug info from last function call.
0070
0071 *TPEINVAL* Environment variables not configured, see *ex_env(5)* page.
0072
0073 *TPESYSTEM* System failure occurred during serving. See logs i.e. user log, or
0074 debugs for more info.
0075
0076 *TPEOS* System failure occurred during serving. See logs i.e. user log, or
0077 debugs for more info.
0078
0079
0080 EXAMPLE
0081 -------
0082 See *atmitest/test017_srvthread/atmisv17.c* for sample code.
0083
0084 BUGS
0085 ----
0086 Report bugs to support@mavimax.com
0087
0088 SEE ALSO
0089 --------
0090 *ex_env(5)*
0091
0092 COPYING
0093 -------
0094 (C) Mavimax, Ltd
0095