2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

coding style

This commit is contained in:
Andreas Gustafsson 2001-07-09 21:06:30 +00:00
parent 9d99e3fda1
commit e76d4c91bf
30 changed files with 293 additions and 432 deletions

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: app.c,v 1.42 2001/03/20 21:45:20 bwelling Exp $ */ /* $Id: app.c,v 1.43 2001/07/09 21:05:57 gson Exp $ */
#include <config.h> #include <config.h>
@ -255,10 +255,6 @@ isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
isc_task_t *cloned_task = NULL; isc_task_t *cloned_task = NULL;
isc_result_t result; isc_result_t result;
/*
* Request delivery of an event when the application is run.
*/
LOCK(&lock); LOCK(&lock);
if (running) { if (running) {
@ -414,10 +410,6 @@ isc_app_run(void) {
int sig; int sig;
#endif #endif
/*
* Run an ISC library application.
*/
#ifdef HAVE_LINUXTHREADS #ifdef HAVE_LINUXTHREADS
REQUIRE(main_thread == pthread_self()); REQUIRE(main_thread == pthread_self());
#endif #endif
@ -541,10 +533,6 @@ isc_result_t
isc_app_shutdown(void) { isc_app_shutdown(void) {
isc_boolean_t want_kill = ISC_TRUE; isc_boolean_t want_kill = ISC_TRUE;
/*
* Request application shutdown.
*/
LOCK(&lock); LOCK(&lock);
REQUIRE(running); REQUIRE(running);
@ -584,10 +572,6 @@ isc_result_t
isc_app_reload(void) { isc_app_reload(void) {
isc_boolean_t want_kill = ISC_TRUE; isc_boolean_t want_kill = ISC_TRUE;
/*
* Request application reload.
*/
LOCK(&lock); LOCK(&lock);
REQUIRE(running); REQUIRE(running);
@ -626,10 +610,6 @@ isc_app_reload(void) {
void void
isc_app_finish(void) { isc_app_finish(void) {
/*
* Finish an ISC library application.
*/
DESTROYLOCK(&lock); DESTROYLOCK(&lock);
} }

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: ifiter_ioctl.c,v 1.18 2001/06/04 19:33:33 tale Exp $ */ /* $Id: ifiter_ioctl.c,v 1.19 2001/07/09 21:05:58 gson Exp $ */
/* /*
* Obtain the list of network interfaces using the SIOCGLIFCONF ioctl. * Obtain the list of network interfaces using the SIOCGLIFCONF ioctl.
@ -124,7 +124,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
iter->ifc.lifc_buf = iter->buf; iter->ifc.lifc_buf = iter->buf;
/* /*
* Ignore the HP/UX warning about "interger overflow during * Ignore the HP/UX warning about "interger overflow during
* conversion. It comes from its own macro definition, * conversion". It comes from its own macro definition,
* and is really hard to shut up. * and is really hard to shut up.
*/ */
if (ioctl(iter->socket, SIOCGLIFCONF, (char *)&iter->ifc) if (ioctl(iter->socket, SIOCGLIFCONF, (char *)&iter->ifc)

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: net.c,v 1.21 2001/07/09 08:07:40 marka Exp $ */ /* $Id: net.c,v 1.22 2001/07/09 21:05:59 gson Exp $ */
#include <config.h> #include <config.h>
@ -136,22 +136,12 @@ initialize(void) {
isc_result_t isc_result_t
isc_net_probeipv4(void) { isc_net_probeipv4(void) {
/*
* Check if the system's kernel supports IPv4.
*/
initialize(); initialize();
return (ipv4_result); return (ipv4_result);
} }
isc_result_t isc_result_t
isc_net_probeipv6(void) { isc_net_probeipv6(void) {
/*
* Check if the system's kernel supports IPv6.
*/
initialize(); initialize();
return (ipv6_result); return (ipv6_result);
} }

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: socket.c,v 1.202 2001/06/07 00:21:53 bwelling Exp $ */ /* $Id: socket.c,v 1.203 2001/07/09 21:06:01 gson Exp $ */
#include <config.h> #include <config.h>
@ -1284,7 +1284,8 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
(void)close(sock->fd); (void)close(sock->fd);
isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_TOOMANYFDS, isc_msgcat, ISC_MSGSET_SOCKET,
ISC_MSG_TOOMANYFDS,
"%s: too many open file descriptors", "socket"); "%s: too many open file descriptors", "socket");
free_socket(&sock); free_socket(&sock);
return (ISC_R_NORESOURCES); return (ISC_R_NORESOURCES);

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: time.c,v 1.33 2001/02/24 10:22:20 marka Exp $ */ /* $Id: time.c,v 1.34 2001/07/09 21:06:02 gson Exp $ */
#include <config.h> #include <config.h>
@ -83,13 +83,6 @@ void
isc_interval_set(isc_interval_t *i, isc_interval_set(isc_interval_t *i,
unsigned int seconds, unsigned int nanoseconds) unsigned int seconds, unsigned int nanoseconds)
{ {
/*
* Set 'i' to a value representing an interval of 'seconds' seconds
* and 'nanoseconds' nanoseconds, suitable for use in isc_time_add()
* and isc_time_subtract().
*/
REQUIRE(i != NULL); REQUIRE(i != NULL);
REQUIRE(nanoseconds < NS_PER_S); REQUIRE(nanoseconds < NS_PER_S);
@ -99,11 +92,6 @@ isc_interval_set(isc_interval_t *i,
isc_boolean_t isc_boolean_t
isc_interval_iszero(isc_interval_t *i) { isc_interval_iszero(isc_interval_t *i) {
/*
* Returns ISC_TRUE iff. 'i' is the zero interval.
*/
REQUIRE(i != NULL); REQUIRE(i != NULL);
INSIST(i->nanoseconds < NS_PER_S); INSIST(i->nanoseconds < NS_PER_S);
@ -123,10 +111,6 @@ isc_time_t *isc_time_epoch = &epoch;
void void
isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) { isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) {
/*
* Set 't' to a particular number of seconds + nanoseconds since the
* epoch.
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
REQUIRE(nanoseconds < NS_PER_S); REQUIRE(nanoseconds < NS_PER_S);
@ -136,10 +120,6 @@ isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) {
void void
isc_time_settoepoch(isc_time_t *t) { isc_time_settoepoch(isc_time_t *t) {
/*
* Set 't' to the time of the epoch.
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
t->seconds = 0; t->seconds = 0;
@ -148,11 +128,6 @@ isc_time_settoepoch(isc_time_t *t) {
isc_boolean_t isc_boolean_t
isc_time_isepoch(isc_time_t *t) { isc_time_isepoch(isc_time_t *t) {
/*
* Returns ISC_TRUE iff. 't' is the epoch ("time zero").
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
INSIST(t->nanoseconds < NS_PER_S); INSIST(t->nanoseconds < NS_PER_S);
@ -167,10 +142,6 @@ isc_result_t
isc_time_now(isc_time_t *t) { isc_time_now(isc_time_t *t) {
struct timeval tv; struct timeval tv;
/*
* Set *t to the current absolute time.
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
if (gettimeofday(&tv, NULL) == -1) { if (gettimeofday(&tv, NULL) == -1) {
@ -211,10 +182,6 @@ isc_result_t
isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) { isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) {
struct timeval tv; struct timeval tv;
/*
* Set *t to the current absolute time + i.
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
REQUIRE(i != NULL); REQUIRE(i != NULL);
INSIST(i->nanoseconds < NS_PER_S); INSIST(i->nanoseconds < NS_PER_S);
@ -262,11 +229,6 @@ isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) {
int int
isc_time_compare(isc_time_t *t1, isc_time_t *t2) { isc_time_compare(isc_time_t *t1, isc_time_t *t2) {
/*
* Compare the times referenced by 't1' and 't2'
*/
REQUIRE(t1 != NULL && t2 != NULL); REQUIRE(t1 != NULL && t2 != NULL);
INSIST(t1->nanoseconds < NS_PER_S && t2->nanoseconds < NS_PER_S); INSIST(t1->nanoseconds < NS_PER_S && t2->nanoseconds < NS_PER_S);
@ -283,10 +245,6 @@ isc_time_compare(isc_time_t *t1, isc_time_t *t2) {
isc_result_t isc_result_t
isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
/*
* Add 't' to 'i', storing the result in 'result'.
*/
REQUIRE(t != NULL && i != NULL && result != NULL); REQUIRE(t != NULL && i != NULL && result != NULL);
INSIST(t->nanoseconds < NS_PER_S && i->nanoseconds < NS_PER_S); INSIST(t->nanoseconds < NS_PER_S && i->nanoseconds < NS_PER_S);
@ -312,10 +270,6 @@ isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
isc_result_t isc_result_t
isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
/*
* Subtract 'i' from 't', storing the result in 'result'.
*/
REQUIRE(t != NULL && i != NULL && result != NULL); REQUIRE(t != NULL && i != NULL && result != NULL);
INSIST(t->nanoseconds < NS_PER_S && i->nanoseconds < NS_PER_S); INSIST(t->nanoseconds < NS_PER_S && i->nanoseconds < NS_PER_S);

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: app.c,v 1.2 2001/07/08 05:08:55 mayer Exp $ */ /* $Id: app.c,v 1.3 2001/07/09 21:06:03 gson Exp $ */
#include <config.h> #include <config.h>
@ -65,6 +65,7 @@ enum {
RELOAD_EVENT, RELOAD_EVENT,
SHUTDOWN_EVENT SHUTDOWN_EVENT
}; };
static HANDLE hEvents[NUM_EVENTS]; static HANDLE hEvents[NUM_EVENTS];
DWORD dwWaitResult; DWORD dwWaitResult;
@ -104,9 +105,6 @@ isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
isc_task_t *cloned_task = NULL; isc_task_t *cloned_task = NULL;
isc_result_t result; isc_result_t result;
/*
* Request delivery of an event when the application is run.
*/
LOCK(&lock); LOCK(&lock);
if (running) { if (running) {
@ -140,10 +138,6 @@ isc_app_run(void) {
isc_task_t *task; isc_task_t *task;
HANDLE *pHandles = NULL; HANDLE *pHandles = NULL;
/*
* Run an ISC library application.
*/
REQUIRE(main_thread == GetCurrentThread()); REQUIRE(main_thread == GetCurrentThread());
LOCK(&lock); LOCK(&lock);
if (!running) { if (!running) {
@ -172,13 +166,15 @@ isc_app_run(void) {
*/ */
while (!want_shutdown) { while (!want_shutdown) {
dwWaitResult = WaitForMultipleObjects(NUM_EVENTS,hEvents, FALSE, INFINITE); dwWaitResult = WaitForMultipleObjects(NUM_EVENTS, hEvents,
FALSE, INFINITE);
/* See why we returned */ /* See why we returned */
if (WaitSucceeded(dwWaitResult, NUM_EVENTS)) { if (WaitSucceeded(dwWaitResult, NUM_EVENTS)) {
/* /*
* The return was due to one of the events being signaled * The return was due to one of the events
* being signaled
*/ */
switch (WaitSucceededIndex(dwWaitResult)) { switch (WaitSucceededIndex(dwWaitResult)) {
case RELOAD_EVENT: case RELOAD_EVENT:
@ -206,10 +202,6 @@ isc_result_t
isc_app_shutdown(void) { isc_app_shutdown(void) {
isc_boolean_t want_kill = ISC_TRUE; isc_boolean_t want_kill = ISC_TRUE;
/*
* Request application shutdown.
*/
LOCK(&lock); LOCK(&lock);
REQUIRE(running); REQUIRE(running);
@ -219,9 +211,8 @@ isc_app_shutdown(void) {
shutdown_requested = ISC_TRUE; shutdown_requested = ISC_TRUE;
UNLOCK(&lock); UNLOCK(&lock);
if (want_kill) { if (want_kill)
SetEvent(hEvents[SHUTDOWN_EVENT]); SetEvent(hEvents[SHUTDOWN_EVENT]);
}
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@ -230,10 +221,6 @@ isc_result_t
isc_app_reload(void) { isc_app_reload(void) {
isc_boolean_t want_reload = ISC_TRUE; isc_boolean_t want_reload = ISC_TRUE;
/*
* Request application reload.
*/
LOCK(&lock); LOCK(&lock);
REQUIRE(running); REQUIRE(running);
@ -244,18 +231,14 @@ isc_app_reload(void) {
want_reload = ISC_FALSE; want_reload = ISC_FALSE;
UNLOCK(&lock); UNLOCK(&lock);
if (want_reload) { if (want_reload)
SetEvent(hEvents[RELOAD_EVENT]); SetEvent(hEvents[RELOAD_EVENT]);
}
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
void void
isc_app_finish(void) { isc_app_finish(void) {
/*
* Finish an ISC library application.
*/
DESTROYLOCK(&lock); DESTROYLOCK(&lock);
} }
@ -270,10 +253,8 @@ isc_app_block(void) {
void void
isc_app_unblock(void) { isc_app_unblock(void) {
REQUIRE(running); REQUIRE(running);
REQUIRE(blocked); REQUIRE(blocked);
blocked = ISC_FALSE; blocked = ISC_FALSE;
REQUIRE(blockedthread == GetCurrentThread()); REQUIRE(blockedthread == GetCurrentThread());
} }

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: errno2result.c,v 1.2 2001/07/08 05:08:58 mayer Exp $ */ /* $Id: errno2result.c,v 1.3 2001/07/09 21:06:04 gson Exp $ */
#include <config.h> #include <config.h>
@ -62,11 +62,13 @@ isc__errno2result(int posixerrno) {
return (ISC_R_UNEXPECTED); return (ISC_R_UNEXPECTED);
} }
} }
/* /*
* Note this will cause a memory leak unless the memory allocated here * Note this will cause a memory leak unless the memory allocated here
* is freed by calling LocalFree * is freed by calling LocalFree
*/ */
char * FormatError(int error) { char *
FormatError(int error) {
LPVOID lpMsgBuf; LPVOID lpMsgBuf;
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
@ -74,7 +76,8 @@ char * FormatError(int error) {
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, NULL,
error, error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ /* Default language */
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, (LPTSTR) &lpMsgBuf,
0, 0,
NULL); NULL);
@ -82,10 +85,12 @@ char * FormatError(int error) {
return (lpMsgBuf); return (lpMsgBuf);
} }
char * __cdecl
char * __cdecl NTstrMessage(int err) { NTstrMessage(int err) {
char *retmsg = NULL; char *retmsg = NULL;
DWORD errval = err; /* Copy the error value first in case of other errors */
/* Copy the error value first in case of other errors */
DWORD errval = err;
/* Get the Winsock2 error messages */ /* Get the Winsock2 error messages */
if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) { if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) {
@ -99,14 +104,15 @@ char * __cdecl NTstrMessage(int err) {
*/ */
if (errval > (DWORD) _sys_nerr) { if (errval > (DWORD) _sys_nerr) {
return (FormatError(errval)); return (FormatError(errval));
} } else {
else {
return (strerror(errval)); return (strerror(errval));
} }
} }
char * __cdecl NTstrerror(int err) {
DWORD errval = err; /* Copy the error value first in case of other errors */ char * __cdecl
NTstrerror(int err) {
/* Copy the error value first in case of other errors */
DWORD errval = err;
return (NTstrMessage(errval)); return (NTstrMessage(errval));
} }
@ -114,19 +120,21 @@ char * __cdecl NTstrerror(int err) {
/* /*
* This is a replacement for perror, but it also reports the error value. * This is a replacement for perror, but it also reports the error value.
*/ */
void __cdecl NTperror(char *errmsg) { void __cdecl
int errval = errno; /* Copy the error value first in case of other errors */ NTperror(char *errmsg) {
/* Copy the error value first in case of other errors */
int errval = errno;
fprintf(stderr, "%s: %s\n", errmsg, NTstrMessage(errval)); fprintf(stderr, "%s: %s\n", errmsg, NTstrMessage(errval));
} }
/* /*
* This function returns the error string related to Winsock2 errors. * Return the error string related to Winsock2 errors.
* This function is necessary since FormatMessage knows nothing about them * This function is necessary since FormatMessage knows nothing about them
* and there is no function to get them. * and there is no function to get them.
*/ */
char *
char * GetWSAErrorMessage(int errval) { GetWSAErrorMessage(int errval) {
char *msg; char *msg;
switch (errval) { switch (errval) {
@ -339,8 +347,8 @@ char * GetWSAErrorMessage(int errval) {
* standard error messages * standard error messages
*/ */
char * GetCryptErrorMessage(int errval) { char *
GetCryptErrorMessage(int errval) {
char *msg; char *msg;
switch (errval) { switch (errval) {
@ -349,16 +357,22 @@ char * GetCryptErrorMessage(int errval) {
msg = "The dwFlags parameter has an illegal value."; msg = "The dwFlags parameter has an illegal value.";
break; break;
case NTE_BAD_KEYSET: case NTE_BAD_KEYSET:
msg = "The Registry entry for the key container could not be opened and may not exist."; msg = "The Registry entry for the key container "
"could not be opened and may not exist.";
break; break;
case NTE_BAD_KEYSET_PARAM: case NTE_BAD_KEYSET_PARAM:
msg = "The pszContainer or pszProvider parameter is set to an illegal value."; msg = "The pszContainer or pszProvider parameter "
"is set to an illegal value.";
break; break;
case NTE_BAD_PROV_TYPE: case NTE_BAD_PROV_TYPE:
msg = "The value of the dwProvType parameter is out of range. All provider types must be from 1 to 999, inclusive."; msg = "The value of the dwProvType parameter is out "
"of range. All provider types must be from "
"1 to 999, inclusive.";
break; break;
case NTE_BAD_SIGNATURE: case NTE_BAD_SIGNATURE:
msg = "The provider DLL signature did not verify correctly. Either the DLL or the digital signature has been tampered with."; msg = "The provider DLL signature did not verify "
"correctly. Either the DLL or the digital "
"signature has been tampered with.";
break; break;
case NTE_EXISTS: case NTE_EXISTS:
msg = "The dwFlags parameter is CRYPT_NEWKEYSET, but the key" msg = "The dwFlags parameter is CRYPT_NEWKEYSET, but the key"
@ -368,11 +382,12 @@ char * GetCryptErrorMessage(int errval) {
msg = "The Registry entry for the pszContainer key container " msg = "The Registry entry for the pszContainer key container "
"was found (in the HKEY_CURRENT_USER window), but is " "was found (in the HKEY_CURRENT_USER window), but is "
"corrupt. See the section System Administration for " "corrupt. See the section System Administration for "
" details about CryptoAPI's Registry usage."; " etails about CryptoAPI's Registry usage.";
break; break;
case NTE_KEYSET_NOT_DEF: case NTE_KEYSET_NOT_DEF:
msg = "No Registry entry exists in the HKEY_CURRENT_USER " msg = "No Registry entry exists in the HKEY_CURRENT_USER "
" window for the key container specified by pszContainer."; "window for the key container specified by "
"pszContainer.";
break; break;
case NTE_NO_MEMORY: case NTE_NO_MEMORY:
msg = "The CSP ran out of memory during the operation."; msg = "The CSP ran out of memory during the operation.";

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: errno2result.h,v 1.2 2001/07/08 05:08:59 mayer Exp $ */ /* $Id: errno2result.h,v 1.3 2001/07/09 21:06:05 gson Exp $ */
#ifndef UNIX_ERRNO2RESULT_H #ifndef UNIX_ERRNO2RESULT_H
#define UNIX_ERRNO2RESULT_H 1 #define UNIX_ERRNO2RESULT_H 1
@ -32,10 +32,15 @@ ISC_LANG_BEGINDECLS
isc_result_t isc_result_t
isc__errno2result(int posixerrno); isc__errno2result(int posixerrno);
char * isc_FormatError(int error); char *
isc_FormatError(int error);
char *
GetWSAErrorMessage(int errval);
char * __cdecl
NTstrerror(int err);
char * GetWSAErrorMessage(int errval);
char * __cdecl NTstrerror(int err);
ISC_LANG_ENDDECLS ISC_LANG_ENDDECLS
#endif /* UNIX_ERRNO2RESULT_H */ #endif /* UNIX_ERRNO2RESULT_H */

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: file.c,v 1.10 2001/07/08 05:16:13 mayer Exp $ */ /* $Id: file.c,v 1.11 2001/07/09 21:06:06 gson Exp $ */
#include <config.h> #include <config.h>
@ -79,12 +79,12 @@ gettemp(char *path, int *doopen) {
for (;;) { for (;;) {
if (doopen) { if (doopen) {
if ((*doopen = if ((*doopen =
open(path, O_CREAT|O_EXCL|O_RDWR, _S_IREAD | _S_IWRITE)) >= 0) open(path, O_CREAT|O_EXCL|O_RDWR,
_S_IREAD | _S_IWRITE)) >= 0)
return (1); return (1);
if (errno != EEXIST) if (errno != EEXIST)
return (0); return (0);
} } else if (stat(path, &sbuf))
else if (stat(path, &sbuf))
return (errno == ENOENT ? 1 : 0); return (errno == ENOENT ? 1 : 0);
/* tricky little algorithm for backward compatibility */ /* tricky little algorithm for backward compatibility */
@ -130,9 +130,11 @@ file_stats(const char *file, struct stat *stats) {
return (result); return (result);
} }
/* isc_file_safemovefile is needed to be defined here to ensure that any file with /*
* the new name is renamed to a backup name and then the rename is done. If all goes * isc_file_safemovefile is needed to be defined here to ensure that
* well then the backup can be deleted, otherwise it gets renamed back. * any file with the new name is renamed to a backup name and then the
* rename is done. If all goes well then the backup can be deleted,
* otherwise it gets renamed back.
*/ */
int int
@ -172,8 +174,9 @@ isc_file_safemovefile(const char *oldname, const char *newname) {
filestatus = MoveFile(oldname, newname); filestatus = MoveFile(oldname, newname);
if (filestatus == 0) { if (filestatus == 0) {
/*
/* Try and rename the backup back to the original name if the backup got created * Try to rename the backup back to the original name
* if the backup got created
*/ */
if (exists == TRUE) { if (exists == TRUE) {
filestatus = MoveFile(buf, newname); filestatus = MoveFile(buf, newname);
@ -184,11 +187,11 @@ isc_file_safemovefile(const char *oldname, const char *newname) {
return (-1); return (-1);
} }
/* Delete the backup file if it got created /*
* Delete the backup file if it got created
*/ */
if (exists == TRUE) { if (exists == TRUE)
filestatus = DeleteFile(buf); filestatus = DeleteFile(buf);
}
return (0); return (0);
} }
@ -288,9 +291,9 @@ isc_file_renameunique(const char *file, char *templet) {
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
fd = mkstemp(templet); fd = mkstemp(templet);
if (fd == -1) { if (fd == -1)
result = isc__errno2result(errno); result = isc__errno2result(errno);
}
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
res = isc_file_safemovefile(file, templet); res = isc_file_safemovefile(file, templet);
if (res != 0) { if (res != 0) {
@ -325,7 +328,6 @@ isc_file_openunique(char *templet, FILE **fp) {
result = isc__errno2result(errno); result = isc__errno2result(errno);
(void)remove(templet); (void)remove(templet);
(void)close(fd); (void)close(fd);
} else } else
*fp = f; *fp = f;
} }
@ -366,10 +368,13 @@ isc_boolean_t
isc_file_isabsolute(const char *filename) { isc_file_isabsolute(const char *filename) {
/* /*
* Look for c:\path\... style or \\computer\shar\path... UNC style file specs * Look for c:\path\... style or \\computer\shar\path...
* UNC style file specs
*/ */
return ((ISC_TF(filename[1] == ':') && ISC_TF(filename[2] == '\\')) || return ((ISC_TF(filename[1] == ':') &&
(ISC_TF(filename[0] == '\\') && ISC_TF(filename[1] == '\\'))); ISC_TF(filename[2] == '\\')) ||
(ISC_TF(filename[0] == '\\') &&
ISC_TF(filename[1] == '\\')));
} }
isc_boolean_t isc_boolean_t

View File

@ -15,16 +15,16 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: fsaccess.c,v 1.8 2001/07/08 05:09:01 mayer Exp $ */ /* $Id: fsaccess.c,v 1.9 2001/07/09 21:06:07 gson Exp $ */
/* /*
* Note that Win32 does not have the concept of files having access and ownership * Note that Win32 does not have the concept of files having access
* bits. The FAT File system only has a readonly flag for everyone and that's * and ownership bits. The FAT File system only has a readonly flag
* all. NTFS uses ACL's which is a totally different concept of controlling * for everyone and that's all. NTFS uses ACL's which is a totally
* access. * different concept of controlling access.
* *
* This code needs to be revisited to set up proper access control for NTFS file systems. * This code needs to be revisited to set up proper access control for
* Nothing can be done for FAT file systems. * NTFS file systems. Nothing can be done for FAT file systems.
*/ */
#include <config.h> #include <config.h>
@ -90,15 +90,16 @@ isc_fsaccess_set(const char *path, isc_fsaccess_t access) {
SET_AND_CLEAR(S_IWUSR, S_IWGRP, S_IWOTH); SET_AND_CLEAR(S_IWUSR, S_IWGRP, S_IWOTH);
#ifdef notyet
/* /*
* WIN32 doesn't have the concept of execute bits. We leave this here * WIN32 doesn't have the concept of execute bits. We leave this here
* for when we review this module. * for when we review this module.
* */
bits = ISC_FSACCESS_EXECUTE | bits = ISC_FSACCESS_EXECUTE |
ISC_FSACCESS_ACCESSCHILD; ISC_FSACCESS_ACCESSCHILD;
SET_AND_CLEAR(S_IXUSR, S_IXGRP, S_IXOTH); SET_AND_CLEAR(S_IXUSR, S_IXGRP, S_IXOTH);
*/ #endif
INSIST(access == 0); INSIST(access == 0);
if (_chmod(path, mode) < 0) if (_chmod(path, mode) < 0)

View File

@ -15,23 +15,26 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: bind_registry.h,v 1.2 2001/07/08 05:09:21 mayer Exp $ */ /* $Id: bind_registry.h,v 1.3 2001/07/09 21:06:25 gson Exp $ */
#ifndef _BIND_REGISTRY_H #ifndef _BIND_REGISTRY_H
#define _BIND_REGISTRY_H #define _BIND_REGISTRY_H
/* /*
* BIND makes use of the following Registry keys in various places, especially * BIND makes use of the following Registry keys in various places, especially
* furing startup and installation * during startup and installation
*/ */
#define BIND_SUBKEY "Software\\ISC\\BIND" #define BIND_SUBKEY "Software\\ISC\\BIND"
#define BIND_SESSION "CurrentSession" #define BIND_SESSION "CurrentSession"
#define BIND_SESSION_SUBKEY "Software\\ISC\\BIND\\CurrentSession" #define BIND_SESSION_SUBKEY "Software\\ISC\\BIND\\CurrentSession"
#define BIND_UNINSTALL_SUBKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ISC BIND" #define BIND_UNINSTALL_SUBKEY \
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ISC BIND"
#define EVENTLOG_APP_SUBKEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application" #define EVENTLOG_APP_SUBKEY \
#define BIND_MESSAGE_SUBKEY "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\named" "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application"
#define BIND_MESSAGE_SUBKEY \
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\named"
#define BIND_MESSAGE_NAME "named" #define BIND_MESSAGE_NAME "named"
#define BIND_CONFIGFILE 0 #define BIND_CONFIGFILE 0

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: int.h,v 1.9 2001/07/08 05:09:25 mayer Exp $ */ /* $Id: int.h,v 1.10 2001/07/09 21:06:26 gson Exp $ */
#ifndef ISC_INT_H #ifndef ISC_INT_H
#define ISC_INT_H 1 #define ISC_INT_H 1
@ -23,7 +23,6 @@
#define _INTEGRAL_MAX_BITS 64 #define _INTEGRAL_MAX_BITS 64
#include <limits.h> #include <limits.h>
typedef __int8 isc_int8_t; typedef __int8 isc_int8_t;
typedef unsigned __int8 isc_uint8_t; typedef unsigned __int8 isc_uint8_t;
typedef __int16 isc_int16_t; typedef __int16 isc_int16_t;

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: mutex.h,v 1.15 2001/07/08 05:09:28 mayer Exp $ */ /* $Id: mutex.h,v 1.16 2001/07/09 21:06:27 gson Exp $ */
#ifndef ISC_MUTEX_H #ifndef ISC_MUTEX_H
#define ISC_MUTEX_H 1 #define ISC_MUTEX_H 1
@ -30,9 +30,7 @@ typedef CRITICAL_SECTION isc_mutex_t;
/* This definition is here since WINBASE.H omits it for some reason */ /* This definition is here since WINBASE.H omits it for some reason */
WINBASEAPI BOOL WINAPI WINBASEAPI BOOL WINAPI
TryEnterCriticalSection( TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
LPCRITICAL_SECTION lpCriticalSection
);
#define isc_mutex_init(mp) \ #define isc_mutex_init(mp) \
(InitializeCriticalSection((mp)), ISC_R_SUCCESS) (InitializeCriticalSection((mp)), ISC_R_SUCCESS)

View File

@ -15,9 +15,10 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: ntfile.h,v 1.2 2001/07/08 05:09:30 mayer Exp $ */ /* $Id: ntfile.h,v 1.3 2001/07/09 21:06:28 gson Exp $ */
/* This file has been necessitated by the fact that the iov array is local /*
* This file has been necessitated by the fact that the iov array is local
* to the module, so passing the FILE ptr to a file I/O function in a * to the module, so passing the FILE ptr to a file I/O function in a
* different module or DLL will cause the application to fail to find the * different module or DLL will cause the application to fail to find the
* I/O channel and the application will terminate. The standard file I/O * I/O channel and the application will terminate. The standard file I/O

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: platform.h,v 1.2 2001/07/08 05:09:33 mayer Exp $ */ /* $Id: platform.h,v 1.3 2001/07/09 21:06:29 gson Exp $ */
#ifndef ISC_PLATFORM_H #ifndef ISC_PLATFORM_H
#define ISC_PLATFORM_H 1 #define ISC_PLATFORM_H 1
@ -23,10 +23,13 @@
/***** /*****
***** Platform-dependent defines. ***** Platform-dependent defines.
*****/ *****/
#define ISC_PLATFORM_USETHREADS #define ISC_PLATFORM_USETHREADS
/*** /***
*** Network. *** Network.
***/ ***/
#define ISC_PLATFORM_HAVEIPV6 #define ISC_PLATFORM_HAVEIPV6
#define ISC_PLATFORM_NEEDPORTT #define ISC_PLATFORM_NEEDPORTT
#undef MSG_TRUNC #undef MSG_TRUNC

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: stat.h,v 1.2 2001/07/08 05:09:34 mayer Exp $ */ /* $Id: stat.h,v 1.3 2001/07/09 21:06:30 gson Exp $ */
#ifndef ISC_STAT_H #ifndef ISC_STAT_H
#define ISC_STAT_H 1 #define ISC_STAT_H 1
@ -40,5 +40,4 @@
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) # define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif #endif
#endif /* ISC_STAT_H */
#endif /* ISC_STDIO_H */

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: interfaceiter.c,v 1.2 2001/07/08 05:09:02 mayer Exp $ */ /* $Id: interfaceiter.c,v 1.3 2001/07/09 21:06:09 gson Exp $ */
/* /*
* Note that this code will need to be revisited to support IPv6 Interfaces. * Note that this code will need to be revisited to support IPv6 Interfaces.
@ -60,7 +60,8 @@ struct isc_interfaceiter {
int socket; int socket;
INTERFACE_INFO IFData; /* Current Interface Info */ INTERFACE_INFO IFData; /* Current Interface Info */
int numIF; /* Current Interface count */ int numIF; /* Current Interface count */
int totalIF; /* Total Number of Interfaces */ int totalIF; /* Total Number
of Interfaces */
INTERFACE_INFO *buf; /* Buffer for WSAIoctl data. */ INTERFACE_INFO *buf; /* Buffer for WSAIoctl data. */
unsigned int bufsize; /* Bytes allocated. */ unsigned int bufsize; /* Bytes allocated. */
INTERFACE_INFO *pos; /* Current offset in IF List */ INTERFACE_INFO *pos; /* Current offset in IF List */
@ -117,7 +118,8 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
iter->buf = NULL; iter->buf = NULL;
/* /*
* Create an unbound datagram socket to do the SIO_GET_INTERFACE_LIST WSAIoctl on. * Create an unbound datagram socket to do the
* SIO_GET_INTERFACE_LIST WSAIoctl on.
*/ */
if ((iter->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { if ((iter->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__, UNEXPECTED_ERROR(__FILE__, __LINE__,
@ -140,9 +142,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
goto alloc_failure; goto alloc_failure;
} }
if (WSAIoctl(iter->socket, SIO_GET_INTERFACE_LIST, 0, 0, iter->buf, iter->bufsize, if (WSAIoctl(iter->socket, SIO_GET_INTERFACE_LIST,
0, 0, iter->buf, iter->bufsize,
&bytesReturned, 0, 0) &bytesReturned, 0, 0)
== SOCKET_ERROR) { == SOCKET_ERROR)
{
error = WSAGetLastError(); error = WSAGetLastError();
if (error != WSAEFAULT && error != WSAENOBUFS) { if (error != WSAEFAULT && error != WSAENOBUFS) {
errno = error; errno = error;
@ -158,10 +162,12 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
} else { } else {
/* /*
* The WSAIoctl succeeded. * The WSAIoctl succeeded.
* If the number of the returned bytes is the same as the buffer size, * If the number of the returned bytes is the same
* we will grow it just in case and retry. * as the buffer size, we will grow it just in
* case and retry.
*/ */
if (bytesReturned > 0 && (bytesReturned < iter->bufsize)) if (bytesReturned > 0 &&
(bytesReturned < iter->bufsize))
break; break;
} }
if (iter->bufsize >= IFCONF_SIZE_MAX*sizeof(INTERFACE_INFO)) { if (iter->bufsize >= IFCONF_SIZE_MAX*sizeof(INTERFACE_INFO)) {
@ -173,7 +179,8 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
} }
isc_mem_put(mctx, iter->buf, iter->bufsize); isc_mem_put(mctx, iter->buf, iter->bufsize);
iter->bufsize += IFCONF_SIZE_INCREMENT*sizeof(INTERFACE_INFO); iter->bufsize += IFCONF_SIZE_INCREMENT *
sizeof(INTERFACE_INFO);
} }
/* /*
@ -213,9 +220,9 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
static isc_result_t static isc_result_t
internal_current(isc_interfaceiter_t *iter, int family) { internal_current(isc_interfaceiter_t *iter, int family) {
BOOL ifNamed = FALSE; BOOL ifNamed = FALSE;
unsigned long flags; unsigned long flags;
REQUIRE(VALID_IFITER(iter)); REQUIRE(VALID_IFITER(iter));
REQUIRE(iter->numIF >= 0); REQUIRE(iter->numIF >= 0);
@ -235,21 +242,19 @@ internal_current(isc_interfaceiter_t *iter, int family) {
if ((flags & IFF_UP) != 0) if ((flags & IFF_UP) != 0)
iter->current.flags |= INTERFACE_F_UP; iter->current.flags |= INTERFACE_F_UP;
if ((flags & IFF_POINTTOPOINT) != 0) if ((flags & IFF_POINTTOPOINT) != 0) {
{
iter->current.flags |= INTERFACE_F_POINTTOPOINT; iter->current.flags |= INTERFACE_F_POINTTOPOINT;
sprintf(iter->current.name, "PPP Interface %d", iter->numIF); sprintf(iter->current.name, "PPP Interface %d", iter->numIF);
ifNamed = TRUE; ifNamed = TRUE;
} }
if ((flags & IFF_LOOPBACK) != 0) if ((flags & IFF_LOOPBACK) != 0) {
{
iter->current.flags |= INTERFACE_F_LOOPBACK; iter->current.flags |= INTERFACE_F_LOOPBACK;
sprintf(iter->current.name, "Loopback Interface %d", iter->numIF); sprintf(iter->current.name, "Loopback Interface %d",
iter->numIF);
ifNamed = TRUE; ifNamed = TRUE;
} }
/* /*
* If the interface is point-to-point, get the destination address. * If the interface is point-to-point, get the destination address.
*/ */
@ -259,17 +264,14 @@ internal_current(isc_interfaceiter_t *iter, int family) {
} }
if (ifNamed == FALSE) if (ifNamed == FALSE)
sprintf(iter->current.name, "TCP/IP Interface %d", iter->numIF); sprintf(iter->current.name,
"TCP/IP Interface %d", iter->numIF);
/* /*
* Get the network mask. * Get the network mask.
*/ */
switch (family) { switch (family) {
case AF_INET: case AF_INET:
/*
* Ignore the HP/UX warning about "interger overflow during
* conversion. It comes from its own macro definition,
* and is really hard to shut up.
*/
get_addr(family, &iter->current.netmask, get_addr(family, &iter->current.netmask,
(struct sockaddr *)&(iter->IFData.iiNetmask)); (struct sockaddr *)&(iter->IFData.iiNetmask));
break; break;
@ -289,7 +291,6 @@ internal_current(isc_interfaceiter_t *iter, int family) {
*/ */
static isc_result_t static isc_result_t
internal_next(isc_interfaceiter_t *iter) { internal_next(isc_interfaceiter_t *iter) {
if (iter->numIF >= iter->totalIF) if (iter->numIF >= iter->totalIF)
return (ISC_R_NOMORE); return (ISC_R_NOMORE);
@ -301,9 +302,8 @@ internal_next(isc_interfaceiter_t *iter) {
*/ */
if (iter->numIF == 0) if (iter->numIF == 0)
{
iter->pos = (INTERFACE_INFO *)(iter->buf + (iter->totalIF)); iter->pos = (INTERFACE_INFO *)(iter->buf + (iter->totalIF));
}
iter->pos--; iter->pos--;
if (&(iter->pos) < &(iter->buf)) if (&(iter->pos) < &(iter->buf))
return (ISC_R_NOMORE); return (ISC_R_NOMORE);
@ -315,10 +315,6 @@ internal_next(isc_interfaceiter_t *iter) {
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
/*
* The remaining code is common to the sysctl and ioctl case.
*/
isc_result_t isc_result_t
isc_interfaceiter_current(isc_interfaceiter_t *iter, isc_interfaceiter_current(isc_interfaceiter_t *iter,
isc_interface_t *ifdata) { isc_interface_t *ifdata) {
@ -366,8 +362,7 @@ isc_interfaceiter_next(isc_interfaceiter_t *iter) {
} }
void void
isc_interfaceiter_destroy(isc_interfaceiter_t **iterp) isc_interfaceiter_destroy(isc_interfaceiter_t **iterp) {
{
isc_interfaceiter_t *iter; isc_interfaceiter_t *iter;
REQUIRE(iterp != NULL); REQUIRE(iterp != NULL);
iter = *iterp; iter = *iterp;

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: ipv6.c,v 1.2 2001/07/08 05:09:03 mayer Exp $ */ /* $Id: ipv6.c,v 1.3 2001/07/09 21:06:10 gson Exp $ */
#define LIBISC_EXTERNAL_DATA __declspec( dllexport ) #define LIBISC_EXTERNAL_DATA __declspec( dllexport )
@ -23,5 +23,8 @@
#include <isc/net.h> #include <isc/net.h>
LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_any =
LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; IN6ADDR_ANY_INIT;
LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_loopback =
IN6ADDR_LOOPBACK_INIT;

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: keyboard.c,v 1.2 2001/07/08 05:09:04 mayer Exp $ */ /* $Id: keyboard.c,v 1.3 2001/07/09 21:06:11 gson Exp $ */
#include <config.h> #include <config.h>
@ -49,7 +49,6 @@ isc_keyboard_open(isc_keyboard_t *keyboard) {
keyboard->result = ISC_R_SUCCESS; keyboard->result = ISC_R_SUCCESS;
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
isc_result_t isc_result_t

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: net.c,v 1.2 2001/07/08 05:09:05 mayer Exp $ */ /* $Id: net.c,v 1.3 2001/07/09 21:06:12 gson Exp $ */
#include <config.h> #include <config.h>
@ -74,7 +74,8 @@ try_proto(int domain) {
* Check to see if IPv6 is broken, as is common on Linux. * Check to see if IPv6 is broken, as is common on Linux.
*/ */
len = sizeof(sin6); len = sizeof(sin6);
if (getsockname(s, (struct sockaddr *)&sin6, (void *)&len) < 0) { if (getsockname(s, (struct sockaddr *)&sin6, (void *)&len) < 0)
{
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
"retrieving the address of an IPv6 " "retrieving the address of an IPv6 "
@ -130,22 +131,12 @@ initialize(void) {
isc_result_t isc_result_t
isc_net_probeipv4(void) { isc_net_probeipv4(void) {
/*
* Check if the system's kernel supports IPv4.
*/
initialize(); initialize();
return (ipv4_result); return (ipv4_result);
} }
isc_result_t isc_result_t
isc_net_probeipv6(void) { isc_net_probeipv6(void) {
/*
* Check if the system's kernel supports IPv6.
*/
initialize(); initialize();
return (ipv6_result); return (ipv6_result);
} }

View File

@ -15,9 +15,10 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: ntfile.c,v 1.2 2001/07/08 05:09:08 mayer Exp $ */ /* $Id: ntfile.c,v 1.3 2001/07/09 21:06:14 gson Exp $ */
/* This file has been necessitated by the fact that the iov array is local /*
* This file has been necessitated by the fact that the iov array is local
* to the module, so passing the FILE ptr to a file I/O function in a * to the module, so passing the FILE ptr to a file I/O function in a
* different module or DLL will cause the application to fail to find the * different module or DLL will cause the application to fail to find the
* I/O channel and the application will terminate. The standard file I/O * I/O channel and the application will terminate. The standard file I/O
@ -31,23 +32,21 @@
FILE * FILE *
isc_ntfile_fopen(const char *filename, const char *mode) { isc_ntfile_fopen(const char *filename, const char *mode) {
return (fopen(filename, mode)); return (fopen(filename, mode));
} }
int int
isc_ntfile_fclose(FILE *f) { isc_ntfile_fclose(FILE *f) {
return (fclose(f)); return (fclose(f));
} }
int int
isc_ntfile_fseek(FILE *f, long offset, int whence) { isc_ntfile_fseek(FILE *f, long offset, int whence) {
return (fseek(f, offset, whence)); return (fseek(f, offset, whence));
} }
size_t size_t
isc_ntfile_fread(void *ptr, size_t size, size_t nmemb, FILE *f) { isc_ntfile_fread(void *ptr, size_t size, size_t nmemb, FILE *f) {
return (fread(ptr, size, nmemb, f)); return (fread(ptr, size, nmemb, f));
} }
@ -61,13 +60,11 @@ isc_ntfile_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f) {
int int
isc_ntfile_flush(FILE *f) { isc_ntfile_flush(FILE *f) {
return (fflush(f)); return (fflush(f));
} }
int int
isc_ntfile_sync(FILE *f) { isc_ntfile_sync(FILE *f) {
return (_commit(_fileno(f))); return (_commit(_fileno(f)));
} }
@ -152,6 +149,7 @@ FILE *
isc_ntfile_fdopen(int handle, const char *mode) { isc_ntfile_fdopen(int handle, const char *mode) {
return (fdopen(handle, mode)); return (fdopen(handle, mode));
} }
/* /*
* open(), close(), read(), write(), fsync() * open(), close(), read(), write(), fsync()
* sockets are file descriptors in UNIX. This is not so in NT * sockets are file descriptors in UNIX. This is not so in NT

View File

@ -15,10 +15,10 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: ntpaths.c,v 1.2 2001/07/08 05:09:09 mayer Exp $ */ /* $Id: ntpaths.c,v 1.3 2001/07/09 21:06:15 gson Exp $ */
/* /*
* This file fetches the required path information that is specific * This module fetches the required path information that is specific
* to NT systems which can have its configuration and system files * to NT systems which can have its configuration and system files
* almost anywhere. It can be used to override whatever the application * almost anywhere. It can be used to override whatever the application
* had previously assigned to the pointer. Basic information about the * had previously assigned to the pointer. Basic information about the
@ -45,8 +45,7 @@ static DWORD baseLen = MAX_PATH;
static BOOL Initialized = FALSE; static BOOL Initialized = FALSE;
void void
isc_ntpaths_init() isc_ntpaths_init() {
{
HKEY hKey; HKEY hKey;
BOOL keyFound = TRUE; BOOL keyFound = TRUE;
@ -55,8 +54,7 @@ isc_ntpaths_init()
!= ERROR_SUCCESS) != ERROR_SUCCESS)
keyFound = FALSE; keyFound = FALSE;
if (keyFound == TRUE) if (keyFound == TRUE) {
{
/* Get the named directory */ /* Get the named directory */
if (RegQueryValueEx(hKey, "InstallDir", NULL, NULL, if (RegQueryValueEx(hKey, "InstallDir", NULL, NULL,
(LPBYTE)namedBase, &baseLen) != ERROR_SUCCESS) (LPBYTE)namedBase, &baseLen) != ERROR_SUCCESS)
@ -94,10 +92,9 @@ isc_ntpaths_init()
char * char *
isc_ntpaths_get(int ind) { isc_ntpaths_get(int ind) {
if (!Initialized)
if (!Initialized) {
isc_ntpaths_init(); isc_ntpaths_init();
}
switch (ind) { switch (ind) {
case NAMED_CONF_PATH: case NAMED_CONF_PATH:
return (ns_confFile); return (ns_confFile);
@ -121,4 +118,3 @@ isc_ntpaths_get(int ind) {
return (NULL); return (NULL);
} }
} }

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: once.c,v 1.8 2001/07/08 05:09:10 mayer Exp $ */ /* $Id: once.c,v 1.9 2001/07/09 21:06:16 gson Exp $ */
/* Principal Authors: DCL */ /* Principal Authors: DCL */
@ -28,9 +28,7 @@
#include <isc/util.h> #include <isc/util.h>
isc_result_t isc_result_t
isc_once_do(isc_once_t *controller, void(*function)(void)) isc_once_do(isc_once_t *controller, void(*function)(void)) {
{
REQUIRE(controller != NULL && function != NULL); REQUIRE(controller != NULL && function != NULL);
if (controller->status == ISC_ONCE_INIT_NEEDED) { if (controller->status == ISC_ONCE_INIT_NEEDED) {

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: os.c,v 1.2 2001/07/08 05:09:11 mayer Exp $ */ /* $Id: os.c,v 1.3 2001/07/09 21:06:17 gson Exp $ */
#include <windows.h> #include <windows.h>
@ -49,14 +49,12 @@ isc_os_ncpus(void) {
unsigned int unsigned int
isc_os_majorversion(void) { isc_os_majorversion(void) {
initialize_action(); initialize_action();
return ((unsigned int)osVer.dwMajorVersion); return ((unsigned int)osVer.dwMajorVersion);
} }
unsigned int unsigned int
isc_os_minorversion(void) { isc_os_minorversion(void) {
initialize_action(); initialize_action();
return ((unsigned int)osVer.dwMinorVersion); return ((unsigned int)osVer.dwMinorVersion);
} }

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: socket.c,v 1.2 2001/07/08 05:09:12 mayer Exp $ */ /* $Id: socket.c,v 1.3 2001/07/09 21:06:18 gson Exp $ */
#define MAKE_EXTERNAL 1 #define MAKE_EXTERNAL 1
#include <config.h> #include <config.h>
@ -138,9 +138,8 @@ typedef isc_event_t intev_t;
* Message header for recvmsg and sendmsg calls. * Message header for recvmsg and sendmsg calls.
* Used value-result for recvmsg, value only for sendmsg. * Used value-result for recvmsg, value only for sendmsg.
*/ */
struct iovec { struct iovec {
void *iov_base; /* startin address of buffer */ void *iov_base; /* starting address of buffer */
size_t iov_len; /* size of buffer */ size_t iov_len; /* size of buffer */
}; };
@ -262,15 +261,14 @@ long bpipe_written = 0;
#define SOCK_DEAD(s) ((s)->references == 0) #define SOCK_DEAD(s) ((s)->references == 0)
/* /*
* The following routines are here to handle Unix emulation until we can rewrite the * The following routines are here to handle Unix emulation until we
* the routines in Winsock2 style. * can rewrite the the routines in Winsock2 style.
*/ */
/* /*
* Initialize socket services * Initialize socket services
*/ */
BOOL InitSockets() BOOL InitSockets() {
{
WORD wVersionRequested; WORD wVersionRequested;
WSADATA wsaData; WSADATA wsaData;
int err; int err;
@ -279,8 +277,7 @@ BOOL InitSockets()
wVersionRequested = MAKEWORD(2, 0); wVersionRequested = MAKEWORD(2, 0);
err = WSAStartup(wVersionRequested, &wsaData); err = WSAStartup(wVersionRequested, &wsaData);
if ( err != 0 ) if ( err != 0 ) {
{
/* Tell the user that we could not find a usable Winsock DLL */ /* Tell the user that we could not find a usable Winsock DLL */
return (FALSE); return (FALSE);
} }
@ -288,8 +285,8 @@ BOOL InitSockets()
return (TRUE); return (TRUE);
} }
int internal_pipe( int filedes[2]) int
{ internal_pipe(int filedes[2]) {
int status; int status;
unsigned int pipesize = 65535; unsigned int pipesize = 65535;
int mode = _O_TEXT; int mode = _O_TEXT;
@ -300,8 +297,7 @@ int internal_pipe( int filedes[2])
} }
int int
internal_sendmsg(int sock, const struct msghdr *msg, int flags) internal_sendmsg(int sock, const struct msghdr *msg, int flags) {
{
int Error; int Error;
DWORD BytesSent; DWORD BytesSent;
DWORD Flags = flags; DWORD Flags = flags;
@ -317,7 +313,6 @@ internal_sendmsg(int sock, const struct msghdr *msg, int flags)
NULL); NULL);
if (Error == SOCKET_ERROR) { if (Error == SOCKET_ERROR) {
BytesSent = -1; BytesSent = -1;
/* There is an error... */ /* There is an error... */
Error = WSAGetLastError(); Error = WSAGetLastError();
@ -328,14 +323,10 @@ internal_sendmsg(int sock, const struct msghdr *msg, int flags)
* before we can send. * before we can send.
*/ */
errno = EWOULDBLOCK; errno = EWOULDBLOCK;
} else if (Error == WSA_IO_PENDING) { } else if (Error == WSA_IO_PENDING) {
/* Overlapped send successfully initiated. */ /* Overlapped send successfully initiated. */
errno = EAGAIN; errno = EAGAIN;
} } else {
else {
/* An unexpected error occurred. */ /* An unexpected error occurred. */
errno = Error; errno = Error;
} }
@ -343,12 +334,10 @@ internal_sendmsg(int sock, const struct msghdr *msg, int flags)
/* No error -- the I/O request was completed immediately... */ /* No error -- the I/O request was completed immediately... */
return (BytesSent); return (BytesSent);
} }
int int
internal_recvmsg(int sock, struct msghdr *msg, int flags) internal_recvmsg(int sock, struct msghdr *msg, int flags) {
{
DWORD Flags = flags; DWORD Flags = flags;
DWORD NumBytes; DWORD NumBytes;
int Result; int Result;
@ -368,20 +357,19 @@ internal_recvmsg(int sock, struct msghdr *msg, int flags)
/* Check for errors. */ /* Check for errors. */
if (Result == SOCKET_ERROR) { if (Result == SOCKET_ERROR) {
Error = WSAGetLastError(); Error = WSAGetLastError();
NumBytes = -1; NumBytes = -1;
switch (Error) { switch (Error) {
case WSAEWOULDBLOCK: case WSAEWOULDBLOCK:
/*
/* No data received; return to wait for another read event. */ * No data received; return to wait for another
* read event.
*/
errno = EAGAIN; errno = EAGAIN;
break; break;
default: default:
/* Some other error... hit the panic button. */ /* Some other error... hit the panic button. */
errno = Error; errno = Error;
break; break;
@ -390,8 +378,7 @@ internal_recvmsg(int sock, struct msghdr *msg, int flags)
msg->msg_flags = Flags; /* Return the flags received in header */ msg->msg_flags = Flags; /* Return the flags received in header */
return (NumBytes); return (NumBytes);
}
} /* Internal_recvmsg() */
static void static void
manager_log(isc_socketmgr_t *sockmgr, manager_log(isc_socketmgr_t *sockmgr,
@ -498,7 +485,8 @@ select_poke(isc_socketmgr_t *mgr, int fd, int msg) {
if (cc < 0) if (cc < 0)
FATAL_ERROR(__FILE__, __LINE__, FATAL_ERROR(__FILE__, __LINE__,
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, isc_msgcat_get(isc_msgcat,
ISC_MSGSET_SOCKET,
ISC_MSG_WRITEFAILED, ISC_MSG_WRITEFAILED,
"_write() failed " "_write() failed "
"during watcher poke: %s"), "during watcher poke: %s"),
@ -507,11 +495,11 @@ select_poke(isc_socketmgr_t *mgr, int fd, int msg) {
INSIST(cc == sizeof(buf)); INSIST(cc == sizeof(buf));
InterlockedIncrement(&bpipe_written); InterlockedIncrement(&bpipe_written);
} } else {
else {
wakeup_socket(mgr, fd, msg); wakeup_socket(mgr, fd, msg);
} }
} }
/* /*
* Read a message on the internal fd. * Read a message on the internal fd.
*/ */
@ -532,7 +520,6 @@ select_readmsg(isc_socketmgr_t *mgr, int *fd, int *msg) {
"_read() failed " "_read() failed "
"during watcher poke: %s"), "during watcher poke: %s"),
strerror(errno)); strerror(errno));
return; return;
} }
INSIST(cc == sizeof(buf)); INSIST(cc == sizeof(buf));
@ -1008,7 +995,8 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
socket_log(sock, NULL, IOEVENT, socket_log(sock, NULL, IOEVENT,
isc_msgcat, ISC_MSGSET_SOCKET, isc_msgcat, ISC_MSGSET_SOCKET,
ISC_MSG_DOIORECV, ISC_MSG_DOIORECV,
"doio_recv: internal_recvmsg(%d) %d bytes, err %d/%s", "doio_recv: internal_recvmsg(%d) %d bytes, "
"err %d/%s",
sock->fd, cc, errno, strerror(errno)); sock->fd, cc, errno, strerror(errno));
#define SOFT_OR_HARD(_system, _isc) \ #define SOFT_OR_HARD(_system, _isc) \
@ -3298,4 +3286,3 @@ isc_socket_isbound(isc_socket_t *sock) {
return (val); return (val);
} }

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: syslog.c,v 1.2 2001/07/08 05:09:15 mayer Exp $ */ /* $Id: syslog.c,v 1.3 2001/07/09 21:06:19 gson Exp $ */
#include <config.h> #include <config.h>
@ -85,7 +85,6 @@ isc_syslog_facilityfromstring(const char *str, int *facilityp) {
} }
} }
return (ISC_R_NOTFOUND); return (ISC_R_NOTFOUND);
} }
/* /*

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: syslog.h,v 1.2 2001/07/08 05:09:16 mayer Exp $ */ /* $Id: syslog.h,v 1.3 2001/07/09 21:06:20 gson Exp $ */
#ifndef _SYSLOG_H #ifndef _SYSLOG_H
#define _SYSLOG_H #define _SYSLOG_H
@ -53,13 +53,16 @@
void void
syslog(int level, const char *fmt, ...); syslog(int level, const char *fmt, ...);
void void
openlog(const char *, int, ...); openlog(const char *, int, ...);
void void
closelog(void); closelog(void);
void void
ModifyLogLevel(int level); ModifyLogLevel(int level);
void void
InitNTLogging(FILE *, int); InitNTLogging(FILE *, int);

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: thread.c,v 1.16 2001/07/08 05:09:17 mayer Exp $ */ /* $Id: thread.c,v 1.17 2001/07/09 21:06:21 gson Exp $ */
#include <config.h> #include <config.h>
@ -25,7 +25,8 @@
isc_result_t isc_result_t
isc_thread_create(isc_threadfunc_t start, isc_threadarg_t arg, isc_thread_create(isc_threadfunc_t start, isc_threadarg_t arg,
isc_thread_t *threadp) { isc_thread_t *threadp)
{
isc_thread_t thread; isc_thread_t thread;
unsigned int id; unsigned int id;
@ -60,7 +61,6 @@ isc_thread_join(isc_thread_t thread, isc_threadresult_t *rp) {
void void
isc_thread_setconcurrency(unsigned int level) { isc_thread_setconcurrency(unsigned int level) {
/* /*
* This is unnecessary on Win32 systems, but is here so that the * This is unnecessary on Win32 systems, but is here so that the
* call exists * call exists

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: time.c,v 1.22 2001/07/08 05:09:18 mayer Exp $ */ /* $Id: time.c,v 1.23 2001/07/09 21:06:22 gson Exp $ */
/* /*
* Windows has a different epoch than Unix. Therefore this code sets the epoch * Windows has a different epoch than Unix. Therefore this code sets the epoch
@ -69,6 +69,7 @@ TimetToFileTime(time_t t, LPFILETIME pft) {
pft->dwLowDateTime = (DWORD) i; pft->dwLowDateTime = (DWORD) i;
pft->dwHighDateTime = (DWORD) (i >>32); pft->dwHighDateTime = (DWORD) (i >>32);
} }
/*** /***
*** Intervals *** Intervals
***/ ***/
@ -77,15 +78,9 @@ static isc_interval_t zero_interval = { 0 };
isc_interval_t *isc_interval_zero = &zero_interval; isc_interval_t *isc_interval_zero = &zero_interval;
void void
isc_interval_set(isc_interval_t *i, isc_interval_set(isc_interval_t *i, unsigned int seconds,
unsigned int seconds, unsigned int nanoseconds) { unsigned int nanoseconds)
{
/*
* Set 'i' to a value representing an interval of 'seconds' seconds
* and 'nanoseconds' nanoseconds, suitable for use in isc_time_add()
* and isc_time_subtract().
*/
REQUIRE(i != NULL); REQUIRE(i != NULL);
REQUIRE(nanoseconds < NS_PER_S); REQUIRE(nanoseconds < NS_PER_S);
@ -95,11 +90,6 @@ isc_interval_set(isc_interval_t *i,
isc_boolean_t isc_boolean_t
isc_interval_iszero(isc_interval_t *i) { isc_interval_iszero(isc_interval_t *i) {
/*
* Returns ISC_TRUE iff. 'i' is the zero interval.
*/
REQUIRE(i != NULL); REQUIRE(i != NULL);
if (i->interval == 0) if (i->interval == 0)
return (ISC_TRUE); return (ISC_TRUE);
@ -112,10 +102,6 @@ void
isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) { isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) {
ULARGE_INTEGER i; ULARGE_INTEGER i;
/*
* Set 't' to a particular number of seconds + nanoseconds since the
* epoch.
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
REQUIRE(nanoseconds < NS_PER_S); REQUIRE(nanoseconds < NS_PER_S);
@ -134,10 +120,6 @@ isc_time_initepoch() {
void void
isc_time_settoepoch(isc_time_t *t) { isc_time_settoepoch(isc_time_t *t) {
/*
* Set 't' to the time of the epoch.
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
t->absolute.dwLowDateTime = epoch.absolute.dwLowDateTime; t->absolute.dwLowDateTime = epoch.absolute.dwLowDateTime;
@ -146,11 +128,6 @@ isc_time_settoepoch(isc_time_t *t) {
isc_boolean_t isc_boolean_t
isc_time_isepoch(isc_time_t *t) { isc_time_isepoch(isc_time_t *t) {
/*
* Returns ISC_TRUE iff. 't' is the epoch ("time zero").
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
if (t->absolute.dwLowDateTime == epoch.absolute.dwLowDateTime && if (t->absolute.dwLowDateTime == epoch.absolute.dwLowDateTime &&
@ -162,11 +139,7 @@ isc_time_isepoch(isc_time_t *t) {
isc_result_t isc_result_t
isc_time_now(isc_time_t *t) { isc_time_now(isc_time_t *t) {
char dtime[10]; char dtime[10];
/*
* Set *t to the current absolute time.
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
@ -180,10 +153,6 @@ isc_result_t
isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) { isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) {
ULARGE_INTEGER i1; ULARGE_INTEGER i1;
/*
* Set *t to the current absolute time + i.
*/
REQUIRE(t != NULL); REQUIRE(t != NULL);
REQUIRE(i != NULL); REQUIRE(i != NULL);
@ -205,10 +174,6 @@ isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) {
int int
isc_time_compare(isc_time_t *t1, isc_time_t *t2) { isc_time_compare(isc_time_t *t1, isc_time_t *t2) {
/*
* Compare the times referenced by 't1' and 't2'
*/
REQUIRE(t1 != NULL && t2 != NULL); REQUIRE(t1 != NULL && t2 != NULL);
return ((int)CompareFileTime(&t1->absolute, &t2->absolute)); return ((int)CompareFileTime(&t1->absolute, &t2->absolute));
@ -218,10 +183,6 @@ isc_result_t
isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
ULARGE_INTEGER i1; ULARGE_INTEGER i1;
/*
* Add 't' to 'i', storing the result in 'result'.
*/
REQUIRE(t != NULL && i != NULL && result != NULL); REQUIRE(t != NULL && i != NULL && result != NULL);
i1.LowPart = t->absolute.dwLowDateTime; i1.LowPart = t->absolute.dwLowDateTime;
@ -242,10 +203,6 @@ isc_result_t
isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
ULARGE_INTEGER i1; ULARGE_INTEGER i1;
/*
* Subtract 'i' from 't', storing the result in 'result'.
*/
REQUIRE(t != NULL && i != NULL && result != NULL); REQUIRE(t != NULL && i != NULL && result != NULL);
i1.LowPart = t->absolute.dwLowDateTime; i1.LowPart = t->absolute.dwLowDateTime;
@ -286,9 +243,9 @@ isc_time_microdiff(isc_time_t *t1, isc_time_t *t2) {
} }
/* /*
* Note that the value returned is the seconds relative to the Unix epoch rather than * Note that the value returned is the seconds relative to the Unix
* the seconds since Windows epoch. * epoch rather than the seconds since Windows epoch. This is for
* This is for compatibility with the Unix side. * compatibility with the Unix side.
*/ */
isc_uint32_t isc_uint32_t
isc_time_seconds(isc_time_t *t) { isc_time_seconds(isc_time_t *t) {
@ -296,8 +253,10 @@ isc_time_seconds(isc_time_t *t) {
REQUIRE(t != NULL); REQUIRE(t != NULL);
i.LowPart = t->absolute.dwLowDateTime - epoch.absolute.dwLowDateTime; i.LowPart = t->absolute.dwLowDateTime -
i.HighPart = t->absolute.dwHighDateTime - epoch.absolute.dwHighDateTime; epoch.absolute.dwLowDateTime;
i.HighPart = t->absolute.dwHighDateTime -
epoch.absolute.dwHighDateTime;
return ((isc_uint32_t)(i.QuadPart / INTERVALS_PER_S)); return ((isc_uint32_t)(i.QuadPart / INTERVALS_PER_S));
} }

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: unistd.h,v 1.2 2001/07/08 05:09:19 mayer Exp $ */ /* $Id: unistd.h,v 1.3 2001/07/09 21:06:23 gson Exp $ */
/* None of these are defined in NT, so define them for our use */ /* None of these are defined in NT, so define them for our use */
#define O_NONBLOCK 1 #define O_NONBLOCK 1
@ -34,5 +34,5 @@
#undef F_DUPFD #undef F_DUPFD
int fcntl(int, int, ...); int fcntl(int, int, ...);
#include <process.h>
#include <process.h>