1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #define FILESYSTEM_SOCKET_PREFIX "/tmp/" 20 #define ANDROID_RESERVED_SOCKET_PREFIX "/dev/socket/" 21 22 /* 23 * Set up a given sockaddr_un, to have it refer to the given 24 * name in the given namespace. The namespace must be one 25 * of <code>ANDROID_SOCKET_NAMESPACE_ABSTRACT</code>, 26 * <code>ANDROID_SOCKET_NAMESPACE_RESERVED</code>, or 27 * <code>ANDROID_SOCKET_NAMESPACE_FILESYSTEM</code>. Upon success, 28 * the pointed at sockaddr_un is filled in and the pointed at 29 * socklen_t is set to indicate the final length. This function 30 * will fail if the namespace is invalid (not one of the indicated 31 * constants) or if the name is too long. 32 * 33 * @return 0 on success or -1 on failure 34 */ 35 int osi_socket_make_sockaddr_un(const char *name, int namespaceId, 36 struct sockaddr_un *p_addr, socklen_t *alen); 37