Back to index

glibc  2.9
errno.c
Go to the documentation of this file.
00001 /* Linuxthreads - a simple clone()-based implementation of Posix        */
00002 /* threads for Linux.                                                   */
00003 /* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr)              */
00004 /*                                                                      */
00005 /* This program is free software; you can redistribute it and/or        */
00006 /* modify it under the terms of the GNU Library General Public License  */
00007 /* as published by the Free Software Foundation; either version 2       */
00008 /* of the License, or (at your option) any later version.               */
00009 /*                                                                      */
00010 /* This program is distributed in the hope that it will be useful,      */
00011 /* but WITHOUT ANY WARRANTY; without even the implied warranty of       */
00012 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        */
00013 /* GNU Library General Public License for more details.                 */
00014 
00015 /* Define the location of errno for the remainder of the C library */
00016 
00017 #include <errno.h>
00018 #include <netdb.h>
00019 #include <resolv.h>
00020 #include <tls.h>
00021 #include "pthread.h"
00022 #include "internals.h"
00023 
00024 #if !USE_TLS || !HAVE___THREAD
00025 /* The definition in libc is sufficient if we use TLS.  */
00026 int *
00027 __errno_location (void)
00028 {
00029   pthread_descr self = thread_self();
00030   return THREAD_GETMEM (self, p_errnop);
00031 }
00032 
00033 int *
00034 __h_errno_location (void)
00035 {
00036   pthread_descr self = thread_self();
00037   return THREAD_GETMEM (self, p_h_errnop);
00038 }
00039 
00040 /* Return thread specific resolver state.  */
00041 struct __res_state *
00042 __res_state (void)
00043 {
00044   pthread_descr self = thread_self();
00045   return THREAD_GETMEM (self, p_resp);
00046 }
00047 #endif