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_COF_CLOEXEC — corresponds to _NTO_COF_CLOEXEC
- _NAME_FLAG_COF_NOEVENT — corresponds to _NTO_COF_NOEVENT
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. There's 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, or a pathname component is longer than NAME_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 |
Signal handler | Yes |
Thread | Yes |