name_open()
Open a name to connect to a server
Synopsis:
#include <sys/iofunc.h>
#include <sys/dispatch.h>
int name_open( const char * name,
int flags );
Arguments:
- name
- The name that you want to open to connect to a server.
- flags
- Flags that affect the function's behavior; zero or more of the following:
- NAME_FLAG_ATTACH_GLOBAL — search for the name globally instead of locally.
- _NAME_FLAG_COF_CLOEXEC (QNX Neutrino 7.0.4 or later) — corresponds to _NTO_COF_CLOEXEC
- _NAME_FLAG_COF_INSECURE (QNX Neutrino 7.0.4 or later) — corresponds to _NTO_COF_INSECURE
- _NAME_FLAG_COF_NOEVENT (QNX Neutrino 7.0.4 or later) — corresponds to _NTO_COF_NOEVENT
- _NAME_FLAG_COF_REG_EVENTS (QNX Neutrino 7.0.4 or later) — corresponds to _NTO_COF_REG_EVENTS
For more information about the _NTO_COF_* flags, see ConnectAttach().
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The name_open() function opens name to connect to the server that registered that name. No ordering is guaranteed when accessing resources on other nodes. There's also no guarantee that the client will end up talking to the server it thinks it's connecting to; another server process could run before the server the client is expecting to talk to and use the name in name. If this is a concern, your server should call resmgr_attach() instead of name_attach() and possibly configure a security policy.
You can make the connection more secure by setting the _NAME_FLAG_COF_INSECURE and _NAME_FLAG_COF_NOEVENT flags. For more information, see the descriptions of the corresponding ConnectAttach() flags.
Returns:
A nonnegative integer representing a side-channel connection ID or coid (see ConnectAttach()), or -1 if an error occurred (errno is set).
Errors:
- EINTR
- The name_open() operation was interrupted by a signal.
- EINVAL
- One of the arguments to the function is invalid.
- ELOOP
- Too many levels of symbolic links or prefixes.
- EMFILE
- All file descriptors available to the process are currently open.
- ENAMETOOLONG
- The length of the name string exceeds PATH_MAX.
- ENFILE
- Too many files are currently open in the system.
- ENOENT
- The name doesn't exist.
Examples:
See name_attach().
Classification:
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
