Autodocs for `Grid Engine GDI Library'


Next: , Up: (dir)


1 QTCSH


1.1 sge_get_qtask_args

NAME
          sge_get_qtask_args() -- get args for a qtask entry

SYNOPSIS
          char** sge_get_qtask_args(void *ctx, char *taskname, lList **answer_list)

FUNCTION
          This function reads the qtask files and returns an array of args for the
          given qtask entry.  Calling this function will initialize the qtask
          framework, if it has not already been initialized.

INPUTS
          void *ctx           - the communication context (sge_gdi_ctx_class_t *)
          char *taskname      - The name of the entry for which to look in the qtask
                                files
          lList **answer_list - For returning error information

RESULT
          char **           A NULL-terminated array of args for the given qtask
                            entry

NOTES
          MT-NOTE: sge_get_qtask_args() is MT safe with respect to itself, but it is
                   not thread safe to use this function in conjuction with the
                   init_qtask_config() or sge_init() functions or accessing the
                   task_config global variable.


2 gdi


2.1 ctx


2.1.1 gdi_mt_init

NAME
          gdi_mt_init() -- Initialize GDI state for multi threading use.

SYNOPSIS
          void gdi_mt_init(void)

FUNCTION
          Set up GDI. This function must be called at least once before any of the
          GDI functions is used. This function is idempotent, i.e. it is safe to
          call it multiple times.
          
          Thread local storage for the GDI state information is reserved.

INPUTS
          void - NONE

RESULT
          void - NONE

NOTES
          MT-NOTE: gdi_mt_init() is MT safe


2.1.2 gdi_state_get_

NAME
          gdi_state_get_????() - read access to gdilib global variables

FUNCTION
          Provides access to either global variable or per thread global
          variable.


2.1.3 sge_daemonize

NAME
          sge_daemonize() -- Daemonize the current application

SYNOPSIS
          int sge_daemonize(fd_set *keep_open)

FUNCTION
          Daemonize the current application. Throws ourself into the
          background and dissassociates from any controlling ttys.
          Don't close filedescriptors mentioned in 'keep_open'.

INPUTS
          fd_set *keep_open - bitmask
          args   optional args

RESULT
          int - Successfull?
              1 - Yes
              0 - No

NOTES
          MT-NOTES: sge_daemonize() is not MT safe


2.1.4 sge_daemonize_finalize

NAME
          sge_daemonize_finalize() -- finalize daemonize process

SYNOPSIS
          int sge_daemonize_finalize(fd_set *keep_open)

FUNCTION
          report successful daemonizing to the parent process and close
          all file descriptors. Set file descirptors 0, 1 and 2 to /dev/null
          
          sge_daemonize_prepare() and sge_daemonize_finalize() will replace
          sge_daemonize() for multithreades applications.
          
          sge_daemonize_finalize() must be called by the thread who have called
          sge_daemonize_prepare().

INPUTS
          fd_set *keep_open - file descriptor set to keep open

RESULT
          int - true on success

SEE ALSO


2.1.5 sge_daemonize_prepare

NAME
          sge_daemonize_prepare() -- prepare daemonize of process

SYNOPSIS
          int sge_daemonize_prepare(void)

FUNCTION
          The parent process will wait for the child's successful daemonizing.
          The client process will report successful daemonizing by a call to
          sge_daemonize_finalize().
          The parent process will exit with one of the following exit states:
          
          typedef enum uti_deamonize_state_type {
             SGE_DEAMONIZE_OK           = 0,  ok
             SGE_DAEMONIZE_DEAD_CHILD   = 1,  child exited before sending state
             SGE_DAEMONIZE_TIMEOUT      = 2   timeout whild waiting for state
          } uti_deamonize_state_t;
          
          Daemonize the current application. Throws ourself into the
          background and dissassociates from any controlling ttys.
          Don't close filedescriptors mentioned in 'keep_open'.
          
          sge_daemonize_prepare() and sge_daemonize_finalize() will replace
          sge_daemonize() for multithreaded applications.
          
          sge_daemonize_prepare() must be called before starting any thread.
          

INPUTS
          void - none

RESULT
          int - true on success, false on error

SEE ALSO


2.2 request


2.2.1 get_cl_ping_value

NAME
          get_cl_ping_value() -- get commlib parameter list value "cl_ping"

SYNOPSIS
          static bool get_cl_ping_value(void)

FUNCTION
          Returns the value of the "cl_ping" commlib parameter. The value is true
          or false and specifies if gdi should send a SIM message to qmaster which
          should be used for desiction making if qmaster is still working or
          unreachable.

INPUTS
          void - none

RESULT
          static bool - true or false (enabled or disabled)

SEE ALSO


2.2.2 get_gdi_retries_value

NAME
          get_gdi_retries_value() -- get commlib parameter list value "gdi_retries"

SYNOPSIS
          static int get_gdi_retries_value(void)

FUNCTION
          Returns the nr of retries on synchron receive retries when getting a
          GDI response message.

INPUTS
          void - none

RESULT
          static int - configured "gdi_retries" value (set by qmaster_params)

SEE ALSO


2.2.3 sge_gdi2_is_done

NAME
          sge_gdi2_is_done() -- check if  GDI request is finished

SYNOPSIS
          bool
          sge_gdi2_is_done(sge_gdi_ctx_class_t* ctx, lList **alpp, state_gdi_multi *state)

FUNCTION
          This function returns true if the GDI request which was previously been created
          via sge_gdi2_multi() is finished or if it is will waiting to be executed.
          A return value of "true" means that a call of sge_gdi2_wait() will return
          immediatly because the request has been handled and an answer is available.
          "false" means that a call of sge_gdi2_wait() would block because the
          GDI request is not done till now.
          
          Input parameters for this function are the GDI context "ctx"
          and the "state" structure which has to be initialized by calling
          sge_gdi2_multi(... mode=SGE_GDI_RECORED...) zero or multiple times
          and sge_gdi2_multi(... mode=SGE_GDI_SEND...) once.

INPUTS
          sge_gdi_ctx_class_t* ctx - context object
          lList **alpp             - answer list for this function
          state_gdi_multi *state   - gdi state variable

RESULT
          bool - is request already done?
             true  - yes
             false - no

NOTES
          MT-NOTE: sge_gdi2_is_done() is MT safe

SEE ALSO


2.2.4 sge_gdi2_wait

NAME
          sge_gdi2_wait() -- wait till a GDI request is finished

SYNOPSIS
          bool
          sge_gdi2_wait(sge_gdi_ctx_class_t* ctx, lList **alpp, lList **malpp,
                        state_gdi_multi *state)

FUNCTION
          This functions waits until a GDI multi request is handled by
          a qmaster "worker" thread. This means that the thread executing this
          function will block till either the GDI request is done successfully
          or till a detailed list of error messages, describing the reason
          why the request could not be executed, is available.
          
          Input parameters for this function are the GDI context "ctx"
          and the "state" structure which has to be initialized by calling
          sge_gdi2_multi(... mode=SGE_GDI_RECORED...) zero or multiple times
          and sge_gdi2_multi(... mode=SGE_GDI_SEND...) once.
          
          If the function itself fails it will append answer list messages
          to "alpp" and return this "false" as return value". Otherwise
          the multi answer list "malpp" will be initialized, which can later
          on be evaluated with sge_gdi_extract_answer(), and the function
          will return with "true".

INPUTS
          sge_gdi_ctx_class_t* ctx - context object
          lList **alpp             - answer list for this function
          lList **malpp            - multi answer list
          state_gdi_multi *state   - gdi state variable

RESULT
          bool - error state
             true  - success
             false - error

EXAMPLE
          {
             state_gdi_multi state = STATE_GDI_MULTI_INIT;
             lEnumeration *what_cqueue = lWhat("%T(ALL)", CQ_Type);
             lCondition *where_cqueue = NULL;
             lEnumeration *what_job = lWhat("%T(ALL)", JB_Type);
             lCondition *where_job = NULL;
             lList *local_answer_list = NULL;
             int cqueue_request_id;
             int job_request_id;
          
             cqueue_request_id = ctx->gdi_multi(ctx, &local_answer_list, SGE_GDI_RECORD,
                                               SGE_CQ_LIST, SGE_GDI_GET, NULL,
                                               where_cqueue, what_cqueue, &state, true);
             job_request_id = ctx->gdi_multi(ctx, &local_answer_list, SGE_GDI_SEND,
                                             SGE_JB_LIST, SGE_GDI_GET, NULL,
                                             where_job, what_job, &state, true);
             if (cqueue_request_id != -1 && job_request_id != -1 &&
                 answer_list_has_error(&local_answer_list) == false) {
                lList *multi_answer_list = NULL;
                lList *list_cqueue = NULL;
                lList *list_job = NULL;
                lList *answer_cqueue = NULL;
                lList *answer_job = NULL;
                bool local_ret;
          
                local_ret = ctx->gdi_wait(ctx, &local_answer_list, &multi_answer_list, &state);
                sge_gdi_extract_answer(&answer_cqueue, SGE_GDI_GET, SGE_CQ_LIST,
                                       cqueue_request_id, multi_answer_list, &list_cqueue);
                sge_gdi_extract_answer(&answer_job, SGE_GDI_GET, SGE_CQ_LIST,
                                       job_request_id, multi_answer_list, &list_job);
          
                if (local_ret == false || answer_list_has_error(&answer_cqueue) ||
                    answer_list_has_error(&answer_job) || answer_list_has_error(&local_answer_list)) {
                   ERROR((SGE_EVENT, "GDI multi request failed"));
                } else {
                   INFO((SGE_EVENT, "GDI multi request was successfull"));
                   INFO((SGE_EVENT, "got cqueue list with "sge_U32CFormat" and cqueue answer "
                         "list with "sge_U32CFormat" elements.", sge_u32c(lGetNumberOfElem(list_cqueue)),
                         sge_u32c(lGetNumberOfElem(answer_cqueue))));
                   INFO((SGE_EVENT, "got job list with "sge_U32CFormat" and job answer "
                         "list with "sge_U32CFormat" elements.", sge_u32c(lGetNumberOfElem(list_job)),
                         sge_u32c(lGetNumberOfElem(answer_job))));
                }
                lFreeList(&multi_answer_list);
                lFreeList(&answer_cqueue);
                lFreeList(&answer_job);
                lFreeList(&list_cqueue);
                lFreeList(&list_job);
             } else {
                ERROR((SGE_EVENT, "QMASTER INTERNAL MULTI GDI TEST FAILED"));
                ERROR((SGE_EVENT, "unable to send intern gdi request (cqueue_request_id=%d, "
                       "job_request_id=%d", cqueue_request_id, job_request_id));
             }
          
             lFreeList(&local_answer_list);
          }

NOTES
          MT-NOTE: sge_gdi2_wait() is MT safe

SEE ALSO


2.2.5 sge_gdi_extract_answer

NAME
          sge_gdi_extract_answer() -- exctact answers of a multi request.

SYNOPSIS
          lList* sge_gdi_extract_answer(u_long32 cmd, u_long32 target,
                                        int id, lList* mal, lList** olpp)

FUNCTION
          This function extracts the answer for each invidual request on
          previous sge_gdi_multi() calls.

INPUTS
          lList** alpp    -
             List for answers if an error occurs in sge_gdi_extract_answer
             This list gets allocated by GDI. The caller is responsible for
             freeing. A response is a list element containing a field with a
             status value (AN_status). The value STATUS_OK is used in case of
             success. STATUS_OK and other values are defined in sge_answerL.h.
             The second field (AN_text) in a response list element is a string
             that describes the performed operation or a description of an error.
          
          u_long32 cmd    -
             bitmask which decribes the operation
             (see sge_gdi_multi)
          
          u_long32 target -
             unique id to identify masters list
             (see sge_gdi_multi)
          
          int id          -
             unique id returned by a previous
             sge_gdi_multi() call.
          
          lList* mal      - List of answer/response lists returned from
             sge_gdi_multi(mode=SGE_GDI_SEND)
          
          lList** olpp    -
             This parameter is used to get a list in case of SGE_GDI_GET command.

RESULT
          true   in case of success
          false  in case of error

NOTES
          MT-NOTE: sge_gdi_extract_answer() is MT safe


2.3 request_internal


2.3.1 –Packets_and_Taks

NAME
          Packets_and_Tasks -- Functions and structures behind GDI

FUNCTION
           Packets and tasks are structures which are used in the methods
           implementing GDI. The real C structure names are
          
              "sge_gdi_packet_class_t" and
              "sge_gdi_task_class_t".
          
           An instance of the packet structure represents a GDI request.
           Each packet has assigned at least one task. But it may have
           multiple tasks. A Packet with one task represents a
           singe GDI request and that one with multiple task represents
           a multi GDI request.
          
           GDI requests are created by function calls sge_gdi() and
           sge_gdi_multi(). Internally the packet and task data
           structures are used to represent that request information.
          
           Within the client side code (sge_gdi(), sge_gdi_multi(),
           sge_gdi_wait(), sge_extract_answer() ... ) there are multiple
           functions used to create and verify packets and tasks:
          
              sge_gdi_packet_append_task()
              sge_gdi_packet_create()
              sge_gdi_packet_create_base()
              sge_gdi_packet_create_multi_answer()
              sge_gdi_packet_free()
              sge_gdi_packet_get_last_task_id()
              sge_gdi_packet_initialize_auth_info()
              sge_gdi_task_create()
              sge_gdi_task_free()
          
           Following functions are used to handle data transfer
           from external GDI clients (qstat, qconf, ...) or internal
           GDI clients (scheduler, JVM, ...)
          
              sge_gdi_packet_execute_internal()
              sge_gdi_packet_execute_external()
              sge_gdi_packet_wait_for_result_internal()
              sge_gdi_packet_wait_for_result_external()
          
           Data transfer of packets transfered  between external GDI
           clients is prepared with following functions process:
          
              sge_gdi_packet_get_pb_size()
              sge_gdi_packet_initialize_auth_info()
              sge_gdi_packet_pack()
              sge_gdi_packet_pack_task()
              sge_gdi_packet_parse_auth_info()
              sge_gdi_packet_unpack()
          
          Within the master process special syncronisation
          for the thread accessing packet and task datastructures
          is required because the data structures are not thread
          safe per default. Only one thread is allowed to access
          a packet or task structure at the same time. To synchronize
          their activities between "listener" and "worker"
          threads a queue of packet elements is used. This
          "Master_Packet_Queue" is guarded by the function calls
          
              sge_gdi_packet_queue_wait_for_new_packet()
              sge_gdi_packet_queue_store_notify()
              sge_gdi_packet_queue_wakeup_all_waiting()
          
           Additional synchronisation functions are
          
              sge_gdi_packet_wait_till_handled()
              sge_gdi_packet_broadcast_that_handled()

SEE ALSO


2.3.2 sge_gdi_packet_append_task

NAME
          sge_gdi_packet_append_task() -- append an additional GDI task

SYNOPSIS
          bool
          sge_gdi_packet_append_task(sge_gdi_packet_class_t *packet,
                                     lList **answer_list, u_long32 target,
                                     u_long32 command, lList **lp,
                                     lList **a_list, lCondition **condition,
                                     lEnumeration **enumeration,
                                     bool do_copy, bool do_verify)

FUNCTION
          This function creates a new GDI task representing one
          request of a multi GDI request. The task will be appended to
          the list of tasks part of "packet". It will be initialized
          with the values given by "target" and "command". Pointer
          parameters like "lp", "a_list", "condition", and "enumeration"
          will either be copied ("do_copy" == true) or they will just be
          used as they are. In that case they will direct to NULL after
          the function returns. The memory allocated by the provided
          pointer parameters will be released when the task is destroyed
          they are part of.
          
          In case of any error the function will return "false"
          and the "answer_list" will be filled with a message.
          Causes for errors are:
             - malloc failure
             - verification failure (sge_gdi_task_verify)

INPUTS
          sge_gdi_packet_class_t *packet - packet
          lList **answer_list            - answer list used by this function
          u_long32 target                - GDI target value
          u_long32 command               - GDI command
          lList **lp                     - list pointer
          lList **a_list                 - answer list pointer
          lCondition **condition         - CULL condition
          lEnumeration **enumeration     - CULL enumeration
          bool do_copy                   - do copy all elements passed
                                           to this structure

RESULT
          bool - error state
             true  - success
             false - error (answer_list will be filled with detailed information)

NOTES
          MT-NOTE: sge_gdi_packet_append_task() is MT safe

SEE ALSO


2.3.3 sge_gdi_packet_broadcast_that_handled

NAME
          sge_gdi_packet_broadcast_that_handled() -- broadcast to waiting threads

SYNOPSIS
          void
          sge_gdi_packet_broadcast_that_handled(sge_gdi_packet_class_t *packet)

FUNCTION
          This functions wakes up all threads waiting in
          sge_gdi_packet_wait_till_handled().
          
          This function is used to synchronize packet producers (listerner,
          scheduler, jvm thread ...) with packet consumers (worker threads)
          which all use a packet queue to synchronize the access to
          packet elements.
          
          Packet producers store packets in the packet queue and then
          they call sge_gdi_packet_wait_till_handled(). Packet consumers
          fetch a packet from the queue. After they have finished using
          the packet structure they call this function to notify
          the waiting threads that the packet is not accessed anymore.

INPUTS
          sge_gdi_packet_class_t *packet - packet element

RESULT
          void - NONE

NOTES
          MT-NOTE: sge_gdi_packet_broadcast_that_handled() is MT safe

SEE ALSO


2.3.4 sge_gdi_packet_create

NAME
          sge_gdi_packet_create() -- create a new GDI packet and initialize it

SYNOPSIS
          sge_gdi_packet_class_t *
          sge_gdi_packet_create(sge_gdi_ctx_class_t *ctx, lList **answer_list)

FUNCTION
          Creates a new GDI packet element and initializes all members of the
          structure.

INPUTS
          sge_gdi_ctx_class_t *ctx - GDI context
          lList **answer_list      - answer list

RESULT
          sge_gdi_packet_class_t * - new packet element or NULL in case of errors

NOTES
          MT-NOTE: sge_gdi_packet_create() is MT safe

SEE ALSO


2.3.5 sge_gdi_packet_create_base

NAME
          sge_gdi_packet_create_base() -- ???

SYNOPSIS
          sge_gdi_packet_class_t *
          sge_gdi_packet_create_base(lList **answer_list)

FUNCTION
          Creates a new GDI packet and initializes all base structure members
          where necessary information is available.
          
          "uid", "gid", "user" and "group" members part of sge_gdi_packet_class_t
          will not be initialized with this function. Instead
          sge_gdi_packet_create() can be used or the function
          sge_gdi_packet_initialize_auth_info() can be called afterwards.

INPUTS
          lList **answer_list - answer list in case of error

RESULT
          sge_gdi_packet_class_t * - new GDI packet

NOTES
          MT-NOTE: sge_gdi_packet_create_base() is MT safe

SEE ALSO


2.3.6 sge_gdi_packet_create_multi_answer

NAME
          sge_gdi_packet_create_multi_answer() -- create multi answer

SYNOPSIS
          static bool
          sge_gdi_packet_create_multi_answer(sge_gdi_ctx_class_t* ctx,
                                             lList **answer_list,
                                             sge_gdi_packet_class_t **packet,
                                             lList **malpp)

FUNCTION
          Creates a multi answer element ("malpp") from the given "packet".
          The lists and answer lists for the (multi) GDI request will be
          moved from the task structures conteined in the packet, into the
          multi answer list. After all information has been moved the packet
          and all subelement will be freed so that the *packet will be NULL
          when the function returns.
          
          Threre are no errors expected from this function. So the return
          value "false" or a filled "answer_list" will never bee seen
          after return.

INPUTS
          sge_gdi_ctx_class_t* ctx        - context (not used)
          lList **answer_list             - answer_list (not used)
          sge_gdi_packet_class_t **packet - packet
          lList **malpp                   - multi answer

RESULT
          static bool - error state
             true  - always

NOTES
          MT-NOTE: sge_gdi_packet_create_multi_answer() is MT safe

SEE ALSO


2.3.7 sge_gdi_packet_execute_external

NAME
          sge_gdi_packet_execute_external() -- execute a GDI packet

SYNOPSIS
          bool
          sge_gdi_packet_execute_external(sge_gdi_ctx_class_t* ctx,
                                          lList **answer_list,
                                          sge_gdi_packet_class_t *packet)

FUNCTION
          This functions sends a GDI "packet" from an external client
          to the qmaster process. If the packet is handled on master side
          the response is send back to the client which then will fill
          "packet" with the received information.
          
          To send packets from internal clients (threads) the function
          sge_gdi_packet_execute_internal() has to be used.
          
          Please note that in contrast to sge_gdi_packet_execute_internal()
          this function assures that the GDI request contained in the
          "packet" is completely executed (either successfull or with errors)
          after this function returns.
          
          a GDI multi answer lists structure from the information contained
          in the packet after this function has been called.

INPUTS
          sge_gdi_ctx_class_t* ctx       - context handle
          lList **answer_list            - answer list
          sge_gdi_packet_class_t *packet - packet

RESULT
          bool - error state
             true   - success
             false  - error (answer_lists will contain details)

NOTES
          MT-NOTE: sge_gdi_packet_execute_extern() is MT safe

SEE ALSO


2.3.8 sge_gdi_packet_execute_internal

NAME
          sge_gdi_packet_execute_internal() -- execute a GDI packet

SYNOPSIS
          bool
          sge_gdi_packet_execute_internal(sge_gdi_ctx_class_t* ctx,
                                          lList **answer_list,
                                          sge_gdi_packet_class_t *packet)

FUNCTION
          This functions stores a GDI "packet" in the "Master_Packet_Queue"
          so that it will be executed in future. This function can only
          be used in the context of an internal GDI client (thread in
          qmaster).
          
          To send packets from external clients
          the function sge_gdi_packet_execute_external() has to be used.
          
          Please note that in contrast to sge_gdi_packet_execute_external()
          this function does not assures that the GDI request contained in the
          "packet" is already executed after this function returns.
          
          sge_gdi_packet_wait_for_result_internal() has to be called to
          assure this. This function will also creates a GDI multi answer
          lists structure from the information contained in the handled
          packet after this function has been called.
          

INPUTS
          sge_gdi_ctx_class_t* ctx       - context handle
          lList **answer_list            - answer list
          sge_gdi_packet_class_t *packet - packet

RESULT
          bool - error state
             true   - success
             false  - error (answer_lists will contain details)

NOTES
          MT-NOTE: sge_gdi_packet_execute_extern() is MT safe

SEE ALSO


2.3.9 sge_gdi_packet_free

NAME
          sge_gdi_packet_free() -- free memory allocated by packet

SYNOPSIS
          bool sge_gdi_packet_free(sge_gdi_packet_class_t **packet)

FUNCTION
          Releases the memory allocated by all members of the "packet"
          structure including the list of tasks and sublists part of the
          tasks.
          
          The caller has to take care that the packet is not part of
          a packet queue when this function is called!

INPUTS
          sge_gdi_packet_class_t **packet - packet

RESULT
          bool - error state
             true  - success
             false - error

NOTES
          MT-NOTE: sge_gdi_packet_free() is not MT safe

SEE ALSO


2.3.10 sge_gdi_packet_get_last_task_id

NAME
          sge_gdi_packet_get_last_task_id() -- returns the last used task id

SYNOPSIS
          u_long32
          sge_gdi_packet_get_last_task_id(sge_gdi_packet_class_t *packet)

FUNCTION
          Returns the last used task id in a package or 0 if there is no task.
          Can be used to get the id of the last task created with
          sge_gdi_packet_append_task()

INPUTS
          sge_gdi_packet_class_t *packet - packet pointer

RESULT
          u_long32 - task id in the range [1, ULONG32_MAX]
                     or 0

NOTES
          MT-NOTE: sge_gdi_packet_get_last_task_id() is not MT safe

SEE ALSO


2.3.11 sge_gdi_packet_get_pb_size

NAME
          sge_gdi_packet_get_pb_size() -- returns the needed puckbuffer size

SYNOPSIS
          u_long32 sge_gdi_packet_get_pb_size(sge_gdi_packet_class_t *packet)

FUNCTION
          This function checks how lage a packbuffer needs to be so that
          the given "packet" can be packed completely.
          
          This operation is needed to avoid continuous reallocation
          when the real buffer should be allocated.

INPUTS
          sge_gdi_packet_class_t *packet - packet pointer

RESULT
          u_long32 - size in byte

NOTES
          MT-NOTE: sge_gdi_packet_get_pb_size() is MT safe

SEE ALSO


2.3.12 sge_gdi_packet_initialize_auth_info

NAME
          sge_gdi_packet_initialize_auth_info() -- initialize auth_info string

SYNOPSIS
          bool
          sge_gdi_packet_initialize_auth_info(sge_gdi_ctx_class_t *ctx,
                                              sge_gdi_packet_class_t *packet_handle,
                                              bool use_euid_egid)

FUNCTION
          Initialize the "auth_info" substring part of the "packet_handle".
          To initialize these values the functions get_uid(), get_gid(),
          get_username() and get_groupname() part of the ctx structure.
          will be used.

INPUTS
          sge_gdi_ctx_class_t *ctx              - context
          sge_gdi_packet_class_t *packet_handle - context
          use_euid_egid                         - use effective uid, gid

RESULT
          bool - error state
             true  - success
             false - error

NOTES
          MT-NOTE: sge_gdi_packet_initialize_auth_info() is MT safe

SEE ALSO


2.3.13 sge_gdi_packet_is_handled

NAME
          sge_gdi_packet_is_handled() -- returns if packet was handled by worker

SYNOPSIS
          void
          sge_gdi_packet_is_handled(sge_gdi_packet_class_t *packet)

FUNCTION
          Returns if the given packet was already handled by a worker thread.
          "true" means that the packet is completely done so that a call
          to sge_gdi_packet_wait_till_handled() will return immediately. If
          "false" is returned the the packet is not finished so a call to
          sge_gdi_packet_wait_till_handled() might block when it is called
          afterwards.

INPUTS
          sge_gdi_packet_class_t *packet - packet element

RESULT
          bool - true    packet was already handled by a worker
                 false   packet is not done.

NOTES
          MT-NOTE: sge_gdi_packet_is_handled() is MT safe

SEE ALSO


2.3.14 sge_gdi_packet_pack

NAME
          sge_gdi_packet_pack() -- pack a GDI packet

SYNOPSIS
          bool
          sge_gdi_packet_pack(sge_gdi_packet_class_t * packet, lList**answer_list,
                              sge_pack_buffer *pb)

FUNCTION
          This functions packs all data representing a multi GDI request
          into "pb". Errors will be reported with a corresponding
          "answer_list" message and a negative return value.
          
          "pb" has to be initialized before this function is called.
          init_packbuffer() or a similar function has do be used to
          initialize this "pb". The function sge_gdi_packet_get_pb_size()
          might be used to calculate the maximum size as if the buffer
          would be needed to pack all tasks of a multi GDI request.
          Using this size as initial size for the "pb"
          will prevent continuous reallocation of memory in this
          function.

INPUTS
          sge_gdi_packet_class_t * packet - GDI packet
          lList **answer_list             - answer list
          sge_pack_buffer *pb             - backbuffer

RESULT
          bool - error state
             true  - success
             false - error

NOTES
          MT-NOTE: sge_gdi_packet_pack() is MT safe

SEE ALSO


2.3.15 sge_gdi_packet_pack_task

NAME
          sge_gdi_packet_pack_task() -- pack a single GDI task

SYNOPSIS
          bool
          sge_gdi_packet_pack_task(sge_gdi_packet_class_t * packet,
                                   sge_gdi_task_class_t * task,
                                   lList **answer_list,
                                   sge_pack_buffer *pb)

FUNCTION
          This functions packs all data representing one GDI request
          of a mutli GDI request (represented by "packet" and "task")
          into "pb". Errors will be reported with a corresponding
          "answer_list" message and a negative return value.
          
          "pb" has to be initialized before this function is called.
          init_packbuffer() or a similar function has do be used to
          initialize this "pb". The function sge_gdi_packet_get_pb_size()
          might be used to calculate the maximum size as if the buffer
          would be needed to pack all tasks of a multi GDI request.
          Using this size as initial size for the "pb"
          will prevent continuous reallocation of memory in this
          function.

INPUTS
          sge_gdi_packet_class_t * packet - GDI packet
          sge_gdi_task_class_t * task     - GDI task
          lList **answer_list             - answer_list
          sge_pack_buffer *pb             - packing buffer

RESULT
          bool - error state
             true  - success
             false - failure

NOTES
          MT-NOTE: sge_gdi_packet_pack_task() is MT safe

SEE ALSO


2.3.16 sge_gdi_packet_parse_auth_info

NAME
          sge_gdi_packet_parse_auth_info() -- returns parsed auth_info

SYNOPSIS
          bool
          sge_gdi_packet_parse_auth_info(sge_gdi_packet_class_t *packet,
                                         lList **answer_list, uid_t *uid,
                                         char *user, size_t user_len,
                                         gid_t *gid, char *group,
                                         size_t group_len)

FUNCTION
          Decrypts and parses the "auth_info" substring part of "packet" and
          writes that information into the variables "uid", "gid", "user" and
          "group". If the buffer sizes of "user" and/or "group" are too small
          than the strings will be truncated. Corresponding buffer sizes have
          to be provided by "user_len" and "group_len".
          
          If "authinfo" does not contain useful information, then
          the function will return with a value of "false" and answer_list
          will be filled.

INPUTS
          sge_gdi_packet_class_t *packet - GDI packet
          lList **answer_list            - answer_list for error messages
          uid_t *uid                     - user id
          char *user                     - user name buffer
          size_t user_len                - length of buffer "user"
          gid_t *gid                     - group id
          char *group                    - group name buffer?
          size_t group_len               - length of group name buffer

RESULT
          bool - error state
             true  - success
             false - error

NOTES
          MT-NOTE: sge_gdi_packet_parse_auth_info() is MT safe

SEE ALSO


2.3.17 sge_gdi_packet_unpack

NAME
          sge_gdi_packet_unpack() -- unpacks a GDI packet

SYNOPSIS
          bool
          sge_gdi_packet_unpack(sge_gdi_packet_class_t **packet,
                                lList **answer_list, sge_pack_buffer *pb)

FUNCTION
          This functions unpacks all data representing a single or multi
          GDI request. The information is parsed from the given packing
          buffer "pb" and ist stored into "packet". Necessary memory will
          be allocated.

INPUTS
          sge_gdi_packet_class_t ** packet - new GDI packet
          lList **answer_list              - answer_list
          sge_pack_buffer *pb              - packing buffer

RESULT
          bool - error state
             true  - success
             false - error

NOTES
          MT-NOTE: sge_gdi_packet_unpack() is MT safe

SEE ALSO


2.3.18 sge_gdi_packet_wait_for_result_external

NAME
          sge_gdi_packet_wait_for_result_external() -- wait for packet result

SYNOPSIS
          bool
          sge_gdi_packet_wait_for_result_external(sge_gdi_ctx_class_t* ctx,
                                                  lList **answer_list,
                                                  sge_gdi_packet_class_t *packet,
                                                  lList **malpp)

FUNCTION
          Despite to its name this function does not wait. This is not necessary
          because the GDI request handled in the execution process previously
          is already done. A call to this function simply breates a GDI multi
          answer list.

INPUTS
          sge_gdi_ctx_class_t* ctx        - context handle
          lList **answer_list             - answer list
          sge_gdi_packet_class_t **packet - GDI packet
          lList **malpp                   - multi answer list

RESULT
          bool - error state
             true  - success
             false - error

NOTES
          MT-NOTE: sge_gdi_packet_wait_for_result_external() is MT safe

SEE ALSO


2.3.19 sge_gdi_packet_wait_for_result_internal

NAME
          sge_gdi_packet_wait_for_result_internal() -- wait for handled packet

SYNOPSIS
          bool
          sge_gdi_packet_wait_for_result_internal(sge_gdi_ctx_class_t* ctx,
                                                  lList **answer_list,
                                                  sge_gdi_packet_class_t *packet,
                                                  lList **malpp)

FUNCTION
          This function can only be called in a qmaster thread. Then
          this function blocks until the GDI packet, which has to be
          given to qmaster via sge_gdi_packet_execute_internal(), is
          executed completely (either successfull or with errors).
          
          After that it creates a multi answer list.

INPUTS
          sge_gdi_ctx_class_t* ctx        - context handle
          lList **answer_list             - answer list
          sge_gdi_packet_class_t **packet - GDI packet
          lList **malpp                   - multi answer list

RESULT
          bool - error state
             true  - success
             false - error

NOTES
          MT-NOTE: sge_gdi_packet_wait_for_result_internal() is MT safe

SEE ALSO


2.3.20 sge_gdi_packet_wait_till_handled

NAME
          sge_gdi_packet_wait_till_handled() -- wait til packet is handled

SYNOPSIS
          void
          sge_gdi_packet_wait_till_handled(sge_gdi_packet_class_t *packet)

FUNCTION
          This function blocks the calling thread till another one executes
          sge_gdi_packet_broadcast_that_handled(). Mutiple threads can use
          this call to get response if the packet is accessed by someone
          else anymore.
          
          This function is used to synchronize packet producers (listerner,
          scheduler, jvm thread ...) with packet consumers (worker threads)
          which all use a packet queue to synchronize the access to
          packet elements.
          
          Packet producers store packets in the packet queue and then
          they call this function to wait that they can access the packet
          structure again.

INPUTS
          sge_gdi_packet_class_t *packet - packet element

RESULT
          void - none

NOTES
          MT-NOTE: sge_gdi_packet_wait_till_handled() is MT safe

SEE ALSO


2.3.21 sge_gdi_task_free

NAME
          sge_gdi_task_free() -- free a gdi task structure

SYNOPSIS
          static bool
          sge_gdi_task_free(sge_gdi_task_class_t **task)

FUNCTION
          free all elements of the gdi task structure and the structure itself.

INPUTS
          sge_gdi_task_class_t **task - pointer to the task structure pointer

RESULT
          static bool -
             true - success (always)

NOTES
          MT-NOTE: sge_gdi_task_free() is MT safe as long as the structure
                   passed to this function is not accessed by more than one
                   thread simultaneously.

SEE ALSO


2.3.22 sge_gdi_task_get_operation_name

NAME
          sge_gdi_task_get_operation_name() -- get command name

SYNOPSIS
          const char *
          sge_gdi_task_get_operation_name(sge_gdi_task_class_t *task)

FUNCTION
          This function returns a string of representing the command type
          of a task part of a multi GDI request (e.g the function will return
          "GET" when (task->command == SGE_GDI_GET))

INPUTS
          sge_gdi_task_class_t *task - gdi task

RESULT
          const char * - string

NOTES
          MT-NOTE: sge_gdi_task_get_operation_name() is MT safe


2.4 security


2.4.1 set_sec_cred

NAME
          set_sec_cred -- get credential for security system

SYNOPSIS
          int set_sec_cred(lListElem *job);

FUNCTION
          Tries to get credential for a security system (DCE or KERBEROS) and
          sets the resulting information in the job structure.
          If an error occurs the return value is unequal 0
          Called by submitting client

INPUTS
          job - the job structure

RETURN
          0  in case of success, something different otherwise

NOTES
          Hope, the above description is correct - don't know the
          DCE/KERBEROS code.

NOTES
          Hope, the above description is correct - don't know the
          DCE/KERBEROS code.


2.4.2 sge_security_exit

NAME
          sge_security_exit -- exit sge security

SYNOPSIS
          void sge_security_exit(int status);

FUNCTION
          Execute any routines that the security mechanism needs to do when
          the program

INPUTS
          status - exit status value

NOTES
          MT-NOTE: sge_security_exit() is MT safe


2.4.3 sge_security_initialize

NAME
          sge_security_initialize -- initialize sge security

SYNOPSIS
          int sge_security_initialize(char *name);

FUNCTION
          Initialize sge security by initializing the underlying security
          mechanism and setup the corresponding data structures

INPUTS
          name - name of enrolling program

RETURN
          0  in case of success, something different otherwise

NOTES
          MT-NOTE: sge_security_initialize() is MT safe (assumptions)


2.5 setup


2.5.1 sge_gdi_shutdown

NAME
          sge_gdi_shutdown() -- gdi shutdown.

SYNOPSIS
          int sge_gdi_shutdown()

FUNCTION
          This function has to be called before quitting the program. It
          cancels registration at commd.

NOTES
          MT-NOTES: sge_gdi_setup() is MT safe


2.6 sge


2.6.1 sge_gdi_check_permission

NAME
          sge_gdi_check_permission() -- check permissions of gdi request

SYNOPSIS
          int sge_gdi_check_permission(int option);

FUNCTION
          This function asks the qmaster for the permission (PERM_Type)
          list. The option flag specifies which right should be checked.
          It can be MANAGER_CHECK or/and OPERATOR_CHECK at this time. If
          the caller has access the function returns true.

INPUTS
          int option - check flag (MANAGER_CHECK or OPERATOR_CHECK)

RESULT
          bool true if caller has the right, false if not (false if qmaster
          not reachable)

SEE ALSO


2.6.2 sge_gdi_get_mapping_name

NAME
          sge_gdi_get_mapping_name() -- get username for host

SYNOPSIS
          int sge_gdi_get_mapping_name(char* requestedHost, char* buf,
                                       int buflen)

FUNCTION
          This function sends a PERM_Type list to the qmaster. The
          requestedHost is stored in the PERM_req_host list entry. The
          qmaster will fill up the PERM_Type list. The mapped user name
          is stored in the PERM_req_username field. The function will strcpy
          the name into the "buf" char array if the name is shorter than
          the given "buflen". On success the function returns true.

INPUTS
          char* requestedHost - pointer to char array; this is the name of
                                the host were the caller wants to get his
                                username.
          char* buf           - char array buffer to store the username
          int   buflen        - length (sizeof) buf

RESULT
          int true on success, false if not


2.6.3 sge_qexecve

NAME
          sge_qexecve() -- start a task in a tightly integrated parallel job

SYNOPSIS
          sge_tid_t sge_qexecve(const char *hostname, const char *queuename,
                                const char *cwd, const lList *environment
                                const lList *path_aliases)

FUNCTION
          Starts a task in a tightly integrated job.
          Builds a job object describing the task,
          connects to the execd on the targeted execution host,
          delivers the job object and waits for an answer.
          The answer from the execution daemon on the execution host
          contains a task id that is returned to the caller of the function.

INPUTS
          const char *hostname - name of the host on which to start the task
          const lList *environment  - list containing environment variable
                                 settings for the task that override the
                                 default environment
          const lList *path_aliases - optional a path alias list

RESULT
          sge_tid_t - the task id, if the task can be executed,
                      a value <= 0 indicates an error.

NOTES
          MT-NOTE: sge_qexecve() is not MT safe


3 gdilib


3.1 UME_LOWERBOUND

NAME
          UME_LOWERBOUND -- User Mapping Entry List

SYNOPSIS
          #include "sge_usermapL.h"
          #include <gdilib/sge_usermapL.h>
          
          enum {
             UME_cluster_user = UME_LOWERBOUND,  / username in sge/sge system /
             UME_mapping_list                    / user specific mapping list /
          };
          
          LISTDEF( UME_Type )
             SGE_STRING( UME_cluster_user )
             SGE_LIST  ( UME_mapping_list )      / UM_Type - list /

LISTEND
          NAMEDEF( UMEN )
             NAME( "UME_cluster_user" )
             NAME( "UME_mapping_list" )

FUNCTION
          UME_Type list element
          |
          *---UME_cluster_user (SGE_STRING)
          *---UME_mapping_list (SGE_LIST)
                    |
                    |
                    *----UM_mapped_user (SGE_STRING)
                    *----UM_host_list   (SGE_LIST)
                              |
                              |
                              *----STR  (SGE_STRING)  String list (ST_Type)
          

BUGS
          no bugs known
          

SEE ALSO


3.2 UM_LOWERBOUND

NAME
          UM_LOWERBOUND -- User Mapping List

SYNOPSIS
          #include "sge_usermapL.h"
          #include <gdilib/sge_usermapL.h>
          
          enum {
             UM_mapped_user = UM_LOWERBOUND,            / username @foreignhost /
             UM_host_list                               / list of hosts /
          };
          
          LISTDEF( UM_Type )
             SGE_STRING( UM_mapped_user )
             SGE_LIST  ( UM_host_list )                 / ST_Type  -  List /

LISTEND
          NAMEDEF( UMN )
             NAME( "UM_mapped_user" )
             NAME( "UM_host_list" )

BUGS
          no bugs known
          

SEE ALSO


4 pack_job_delivery


4.1 pack_job_delivery

NAME
          pack_job_delivery() -- pack a job to be sent to execd

SYNOPSIS
          int pack_job_delivery(sge_pack_buffer *pb, lListElem *jep, lList *qlp,
          lListElem *pep)

FUNCTION
          This function is used in qmaster and by qrsh -inherit to deliver
          jobs to execd's.

INPUTS
          sge_pack_buffer *pb - packing buffer
          lListElem *jep      - JB_Type

RESULT
          int - PACK_SUCCESS on success

NOTES
          MT-NOTE: pack_job_delivery() is MT safe


5 sge_any_request


5.1 general_communication_error

NAME
          general_communication_error() -- callback for communication errors

SYNOPSIS
          static void general_communication_error(int cl_error,
                                                  const char* error_message)

FUNCTION
          This function is used by cl_com_set_error_func() to set the default
          application error function for communication errors. On important
          communication errors the communication lib will call this function
          with a corresponding error number (within application context).
          
          This function should never block. Treat it as a kind of signal handler.
          
          The error_message parameter is freed by the commlib.

INPUTS
          int cl_error              - commlib error number
          const char* error_message - additional error text message

NOTES
          MT-NOTE: general_communication_error() is MT safe
          (static struct variable "sge_gdi_communication_error" is used)
          

SEE ALSO


5.2 sge_dump_message_tag

NAME
          sge_dump_message_tag() -- get tag name string

SYNOPSIS
          const char* sge_dump_message_tag(int tag)

FUNCTION
          This is a function used for getting a printable string output for the
          different message tags.
          (Useful for debugging)

INPUTS
          int tag - tag value

RESULT
          const char* - name of tag

NOTES
          MT-NOTE: sge_dump_message_tag() is MT safe


5.3 sge_get_com_error_flag

NAME
          sge_get_com_error_flag() -- return gdi error flag state

SYNOPSIS
          bool sge_get_com_error_flag(sge_gdi_stored_com_error_t error_type)

FUNCTION
          This function returns the error flag for the specified error type

INPUTS
          sge_gdi_stored_com_error_t error_type - error type value

RESULT
          bool - true: error has occured, false: error never occured

NOTES
          MT-NOTE: sge_get_com_error_flag() is MT safe

SEE ALSO


6 sge_gdi_packet


6.1 sge_gdi_packet_verify_version

NAME
          sge_gdi_packet_verify_version() -- verify packet version

SYNOPSIS
          bool sge_gdi_packet_verify_version(sge_gdi_packet_class_t *packet,
                                             lList **alpp)

FUNCTION
          This function is the replacement for the function
          verify_request_version() which was part of the source code
          before the packet structure was introduced.
          
          It compares the version information of the provided "packet"
          with the compiled-in version number GRM_GDI_VERSION.
          
          If both versions are not the same then it tries to find
          if the client which provided us with this packet structure
          has a higher version number or the binary executing
          this function. In both cases the answer_list will
          be filled with an appropriate message.

INPUTS
          sge_gdi_packet_class_t *packet - packet
          lList **alpp                   - answer list

RESULT
          bool - error state
             true  - same version
             false - different version numbers

NOTES
          MT-NOTE: sge_gdi_packet_verify_version() is not MT safe


7 sge_qtcsh


7.1 init_qtask_config

NAME
          init_qtask_config() -- ???

SYNOPSIS
          static int init_qtask_config(lList **alpp, print_func_t ostream)

FUNCTION
          ???

INPUTS
          sge_gdi_ctx_class_t *ctx        - ???
          lList **alpp         - ???
          print_func_t ostream - ???

RESULT
          static int - 0 - success
                      -1 - failed

EXAMPLE
          ???

NOTES
          MT-NOTES: init_qtask_config() is not MT safe as it uses global variables

BUGS
          ???

SEE ALSO


8 sge_security


8.1 cache_sec_cred

NAME
          cache_sec_cred() -- ???

SYNOPSIS
          bool cache_sec_cred(const char* sge_root, lListElem *jep, const char *rhost)

FUNCTION
          Called by qmaster when sending out jobs

INPUTS
          const char* sge_root
          lListElem *jep    - ???
          const char *rhost - ???

RESULT
          bool - true, if jep got modified

EXAMPLE
          ???

NOTES
          MT-NOTE:  cache_sec_cred() is MT safe (assumptions)

BUGS
          ???

SEE ALSO


9 sgeobj


9.1 sge_report


9.1.1 report_list_send

NAME
          report_list_send() -- Send a list of reports.

SYNOPSIS
          int report_list_send(const lList *rlp, const char *rhost,
                               const char *commproc, int id,
                               int synchron, u_long32 *mid)

FUNCTION
          Send a list of reports.

INPUTS
          const lList *rlp     - REP_Type list
          const char *rhost    - Hostname
          const char *commproc - Component name
          int id               - Component id
          int synchron         - true or false

RESULT
          int - error state
              0 - OK
             -1 - Unexpected error
             -2 - No memory
             -3 - Format error
             other - see sge_send_any_request()

NOTES
          MT-NOTE: report_list_send() is not MT safe (assumptions)


Function Index

Table of Contents