*/
#include <afsconfig.h>
-#include "../afs/param.h"
+#include "afs/param.h"
RCSID("$Header$");
-#include "../afs/sysincludes.h" /* Standard vendor system headers */
-#include "../afs/afsincludes.h" /* Afs-based standard headers */
-#include "../afs/afs_stats.h" /* afs statistics */
+#include "afs/sysincludes.h" /* Standard vendor system headers */
+#include "afsincludes.h" /* Afs-based standard headers */
+#include "afs/afs_stats.h" /* afs statistics */
#ifdef AFS_AIX_ENV
#include <sys/adspace.h> /* for vm_att(), vm_det() */
#endif
#elif defined(AFS_OSF_ENV)
usimple_lock_init(&afs_global_lock);
afs_global_owner = (thread_t)0;
-#elif defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0);
afs_global_owner = 0;
#elif defined(AFS_AIX41_ENV)
lock_alloc((void*)&afs_global_lock, LOCK_ALLOC_PIN, 1, 1);
simple_lock_init((void *)&afs_global_lock);
-#else
-#ifndef AFS_LINUX22_ENV
+#elif !defined(AFS_LINUX22_ENV)
/* Linux initialization in osi directory. Should move the others. */
mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL);
#endif
-#endif
/* afs_rxglobal_lock is initialized in rx_Init. */
-#endif
+#endif /* AFS_GLOBAL_SUNLOCK */
#endif /* AFS_HPUX_ENV */
- if ( !afs_osicred_initialized ) {
- memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED));
+ if (!afs_osicred_initialized) {
+ memset(&afs_osi_cred, 0, sizeof(struct AFS_UCRED));
+#ifdef AFS_FBSD50_ENV
+ /*
+ * We don't init the mutex.
+ * This will be trouble if anyone tries to use change the refcount.
+ * Proper fix would be to make afs_osi_cred into a pointer,
+ * and crdup() it from curthread.
+ */
+ afs_osi_cred.cr_ref = 1;
+#else
crhold(&afs_osi_cred); /* don't let it evaporate */
+#endif
afs_osicred_initialized = 1;
}
+
#ifdef AFS_SGI64_ENV
osi_flid.fl_pid = osi_flid.fl_sysid = 0;
#endif
+
+ init_et_to_sys_error();
}
int osi_Active(register struct vcache *avc)
{
AFS_STATCNT(osi_Active);
-#if defined(AFS_SUN_ENV) || defined(AFS_AIX_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN5_ENV) || (AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_SUN_ENV) || defined(AFS_AIX_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN5_ENV) || (AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
if ((avc->opens > 0) || (avc->states & CMAPPED)) return 1; /* XXX: Warning, verify this XXX */
-#else
-#if defined(AFS_MACH_ENV)
+#elif defined(AFS_MACH_ENV)
if (avc->opens > 0 || ((avc->v.v_flag & VTEXT) && !inode_uncache_try(avc))) return 1;
-#else
-#if defined(AFS_SGI_ENV)
+#elif defined(AFS_SGI_ENV)
if ((avc->opens > 0) || AFS_VN_MAPPED(AFSTOV(avc)))
return 1;
#else
if (avc->opens > 0 || (AFSTOV(avc)->v_flag & VTEXT)) return(1);
#endif
-#endif /* AFS_MACH_ENV */
-#endif
return 0;
}
/* unmask signals in rxk listener */
void afs_osi_UnmaskRxkSignals(void)
{
-#ifdef AFS_LINUX22_ENV
- osi_linux_unmask();
-#endif
}
/* register rxk listener proc info */
{
#ifdef AFS_LINUX22_ENV
afs_osi_MaskSignals();
-#endif
-#ifdef AFS_DEC_ENV
+#elif defined(AFS_DEC_ENV)
u.u_procp->p_type |= SSYS;
-#endif
-#if AFS_SUN5_ENV
+#elif defined(AFS_SUN5_ENV)
curproc->p_flag |= SSYS;
-#endif
-#if AFS_HPUX101_ENV
+#elif defined(AFS_HPUX101_ENV)
set_system_proc(u.u_procp);
-#endif
-#if defined(AFS_DARWIN_ENV)
+#elif defined(AFS_DARWIN_ENV)
/* maybe call init_process instead? */
current_proc()->p_flag |= P_SYSTEM;
-#endif
-#if defined(AFS_FBSD_ENV)
+#elif defined(AFS_XBSD_ENV)
curproc->p_flag |= P_SYSTEM;
-#endif
-#if defined(AFS_SGI_ENV)
+#elif defined(AFS_SGI_ENV)
vrelvm();
-#endif /* AFS_SGI_ENV */
+#endif
AFS_STATCNT(osi_Invisible);
}
-#ifndef AFS_LINUX20_ENV /* Linux version in osi_misc.c */
+#if !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
/* set the real time */
void afs_osi_SetTime(osi_timeval_t *atv)
{
-#ifdef AFS_AIX32_ENV
+#if defined(AFS_AIX32_ENV)
struct timestruc_t t;
t.tv_sec = atv->tv_sec;
t.tv_nsec = atv->tv_usec * 1000;
ksettimer(&t); /* Was -> settimer(TIMEOFDAY, &t); */
-#else
-#ifdef AFS_SUN55_ENV
+#elif defined(AFS_SUN55_ENV)
stime(atv->tv_sec);
-#else
-#ifdef AFS_SUN5_ENV
+#elif defined(AFS_SUN5_ENV)
/*
* To get more than second resolution we can use adjtime. The problem
* is that the usecs from the server are wrong (by now) so it isn't
sta.time = atv->tv_sec;
stime(&sta, NULL);
-#else
-#if defined(AFS_SGI_ENV)
+#elif defined(AFS_SGI_ENV)
struct stimea {
sysarg_t time;
} sta;
sta.time = atv->tv_sec;
stime(&sta);
AFS_GLOCK();
-#else
-#if defined(AFS_FBSD_ENV)
- /* does not impliment security features of kern_time.c:settime() */
- struct timespec ts;
- struct timeval tv,delta;
- int s;
- AFS_GUNLOCK();
- s=splclock();
- microtime(&tv);
- delta=*atv;
- timevalsub(&delta, &tv);
- ts.tv_sec=atv->tv_sec;
- ts.tv_nsec=atv->tv_usec * 1000;
- set_timecounter(&ts);
- (void) splsoftclock();
- lease_updatetime(delta.tv_sec);
- splx(s);
- resettodr();
- AFS_GLOCK();
-#else
-#if defined(AFS_DARWIN_ENV)
+#elif defined(AFS_DARWIN_ENV)
AFS_GUNLOCK();
setthetime(atv);
AFS_GLOCK();
#endif
#ifdef AFS_HPUX_ENV
{
+#if !defined(AFS_HPUX1122_ENV)
+ /* drop the setting of the clock for now. spl7 is not
+ * known on hpux11.22
+ */
register ulong_t s;
struct timeval t;
t.tv_sec = atv->tv_sec;
t.tv_usec = atv->tv_usec;
s = spl7(); time = t; (void) splx(s);
resettodr(atv);
+#endif
}
#else
{
logtchg(atv->tv_sec);
#endif
#endif /* AFS_DARWIN_ENV */
-#endif /* AFS_FBSD_ENV */
-#endif /* AFS_SGI_ENV */
-#endif /* AFS_SUN55_ENV */
-#endif /* AFS_SUN5_ENV */
-#endif /* AFS_AIX32_ENV */
AFS_STATCNT(osi_SetTime);
}
#endif /* AFS_LINUX20_ENV */
return osi_linux_alloc(x, 1);
#else
size = x;
-#ifdef AFS_OBSD_ENV
- MALLOC(tm, struct osimem *, size, M_AFSGENERIC, M_WAITOK);
-#else
tm = (struct osimem *) AFS_KALLOC(size);
-#endif
#ifdef AFS_SUN_ENV
if (!tm)
osi_Panic("osi_Alloc: Couldn't allocate %d bytes; out of memory!\n",
size = x;
AFS_STATS(afs_stats_cmperf.OutStandingAllocs++);
AFS_STATS(afs_stats_cmperf.OutStandingMemUsage += x);
-#ifdef AFS_OBSD_ENV
- MALLOC(tm, struct osimem *, size, M_AFSGENERIC, 0);
-#else
tm = (struct osimem *) AFS_KALLOC_NOSLEEP(size);
-#endif
return (void *) tm;
}
AFS_STATS(afs_stats_cmperf.OutStandingMemUsage -= asize);
#if defined(AFS_LINUX20_ENV)
osi_linux_free(x);
-#elif defined(AFS_OBSD_ENV)
- FREE(x, M_AFSGENERIC);
#else
AFS_KFREE((struct osimem *)x, asize);
#endif
^ ((((handle) & ~vmker.stoinio) & vmker.stoimask) << vmker.stoihash) \
) & 0x000fffff)
- if (avc->vmh) {
+ if (avc->segid) {
unsigned int pagef, pri, index, next;
- index = VMHASH(avc->vmh);
+ index = VMHASH(avc->segid);
if (scb_valid(index)) { /* could almost be an ASSERT */
pri = disable_ints();
#ifdef EXPORTED_TASKLIST_LOCK
read_lock(&tasklist_lock);
#endif
+#ifdef DEFINED_FOR_EACH_PROCESS
+ for_each_process(p) if (p->pid) {
+ if (p->state & TASK_ZOMBIE)
+ continue;
+ afs_GCPAGs_perproc_func(p);
+ }
+#else
for_each_task(p) if (p->pid) {
if (p->state & TASK_ZOMBIE)
continue;
afs_GCPAGs_perproc_func(p);
}
+#endif
#ifdef EXPORTED_TASKLIST_LOCK
read_unlock(&tasklist_lock);
#endif
xmem_userp = NULL;
xm = XMEM_FAIL;
/* simple_lock(&proc_tbl_lock); */
+#ifdef __64BIT__
+ if (pproc->p_adspace != vm_handle(NULLSEGID, (int32long64_t) 0)) {
+#else
if (pproc->p_adspace != NULLSEGVAL) {
+#endif
#ifdef AFS_AIX51_ENV
simple_lock(&pproc->p_pvprocp->pv_lock);