author | Elliott Hughes <enh@google.com> | |
Wed, 2 Jul 2014 23:54:12 +0000 (23:54 +0000) | ||
committer | Android Git Automerger <android-git-automerger@android.com> | |
Wed, 2 Jul 2014 23:54:12 +0000 (23:54 +0000) |
diff --git a/libc/NOTICE b/libc/NOTICE
index 4334275fad5674fb4e2d339a99888d5c584b24e8..ca542d1cf4db65f241c77ba42b8e4b8c4eef4d4e 100644 (file)
--- a/libc/NOTICE
+++ b/libc/NOTICE
-------------------------------------------------------------------
+Copyright (C) 2006 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-------------------------------------------------------------------
+
Copyright (C) 2006 The Android Open Source Project
All rights reserved.
-------------------------------------------------------------------
+Copyright (C) 2008 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-------------------------------------------------------------------
+
Copyright (C) 2008 The Android Open Source Project
All rights reserved.
-------------------------------------------------------------------
+Copyright (C) 2013 The Android Open Source Project
+All rights reserved.
+Copyright (c) 2013-2014 NVIDIA Corporation. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (C) 2013 The Android Open Source Project
Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
All rights reserved.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by the University of
- California, Berkeley and its contributors.
-4. Neither the name of the University nor the names of its contributors
+3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
+Portions Copyright (c) 1993 by Digital Equipment Corporation.
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies, and that
+the name of Digital Equipment Corporation not be used in advertising or
+publicity pertaining to distribution of the document or software without
+specific, written prior permission.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
-------------------------------------------------------------------
Copyright (c) 1983, 1993
Copyright (c) 2009 David Schultz <das@FreeBSD.org>
All rights reserved.
+Copyright (c) 2011 The FreeBSD Foundation
+All rights reserved.
+Portions of this software were developed by David Chisnall
+under sponsorship from the FreeBSD Foundation.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2009 David Schultz <das@FreeBSD.org>
+All rights reserved.
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-------------------------------------------------------------------
+Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
+ David Chisnall <theraven@FreeBSD.org>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2011 Intel Corporation
All rights reserved.
-------------------------------------------------------------------
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2014, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2014, Linaro Limited
All rights reserved.
index 16f3e43a1207f91560c3044f9fd4275148bad187..e049d951ff9eb06e283c6e642befae4a1c73619b 100644 (file)
#include <sys/cdefs.h>
struct __res_state;
-struct resolv_cache; /* forward */
-
-/* Gets the cache for a network. Returned cache might be NULL. */
-__LIBC_HIDDEN__
-extern struct resolv_cache* __get_res_cache(unsigned netid);
/* sets the name server addresses to the provided res_state structure. The
* name servers are retrieved from the cache which is associated
__LIBC_HIDDEN__
extern ResolvCacheStatus
-_resolv_cache_lookup( struct resolv_cache* cache,
+_resolv_cache_lookup( unsigned netid,
const void* query,
int querylen,
void* answer,
*/
__LIBC_HIDDEN__
extern void
-_resolv_cache_add( struct resolv_cache* cache,
+_resolv_cache_add( unsigned netid,
const void* query,
int querylen,
const void* answer,
/* Notify the cache a request failed */
__LIBC_HIDDEN__
extern void
-_resolv_cache_query_failed( struct resolv_cache* cache,
+_resolv_cache_query_failed( unsigned netid,
const void* query,
int querylen);
index bada18a441bf17d68e1fd691c7699c4d6252edd1..d4668c3dc69966470fe17d6da0f1d7fef57c70b6 100644 (file)
int android_getnameinfofornet(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t,
int, unsigned, unsigned);
+/* delete the cache associated with a certain network */
+extern void _resolv_delete_cache_for_net(unsigned netid);
+
__END_DECLS
#endif /* _RESOLV_NETID_H */
index f4c67f369fe15d1b03ad41ccbb7601d36c42300d..a91a4b80c6c1cf12a193d302af688855b555e77c 100644 (file)
__LIBC_HIDDEN__ void res_setmark(res_state, unsigned);
u_int res_randomid(void);
+#ifdef __i386__
+# define __socketcall extern __attribute__((__cdecl__))
+#else
+# define __socketcall extern
+#endif
+
+__socketcall int __connect(int, const struct sockaddr*, socklen_t);
+
+#undef __socketcall
+
__END_DECLS
#pragma GCC visibility pop
index 65fd1c197264dae6a1c61838a670940771196538..2612d6a4d1d9b2fbfd44f7dd03bd7da42ec3940e 100644 (file)
return 0;
int ret;
do {
- ret = connect(s, addr, addrlen);
+ ret = __connect(s, addr, addrlen);
} while (ret < 0 && errno == EINTR);
int success = (ret == 0);
do {
@@ -1803,7 +1803,7 @@ _find_src_addr(const struct sockaddr *addr, struct sockaddr *src_addr, unsigned
if (mark != MARK_UNSET && setsockopt(sock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) < 0)
return 0;
do {
- ret = connect(sock, addr, len);
+ ret = __connect(sock, addr, len);
} while (ret == -1 && errno == EINTR);
if (ret == -1) {
index 77a1b4d1978a5a1133cb98c880f0fbec48030d07..419b748d4c8d27ec438bed9e94ec2e611de4ef40 100644 (file)
int max_entries;
int num_entries;
Entry mru_list;
- pthread_mutex_t lock;
int last_id;
Entry* entries;
PendingReqInfo pending_requests;
#define HTABLE_VALID(x) ((x) != NULL && (x) != HTABLE_DELETED)
+static pthread_once_t _res_cache_once = PTHREAD_ONCE_INIT;
+static void _res_cache_init(void);
+
+// lock protecting everything in the _resolve_cache_info structs (next ptr, etc)
+static pthread_mutex_t _res_cache_list_lock;
+
+/* gets cache associated with a network, or NULL if none exists */
+static struct resolv_cache* _find_named_cache_locked(unsigned netid);
+
static void
_cache_flush_pending_requests_locked( struct resolv_cache* cache )
{
}
}
-/* return 0 if no pending request is found matching the key
- * if a matching request is found the calling thread will wait
- * and return 1 when released */
+/* Return 0 if no pending request is found matching the key.
+ * If a matching request is found the calling thread will wait until
+ * the matching request completes, then update *cache and return 1. */
static int
-_cache_check_pending_request_locked( struct resolv_cache* cache, Entry* key )
+_cache_check_pending_request_locked( struct resolv_cache** cache, Entry* key, unsigned netid )
{
struct pending_req_info *ri, *prev;
int exist = 0;
- if (cache && key) {
- ri = cache->pending_requests.next;
- prev = &cache->pending_requests;
+ if (*cache && key) {
+ ri = (*cache)->pending_requests.next;
+ prev = &(*cache)->pending_requests;
while (ri) {
if (ri->hash == key->hash) {
exist = 1;
struct timespec ts = {0,0};
XLOG("Waiting for previous request");
ts.tv_sec = _time_now() + PENDING_REQUEST_TIMEOUT;
- pthread_cond_timedwait(&ri->cond, &cache->lock, &ts);
+ pthread_cond_timedwait(&ri->cond, &_res_cache_list_lock, &ts);
+ /* Must update *cache as it could have been deleted. */
+ *cache = _find_named_cache_locked(netid);
}
}
/* notify the cache that the query failed */
void
-_resolv_cache_query_failed( struct resolv_cache* cache,
+_resolv_cache_query_failed( unsigned netid,
const void* query,
int querylen)
{
Entry key[1];
+ Cache* cache;
+
+ if (!entry_init_key(key, query, querylen))
+ return;
+
+ pthread_mutex_lock(&_res_cache_list_lock);
+
+ cache = _find_named_cache_locked(netid);
- if (cache && entry_init_key(key, query, querylen)) {
- pthread_mutex_lock(&cache->lock);
+ if (cache) {
_cache_notify_waiting_tid_locked(cache, key);
- pthread_mutex_unlock(&cache->lock);
}
+
+ pthread_mutex_unlock(&_res_cache_list_lock);
}
static void
cache->max_entries = _res_cache_get_max_entries();
cache->entries = calloc(sizeof(*cache->entries), cache->max_entries);
if (cache->entries) {
- pthread_mutex_init( &cache->lock, NULL );
cache->mru_list.mru_prev = cache->mru_list.mru_next = &cache->mru_list;
XLOG("%s: cache created\n", __FUNCTION__);
} else {
}
ResolvCacheStatus
-_resolv_cache_lookup( struct resolv_cache* cache,
+_resolv_cache_lookup( unsigned netid,
const void* query,
int querylen,
void* answer,
Entry** lookup;
Entry* e;
time_t now;
+ Cache* cache;
ResolvCacheStatus result = RESOLV_CACHE_NOTFOUND;
return RESOLV_CACHE_UNSUPPORTED;
}
/* lookup cache */
- pthread_mutex_lock( &cache->lock );
+ pthread_once(&_res_cache_once, _res_cache_init);
+ pthread_mutex_lock(&_res_cache_list_lock);
+
+ cache = _find_named_cache_locked(netid);
+ if (cache == NULL) {
+ result = RESOLV_CACHE_UNSUPPORTED;
+ goto Exit;
+ }
/* see the description of _lookup_p to understand this.
* the function always return a non-NULL pointer.
XLOG( "NOT IN CACHE");
// calling thread will wait if an outstanding request is found
// that matching this query
- if (!_cache_check_pending_request_locked(cache, key)) {
+ if (!_cache_check_pending_request_locked(&cache, key, netid) || cache == NULL) {
goto Exit;
} else {
lookup = _cache_lookup_p(cache, key);
result = RESOLV_CACHE_FOUND;
Exit:
- pthread_mutex_unlock( &cache->lock );
+ pthread_mutex_unlock(&_res_cache_list_lock);
return result;
}
void
-_resolv_cache_add( struct resolv_cache* cache,
+_resolv_cache_add( unsigned netid,
const void* query,
int querylen,
const void* answer,
Entry* e;
Entry** lookup;
u_long ttl;
+ Cache* cache = NULL;
/* don't assume that the query has already been cached
*/
return;
}
- pthread_mutex_lock( &cache->lock );
+ pthread_mutex_lock(&_res_cache_list_lock);
+
+ cache = _find_named_cache_locked(netid);
+ if (cache == NULL) {
+ goto Exit;
+ }
XLOG( "%s: query:", __FUNCTION__ );
XLOG_QUERY(query,querylen);
_cache_dump_mru(cache);
#endif
Exit:
- _cache_notify_waiting_tid_locked(cache, key);
- pthread_mutex_unlock( &cache->lock );
+ if (cache != NULL) {
+ _cache_notify_waiting_tid_locked(cache, key);
+ }
+ pthread_mutex_unlock(&_res_cache_list_lock);
}
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
-static pthread_once_t _res_cache_once = PTHREAD_ONCE_INIT;
-
// Head of the list of caches. Protected by _res_cache_list_lock.
static struct resolv_cache_info _res_cache_list;
-// lock protecting everything in the _resolve_cache_info structs (next ptr, etc)
-static pthread_mutex_t _res_cache_list_lock;
-
/* insert resolv_cache_info into the list of resolv_cache_infos */
static void _insert_cache_info_locked(struct resolv_cache_info* cache_info);
/* creates a resolv_cache_info */
static struct resolv_cache_info* _create_cache_info( void );
-/* gets cache associated with a network, or NULL if none exists */
-static struct resolv_cache* _find_named_cache_locked(unsigned netid);
/* gets a resolv_cache_info associated with a network, or NULL if not found */
static struct resolv_cache_info* _find_cache_info_locked(unsigned netid);
/* look up the named cache, and creates one if needed */
pthread_mutex_init(&_res_cache_list_lock, NULL);
}
-struct resolv_cache*
-__get_res_cache(unsigned netid)
-{
- struct resolv_cache *cache;
-
- pthread_once(&_res_cache_once, _res_cache_init);
- pthread_mutex_lock(&_res_cache_list_lock);
-
- /* Does NOT create a cache if it does not exist. */
- cache = _find_named_cache_locked(netid);
-
- pthread_mutex_unlock(&_res_cache_list_lock);
- XLOG("%s: netid=%u, cache=%p\n", __FUNCTION__, netid, cache);
- return cache;
-}
-
static struct resolv_cache*
_get_res_cache_for_net_locked(unsigned netid)
{
{
struct resolv_cache* cache = _find_named_cache_locked(netid);
if (cache) {
- pthread_mutex_lock(&cache->lock);
_cache_flush_locked(cache);
- pthread_mutex_unlock(&cache->lock);
}
}
+void _resolv_delete_cache_for_net(unsigned netid)
+{
+ pthread_once(&_res_cache_once, _res_cache_init);
+ pthread_mutex_lock(&_res_cache_list_lock);
+
+ struct resolv_cache_info* prev_cache_info = &_res_cache_list;
+
+ while (prev_cache_info->next) {
+ struct resolv_cache_info* cache_info = prev_cache_info->next;
+
+ if (cache_info->netid == netid) {
+ prev_cache_info->next = cache_info->next;
+ _cache_flush_locked(cache_info->cache);
+ free(cache_info->cache->entries);
+ free(cache_info->cache);
+ _free_nameservers_locked(cache_info);
+ free(cache_info);
+ break;
+ }
+
+ prev_cache_info = prev_cache_info->next;
+ }
+
+ pthread_mutex_unlock(&_res_cache_list_lock);
+}
+
static struct resolv_cache_info*
_create_cache_info(void)
{
index 4a010d53e9c0560b1d82bcddd45e3d55967615c3..bc807b536260215e47e93271690d3295dab07dce 100644 (file)
int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
char abuf[NI_MAXHOST];
#if USE_RESOLV_CACHE
- struct resolv_cache* cache;
ResolvCacheStatus cache_status = RESOLV_CACHE_UNSUPPORTED;
#endif
terrno = ETIMEDOUT;
#if USE_RESOLV_CACHE
- // get the cache associated with the network
- cache = __get_res_cache(statp->netid);
- if (cache != NULL) {
- int anslen = 0;
- cache_status = _resolv_cache_lookup(
- cache, buf, buflen,
- ans, anssiz, &anslen);
-
- if (cache_status == RESOLV_CACHE_FOUND) {
- return anslen;
- } else {
- // had a cache miss for a known network, so populate the thread private
- // data so the normal resolve path can do its thing
- _resolv_populate_res_for_net(statp);
- }
+ int anslen = 0;
+ cache_status = _resolv_cache_lookup(
+ statp->netid, buf, buflen,
+ ans, anssiz, &anslen);
+
+ if (cache_status == RESOLV_CACHE_FOUND) {
+ return anslen;
+ } else if (cache_status != RESOLV_CACHE_UNSUPPORTED) {
+ // had a cache miss for a known network, so populate the thread private
+ // data so the normal resolve path can do its thing
+ _resolv_populate_res_for_net(statp);
}
if (statp->nscount == 0) {
#if USE_RESOLV_CACHE
if (cache_status == RESOLV_CACHE_NOTFOUND) {
- _resolv_cache_add(cache, buf, buflen,
+ _resolv_cache_add(statp->netid, buf, buflen,
ans, resplen);
}
#endif
errno = terrno;
#if USE_RESOLV_CACHE
- _resolv_cache_query_failed(cache, buf, buflen);
+ _resolv_cache_query_failed(statp->netid, buf, buflen);
#endif
return (-1);
fail:
#if USE_RESOLV_CACHE
- _resolv_cache_query_failed(cache, buf, buflen);
+ _resolv_cache_query_failed(statp->netid, buf, buflen);
#endif
res_nclose(statp);
return (-1);
@@ -951,7 +946,7 @@ connect_with_timeout(int sock, const struct sockaddr *nsap, socklen_t salen, int
origflags = fcntl(sock, F_GETFL, 0);
fcntl(sock, F_SETFL, origflags | O_NONBLOCK);
- res = connect(sock, nsap, salen);
+ res = __connect(sock, nsap, salen);
if (res < 0 && errno != EINPROGRESS) {
res = -1;
goto done;
res_nclose(statp);
return (0);
}
- if (connect(EXT(statp).nssocks[ns], nsap, (socklen_t)nsaplen) < 0) {
+ if (__connect(EXT(statp).nssocks[ns], nsap, (socklen_t)nsaplen) < 0) {
Aerror(statp, stderr, "connect(dg)", errno, nsap,
nsaplen);
res_nclose(statp);
index f18939d1165b6e35beaac26ad00c8d8a88f4bce2..5af39d04f342961f7da2f71b9d0c60068057e5f1 100644 (file)
***
****************************************************************************
****************************************************************************/
-#ifndef _LINUX_ION_H
-#define _LINUX_ION_H
+#ifndef _UAPI_LINUX_ION_H
+#define _UAPI_LINUX_ION_H
+#include <linux/ioctl.h>
#include <linux/types.h>
-struct ion_handle;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef int ion_user_handle_t;
enum ion_heap_type {
ION_HEAP_TYPE_SYSTEM,
ION_HEAP_TYPE_SYSTEM_CONTIG,
- ION_HEAP_TYPE_CARVEOUT,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ION_HEAP_TYPE_CARVEOUT,
+ ION_HEAP_TYPE_CHUNK,
+ ION_HEAP_TYPE_DMA,
ION_HEAP_TYPE_CUSTOM,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
ION_NUM_HEAPS = 16,
};
#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
+#define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA)
+#define ION_NUM_HEAP_IDS sizeof(unsigned int) * 8
#define ION_FLAG_CACHED 1
-#define ION_FLAG_CACHED_NEEDS_SYNC 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ION_FLAG_CACHED_NEEDS_SYNC 2
struct ion_allocation_data {
size_t len;
size_t align;
- unsigned int heap_mask;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int heap_id_mask;
unsigned int flags;
- struct ion_handle *handle;
+ ion_user_handle_t handle;
};
-struct ion_fd_data {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- struct ion_handle *handle;
+struct ion_fd_data {
+ ion_user_handle_t handle;
int fd;
};
-struct ion_handle_data {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- struct ion_handle *handle;
+struct ion_handle_data {
+ ion_user_handle_t handle;
};
struct ion_custom_data {
- unsigned int cmd;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int cmd;
unsigned long arg;
};
#define ION_IOC_MAGIC 'I'
-#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data)
#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
-#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libstdc++/NOTICE b/libstdc++/NOTICE
index 6c263d1271e4d6a51e80e80439b566c4625b478f..59d610681f0daa00ab6a97ba3ede6ec99f8aabcc 100644 (file)
--- a/libstdc++/NOTICE
+++ b/libstdc++/NOTICE
-------------------------------------------------------------------
-Copyright 2006 The Android Open Source Project
-
--------------------------------------------------------------------
-
diff --git a/linker/NOTICE b/linker/NOTICE
index c3d6cf6ee05482d6d32c0d6ff5fd12aabf00eadd..db4ec7b4f0b30f5f8c179e95d1a32f7dc324557b 100644 (file)
--- a/linker/NOTICE
+++ b/linker/NOTICE
-------------------------------------------------------------------
+Copyright (C) 2013 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-------------------------------------------------------------------
+
Copyright (C) 2013 The Android Open Source Project
All rights reserved.
-------------------------------------------------------------------
+Copyright (C) 2014 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-------------------------------------------------------------------
+