Example #1
0
/* background daemon for timing out transactions */
static void*
BKGLoop(void *unused)
{
    struct timeval tv;
    int loop = 0;

    afs_pthread_setname_self("vol bkg");
    while (1) {
	tv.tv_sec = GCWAKEUP;
	tv.tv_usec = 0;
#ifdef AFS_PTHREAD_ENV
#ifdef AFS_NT40_ENV
        Sleep(GCWAKEUP * 1000);
#else
        select(0, 0, 0, 0, &tv);
#endif
#else
	(void)IOMGR_Select(0, 0, 0, 0, &tv);
#endif
	GCTrans();
	TryUnlock();
	loop++;
	if (loop == 10) {	/* reopen log every 5 minutes */
	    loop = 0;
	    ReOpenLog();
	}
    }

    AFS_UNREACHED(return(NULL));
}
Example #2
0
/* background daemon for timing out transactions */
static void*
BKGLoop(void *unused)
{
    struct timeval tv;
    time_t now;
    afs_int32 sleepseconds;
    int loop = 0;

    while (1) {
        now = FT_ApproxTime();
        sleepseconds =
                GCWAKEUP - (now % GCWAKEUP); /* synchronize with wall clock */
        tv.tv_sec = sleepseconds;
	tv.tv_usec = 0;
#ifdef AFS_PTHREAD_ENV
#ifdef AFS_NT40_ENV
        Sleep(GCWAKEUP * 1000);
#else
        select(0, 0, 0, 0, &tv);
#endif
#else
	(void)IOMGR_Select(0, 0, 0, 0, &tv);
#endif
	TransferRate();
	GCTrans();
	TryUnlock();
	loop++;
	if (loop == 10) {	/* reopen log every 5 minutes */
	    loop = 0;
	    ReOpenLog(AFSDIR_SERVER_VOLSERLOG_FILEPATH);
	    if (osdvol)
                (osdvol->op_osd_5min_check)();
#ifdef AFS_DEMAND_ATTACH_FS
	    if (VInit >= 2) { /* look for newly mounted partitions */
		VAttachPartitions();
		VInitAttachVolumes(fileServer);
	    }
#endif
	}
    }

    return NULL;
}