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.
|
[EAGAIN] | Operation would have caused the process to be suspended. |
[EBADNAME] | The object name specified is not correct. |
[EBUSY] | Resource busy. |
[ECONVERT] | Conversion error.
|
[EDAMAGE] | A damaged object was encountered.
|
[EIO] | Input/output error.
|
[EMFILE] | Too many open files for this process.
|
[ENFILE] | Too many open files in the system.
|
[ENOENT] | No such path or directory.
|
[ENOMEM] | Storage allocation request failed.
|
[ENOSPC] | No space available.
|
[ENOSYSRSC] | System resources not available to complete the request. |
[EPERM] | Operation not permitted.
|
[EUNKNOWN] | Unknown system state.
|
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 ]