arsop(2)                                                              arsop(2)


NAME
     arsop - perform an operation on an array session

SYNOPSIS
     #include <sys/arsess.h>

     int arsop(int func, ash_t ash, void *bufptr, int buflen);

DESCRIPTION
     The arsop function performs an operation on the array session identified
     by the handle ash.  If ash is less than 0, then the operation is
     performed on the array session that is associated with the calling
     process.

     Most array session operations take some sort of argument.  A pointer to
     the argument is passed as bufptr, and the length of the argument is
     specified with buflen.

     The particular operation to be performed is identified by the function
     code func, which is defined in <sys/arsess.h>.  Available array session
     operations include:

     ARSOP_NOP
            No operation involving the array session itself will be performed,
            but the function will fail if the specified array session does not
            exist.  This is a convenient way to determine if an array session
            is active.

     ARSOP_GETSPI
            Obtains the Service Provider Information associated with the array
            session and stores it into the buffer pointed to by bufptr.  If
            the argument buffer is too small to accommodate all of the Service
            Provider Information, the data will be truncated.  If the argument
            buffer is larger than the Service Provider Information associated
            with the array session, the data will be padded on the right with
            zeroes.

     ARSOP_SETSPI
            Sets the Service Provider Information associated with the array
            session to the contents of the buffer pointed to by bufptr.  If
            the argument buffer is too small, the Service Provider Information
            will be padded on the right with zeroes.  If the argument buffer
            is too large, an EINVAL error will occur.  If bufptr is NULL, then
            buflen is ignored and the array session will use the system
            default service provider information (typically all zeroes, though
            it can be changed with arsctl(2)).  The caller must be privileged
            to use this function.

     ARSOP_GETSPILEN
            Returns the number of bytes of storage that have been allocated
            for the Service Provider Information that is associated with the
            array session.  The value is stored as an int at the location


            specified by bufptr.  This can be used to determine the size of
            the buffer that is required for the ARSOP_GETSPI and ARSOP_SETSPI
            functions.

     ARSOP_SETSPILEN
            Sets the length of the Service Provider Information associated
            with the array session to value of the int pointed to by bufptr.
            An EINVAL error will occur if the value is negative or is greater
            than the system maximum value (typically 1024), and the current
            setting will remain unchanged.  If the array session currently has
            non-default service provider information associated with it, then
            that information will either be truncated or extended with zeroes
            on the end to accommodate the new length.  The caller must be
            privileged to use this function.

     ARSOP_FLUSHACCT
            Flushes any accounting data for the array session.  If array
            session accounting is active (see extacct(5)), then a record
            reporting the resource usage information that has been accumulated
            by the array session will be written.  As is always the case with
            array session accounting, if two or more members of the array
            session have different real UID's or GID's, it is unpredictable
            whose UID/GID will be included in the array session accounting
            record.  If a flush operation has already been performed, then the
            data reported by a subsequent flush or by the termination of the
            array session will only include resources that have been consumed
            since the last flush operation.  Array session accounting records
            that are written using this operation will be marked as "flushed"
            to indicate that subsequent records for the same array session may
            be forthcoming.  Under normal circumstances, the resource usage
            for an array session only includes the resources used by processes
            that have already terminated; the flushed accounting data will not
            include the resources used by any members of the array session
            that are still running.  The caller must be privileged to invoke
            this function.

     ARSOP_GETINFO
            Obtains information about the array session and stores it in the
            buffer pointed to by bufptr.  The format of the data is defined by
            the arsess_t structure, which can be found in <sys/arsess.h>.
            Note that the data in an arsess_t is system-dependent and subject
            to change without notice from one release of IRIX to another.

     ARSOP_GETCHGD
            Obtains information about resources that have already been charged
            to the array session in some way.  Typically, this would be done
            by invoking the ARSOP_FLUSHACCT function against the array
            session.  The format of the data is defined by the shacct_t
            structure, which can be found in <sys/extacct.h>, and is stored in
            the buffer pointed to by bufptr.  Note that the data in an
            shacct_t is system-dependent and subject to change without notice
            from one release of IRIX to another.


     ARSOP_RESTRICT_NEW
            Restricts any process in the array session from starting a new
            array session (for example, using newarraysess(2)).  If a
            privileged process in such an array session subsequently decides
            that it needs to start a new array session, it must first clear
            the restriction using the ARSOP_ALLOW_NEW function.  A process can
            determine if its array session has been restricted by using the
            ARSOP_GETINFO function.

     ARSOP_ALLOW_NEW
            Removes any restrictions against starting new array sessions that
            may have been placed on the array session by the
            ARSOP_RESTRICT_NEW function.  The caller must be privileged to use
            this function.

ERRORS
     arsop may fail if one or more of these conditions are true:

     EFAULT    bufptr is not a valid address

     EINVAL    func is not a valid function code

     EINVAL    The argument pointed to by bufptr is not valid

     EPERM     The current process does not have the appropriate privileges to
               perform the operation specified by func.

     ESRCH     The array session specified by ash is not currently active.

SEE ALSO
     arsctl(2), array_sessions(5).

DIAGNOSTICS
     Upon successful completion, arsop returns a value of 0.  Otherwise, a
     value of -1 is returned and errno is set to indicate the error.


                                                                        Page 3