2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
7 #ifndef _NATIVE_CLIENT_SRC_PUBLIC_NAME_SERVICE_H_
8 #define _NATIVE_CLIENT_SRC_PUBLIC_NAME_SERVICE_H_
10 #define NACL_NAME_SERVICE_CONNECTION_MAX 8
12 #define NACL_NAME_SERVICE_SUCCESS 0
13 #define NACL_NAME_SERVICE_NAME_NOT_FOUND 1
14 #define NACL_NAME_SERVICE_DUPLICATE_NAME 2
15 #define NACL_NAME_SERVICE_INSUFFICIENT_RESOURCES 3
16 #define NACL_NAME_SERVICE_PERMISSION_DENIED 4
17 #define NACL_NAME_SERVICE_INVALID_ARGUMENT 5
19 #define NACL_NAME_SERVICE_LIST "list::C"
20 /* output buffer contains NUL separated names */
22 #define NACL_NAME_SERVICE_INSERT "insert:sih:i"
23 /* object name, max access mode, descriptor -> status */
25 #define NACL_NAME_SERVICE_DELETE "delete:s:i"
26 /* object name -> status */
28 #define NACL_NAME_SERVICE_LOOKUP_DEPRECATED "lookup:s:ih"
30 * object name -> status, descriptor; flags curried to be RDONLY.
31 * deprecated; for ABI backward compatibility while TC and apps are
35 #define NACL_NAME_SERVICE_LOOKUP "lookup:si:ih"
36 /* object name, flags -> status, descriptor */
38 #define NACL_NAME_SERVICE_TAKE_OWNERSHIP "take_ownership::"
40 * make the name service immutable by all other connections. when the
41 * owner connection is closed, the name service may become writable to
42 * all again. does not have to be implemented by all name services.
46 * Mode argument for insert and flags argument lookup must contain in
47 * the NACL_ABI_O_ACCMODE bit field one of
53 * and lookup flags argument may also contain any of
59 * though whether the latter flag bits are supported or not depends on
62 * Connection capabilities should be looked up with O_RDWR. An fstat
63 * is required if client code needs to distinguish between a (file)
64 * descriptor for which the read and write syscalls work and a
65 * connection capability, though it's better to just attempt the
66 * syscall(s) and detect the failure.
68 * When lookup occurs and asks for RDONLY, if a name entry with that
69 * name with either RDONLY or RDWR mode exists, then that entry is
70 * returned; otherwise a NACL_NAME_SERVICE_NAME_NOT_FOUND or
71 * NACL_NAME_SERVICE_PERMISSION_DENIED status is returned.
74 #endif /* _NATIVE_CLIENT_SRC_PUBLIC_NAME_SERVICE_H_ */