getnetconfigent()--Return a Pointer to a Netconfig Structure


  Syntax
 #include <netconfig.h>

 struct netconfig *getnetconfigent(char *);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The getnetconfigent() function returns the pointer to the netconfig structure that corresponds to the input netid.


Parameters

netid  (Input) 
A character pointer to a netid such as "tcp" or "udp".

Authorities

The caller of getnetconfigent() function must have execute (*X) authority to the /etc directory and must have read (*R) authority to the netconfig file.


Return Value

netconfig getnetconfigent() was successful. A pointer to a netconfig structure is returned.
NULL getnetconfigent() was not successful. The errno global variable is set to indicate the error.


Error Conditions

If getnetconfigent() is not successful, errno usually indicates one of the following errors. Under some conditions, errno could indicate an error other than those listed here.

[EACCES] Permission denied.
  • An attempt was made to access an object in a way forbidden by its object access permissions.
  • The job does not have access to the specified file, directory, component, or path.
[EAGAIN] Operation would have caused the process to be suspended.
[EBADNAME] The object name specified is not correct.
[EBUSY] Resource busy.
[ECONVERT] Conversion error.
  • One or more characters could not be converted from the source CCSID to the target CCSID.
[EDAMAGE] A damaged object was encountered.
  • A referenced object is damaged. The object cannot be used.
[EIO] Input/output error.
  • A physical I/O error occurred. A reference object may be damaged.
[EMFILE] Too many open files for this process.
  • An attempt was made to open more files than allowed by the value OPEN_MAX. The value of OPEN_MAX can be retrieved using the sysconf() function.
[ENFILE] Too many open files in the system.
  • A system limit has been reached for the number of files that are allowed to be concurrently open in the system.
[ENOENT] No such path or directory.
  • The directory or a component of the path name specified does not exist.
  • A named file or directory does not exist or is an empty string.
[ENOMEM] Storage allocation request failed.
  • The function needed to allocate storage, but no storage is available.
  • There is not enough memory to perform the requested function.
[ENOSPC] No space available.
  • The requested operations required additional space on the device and there is no space left. This could also be caused by exceeding the user profile storage limit when creating or transferring ownership of an object.
    • Insufficient space remains to hold the intended file.
[ENOSYSRSC] System resources not available to complete the request.
[EPERM] Operation not permitted.
  • You must have appropriate privileges or other resources to do the requested operation.
[EUNKNOWN] Unknown system state.
  • The operation failed because of an unknown system state. See any messages in the job log and correct any errors that are indicated. Then retry the operation.

Error Messages

Message ID Error Message Text
CPE3418 E Possible APAR condition or hardware failure.
CPFA0D4 E File system error occurred.
CPF3CF2 E Error(s) occurred during running of &1 API.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.
CPIA1C0 I The file /etc/netconfig cannot be opened by readers because another job has it open with write authority.


Usage Notes

getnetconfigent() returns a pointer to a netconfig structure in the netconfig file for the corresponding netid. The netid is expected in the job CCSID. It returns NULL if it is unsuccessful.

The callers of the getnetconfigent() function do not need to call the setnetconfig() function prior to calling the getnetconfigent() function but must call the freenetconfigent() function to free the storage allocated by the getnetconfigent() function.

The getnetconfigent() function will return [ENOENT] if the /etc/netconfig file does not exist. The getnetconfigent() function will fail with [ECONVERT] if the data conversion required to convert the data stored in the /etc/netconfig file cannot be converted to the job CCSID.


Example

For more information, see the example for freenetconfigent()--Free the Netconfig Structure.



API introduced: V4R2

[ Back to top | Remote Procedure Call (RPC) APIs | APIs by category ]