X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=errlog.c;h=dd06387e34ee43700c43ef5e95caae932c58257b;hp=7cc4e200dcd938216e37b9cf7b247568e632afd2;hb=74f84988126c9680e5e05513a42016f0dbe6c185;hpb=74dd41a427727953abd78097f47db07f884568d5 diff --git a/errlog.c b/errlog.c index 7cc4e200..dd06387e 100644 --- a/errlog.c +++ b/errlog.c @@ -45,9 +45,9 @@ /* For gettimeofday() */ #include -#if !defined(_WIN32) && !defined(__OS2__) +#if !defined(_WIN32) #include -#endif /* !defined(_WIN32) && !defined(__OS2__) */ +#endif /* !defined(_WIN32) */ #include #include @@ -65,12 +65,6 @@ #define inline __inline #endif /* def _MSC_VER */ -#ifdef __OS2__ -#include /* For sock_errno */ -#define INCL_DOS -#include -#endif - #include "errlog.h" #include "project.h" #include "jcc.h" @@ -96,9 +90,6 @@ static void fatal_error(const char * error_message); #ifdef _WIN32 static char *w32_socket_strerr(int errcode, char *tmp_buf); #endif -#ifdef __OS2__ -static char *os2_socket_strerr(int errcode, char *tmp_buf); -#endif #ifdef MUTEX_LOCKS_AVAILABLE static inline void lock_logfile(void) @@ -331,9 +322,9 @@ void init_error_log(const char *prog_name, const char *logfname) if ((NULL == fp) && (logfp != NULL)) { /* - * Some platforms (like OS/2) don't allow us to open - * the same file twice, therefore we give it another - * shot after closing the old file descriptor first. + * Some platforms (like OS/2 (XXX: no longer supported)) don't + * allow us to open the same file twice, therefore we give it + * another shot after closing the old file descriptor first. * * We don't do it right away because it prevents us * from logging the "can't open logfile" message to @@ -418,11 +409,6 @@ static long get_thread_id(void) { long this_thread; -#ifdef __OS2__ - PTIB ptib; - APIRET ulrc; /* XXX: I have no clue what this does */ -#endif /* __OS2__ */ - /* FIXME get current thread id */ #ifdef FEATURE_PTHREAD this_thread = (long)pthread_self(); @@ -436,10 +422,6 @@ static long get_thread_id(void) #endif /* def __MACH__ */ #elif defined(_WIN32) this_thread = GetCurrentThreadId(); -#elif defined(__OS2__) - ulrc = DosGetInfoBlocks(&ptib, NULL); - if (ulrc == 0) - this_thread = ptib -> tib_ptib2 -> tib2_ultid; #else /* Forking instead of threading. */ this_thread = 1; @@ -746,7 +728,8 @@ void log_error(int loglevel, const char *fmt, ...) /* * XXX: Only necessary on platforms where multiple threads * can write to the buffer at the same time because we - * don't support mutexes (OS/2 for example). + * don't support mutexes. + * XXX: Are there any such platforms left now that OS/2 is gone? */ outbuf[length] = '\0'; continue; @@ -844,17 +827,6 @@ void log_error(int loglevel, const char *fmt, ...) #ifdef _WIN32 ival = WSAGetLastError(); format_string = w32_socket_strerr(ival, tempbuf); -#elif __OS2__ - ival = sock_errno(); - if (ival != 0) - { - format_string = os2_socket_strerr(ival, tempbuf); - } - else - { - ival = errno; - format_string = strerror(ival); - } #else /* ifndef _WIN32 */ ival = errno; #ifdef HAVE_STRERROR @@ -1077,82 +1049,6 @@ static char *w32_socket_strerr(int errcode, char *tmp_buf) #endif /* def _WIN32 */ -#ifdef __OS2__ -/********************************************************************* - * - * Function : os2_socket_strerr - * - * Description : Translate the return value from sock_errno() - * into a string. - * - * Parameters : - * 1 : errcode = The return value from sock_errno(). - * 2 : tmp_buf = A temporary buffer that might be used to - * store the string. - * - * Returns : String representing the error code. This may be - * a global string constant or a string stored in - * tmp_buf. - * - *********************************************************************/ -static char *os2_socket_strerr(int errcode, char *tmp_buf) -{ -#define TEXT_FOR_ERROR(code,text) \ - if (errcode == code) \ - { \ - return #code " - " text; \ - } - - TEXT_FOR_ERROR(SOCEPERM , "Not owner.") - TEXT_FOR_ERROR(SOCESRCH , "No such process.") - TEXT_FOR_ERROR(SOCEINTR , "Interrupted system call.") - TEXT_FOR_ERROR(SOCENXIO , "No such device or address.") - TEXT_FOR_ERROR(SOCEBADF , "Bad file number.") - TEXT_FOR_ERROR(SOCEACCES , "Permission denied.") - TEXT_FOR_ERROR(SOCEFAULT , "Bad address.") - TEXT_FOR_ERROR(SOCEINVAL , "Invalid argument.") - TEXT_FOR_ERROR(SOCEMFILE , "Too many open files.") - TEXT_FOR_ERROR(SOCEPIPE , "Broken pipe.") - TEXT_FOR_ERROR(SOCEWOULDBLOCK , "Operation would block.") - TEXT_FOR_ERROR(SOCEINPROGRESS , "Operation now in progress.") - TEXT_FOR_ERROR(SOCEALREADY , "Operation already in progress.") - TEXT_FOR_ERROR(SOCENOTSOCK , "Socket operation on non-socket.") - TEXT_FOR_ERROR(SOCEDESTADDRREQ , "Destination address required.") - TEXT_FOR_ERROR(SOCEMSGSIZE , "Message too long.") - TEXT_FOR_ERROR(SOCEPROTOTYPE , "Protocol wrong type for socket.") - TEXT_FOR_ERROR(SOCENOPROTOOPT , "Protocol not available.") - TEXT_FOR_ERROR(SOCEPROTONOSUPPORT, "Protocol not supported.") - TEXT_FOR_ERROR(SOCESOCKTNOSUPPORT, "Socket type not supported.") - TEXT_FOR_ERROR(SOCEOPNOTSUPP , "Operation not supported.") - TEXT_FOR_ERROR(SOCEPFNOSUPPORT , "Protocol family not supported.") - TEXT_FOR_ERROR(SOCEAFNOSUPPORT , "Address family not supported by protocol family.") - TEXT_FOR_ERROR(SOCEADDRINUSE , "Address already in use.") - TEXT_FOR_ERROR(SOCEADDRNOTAVAIL , "Can't assign requested address.") - TEXT_FOR_ERROR(SOCENETDOWN , "Network is down.") - TEXT_FOR_ERROR(SOCENETUNREACH , "Network is unreachable.") - TEXT_FOR_ERROR(SOCENETRESET , "Network dropped connection on reset.") - TEXT_FOR_ERROR(SOCECONNABORTED , "Software caused connection abort.") - TEXT_FOR_ERROR(SOCECONNRESET , "Connection reset by peer.") - TEXT_FOR_ERROR(SOCENOBUFS , "No buffer space available.") - TEXT_FOR_ERROR(SOCEISCONN , "Socket is already connected.") - TEXT_FOR_ERROR(SOCENOTCONN , "Socket is not connected.") - TEXT_FOR_ERROR(SOCESHUTDOWN , "Can't send after socket shutdown.") - TEXT_FOR_ERROR(SOCETOOMANYREFS , "Too many references: can't splice.") - TEXT_FOR_ERROR(SOCETIMEDOUT , "Operation timed out.") - TEXT_FOR_ERROR(SOCECONNREFUSED , "Connection refused.") - TEXT_FOR_ERROR(SOCELOOP , "Too many levels of symbolic links.") - TEXT_FOR_ERROR(SOCENAMETOOLONG , "File name too long.") - TEXT_FOR_ERROR(SOCEHOSTDOWN , "Host is down.") - TEXT_FOR_ERROR(SOCEHOSTUNREACH , "No route to host.") - TEXT_FOR_ERROR(SOCENOTEMPTY , "Directory not empty.") - TEXT_FOR_ERROR(SOCEOS2ERR , "OS/2 Error.") - - sprintf(tmp_buf, "(error number %d)", errcode); - return tmp_buf; -} -#endif /* def __OS2__ */ - - /* Local Variables: tab-width: 3