#elif defined(AFS_FBSD50_ENV)
mtx_init(&afs_global_mtx, "AFS global lock", NULL, MTX_DEF);
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if !defined(AFS_DARWIN80_ENV)
lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0);
+#endif
afs_global_owner = 0;
#elif defined(AFS_AIX41_ENV)
lock_alloc((void *)&afs_global_lock, LOCK_ALLOC_PIN, 1, 1);
#endif /* AFS_HPUX_ENV */
if (!afs_osicred_initialized) {
-#ifdef AFS_XBSD_ENV
+#if defined(AFS_XBSD_ENV)
/* Can't just invent one, must use crget() because of mutex */
afs_osi_credp = crdup(osi_curcred());
#else
memset(&afs_osi_cred, 0, sizeof(struct AFS_UCRED));
+#if defined(AFS_LINUX26_ENV)
+ afs_osi_cred.cr_group_info = groups_alloc(0);
+#endif
crhold(&afs_osi_cred); /* don't let it evaporate */
afs_osi_credp = &afs_osi_cred;
#endif
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_XBSD_ENV)
+#if 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 */
-#elif defined(AFS_MACH_ENV)
- if (avc->opens > 0
- || ((avc->v.v_flag & VTEXT) && !inode_uncache_try(avc)))
- return 1;
#elif defined(AFS_SGI_ENV)
if ((avc->opens > 0) || AFS_VN_MAPPED(AFSTOV(avc)))
return 1;
if (hcmp(vp->m.DataVersion, vp->flushDV) <= 0)
return;
-#ifdef AFS_DEC_ENV
- {
- void afs_gfs_FlushText();
- afs_gfs_FlushText(vp);
- return;
- }
-#else
-
MObtainWriteLock(&afs_ftf, 317);
hset(fdv, vp->m.DataVersion);
hset(vp->flushDV, fdv);
MReleaseWriteLock(&afs_ftf);
-#endif /* AFS_DEC_ENV */
-}
-
-#ifdef AFS_DEC_ENV
-/* I don't really like using xinval() here, because it kills processes
- * a bit aggressively. Previous incarnations of this functionality
- * used to use xrele() instead of xinval, and didn't invoke
- * cacheinval(). But they would panic. So it might be worth looking
- * into some middle ground...
- */
-static void
-afs_gfs_FlushText(register struct vcache *vp)
-{
- afs_hyper_t fdv; /* version before which we'll flush */
- register struct text *xp;
- struct gnode *gp;
-
- MObtainWriteLock(&afs_ftf, 318);
- hset(fdv, vp->m.DataVersion);
- gp = afs_vntogn(vp);
-
- if (!gp) {
- /* this happens frequently after cores are created. */
- MReleaseWriteLock(&afs_ftf);
- return;
- }
-
- if (gp->g_flag & GTEXT) {
- if (gp->g_textp) {
- xp = (struct text *)gp->g_textp;
- /* if text object is locked, give up */
- if (xp && (xp->x_flag & XLOCK)) {
- MReleaseWriteLock(&afs_ftf);
- return;
- }
- } else
- xp = NULL;
-
- if (gp->g_flag & GTEXT) { /* still has a text object? */
- xinval(gp);
- }
- }
-
- /* next do the stuff that need not check for deadlock problems */
- /* maybe xinval(gp); here instead of above */
- binval(NODEV, gp);
- cacheinval(gp);
- /* finally, record that we've done it */
- hset(vp->flushDV, fdv);
-
- MReleaseWriteLock(&afs_ftf);
}
-#endif /* AFS_DEC_ENV */
-
#endif /* AFS_TEXT_ENV */
/* mask signals in afsds */
{
}
+/* Two hacks to try and fix afsdb */
+void
+afs_osi_MaskUserLoop()
+{
+#ifdef AFS_DARWIN_ENV
+ afs_osi_Invisible();
+ afs_osi_fullSigMask();
+#else
+ afs_osi_MaskSignals();
+#endif
+}
+
+void
+afs_osi_UnmaskUserLoop()
+{
+#ifdef AFS_DARWIN_ENV
+ afs_osi_fullSigRestore();
+#endif
+}
+
/* register rxk listener proc info */
void
afs_osi_RxkRegister(void)
{
#ifdef AFS_LINUX22_ENV
afs_osi_MaskSignals();
-#elif defined(AFS_DEC_ENV)
- u.u_procp->p_type |= SSYS;
#elif defined(AFS_SUN5_ENV)
curproc->p_flag |= SSYS;
#elif defined(AFS_HPUX101_ENV) && !defined(AFS_HPUX1123_ENV)
set_system_proc(u.u_procp);
+#elif defined(AFS_DARWIN80_ENV)
#elif defined(AFS_DARWIN_ENV)
/* maybe call init_process instead? */
current_proc()->p_flag |= P_SYSTEM;
void *
afs_osi_Alloc(size_t x)
{
+#if !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
register struct osimem *tm = NULL;
register int size;
+#endif
AFS_STATCNT(osi_Alloc);
/* 0-length allocs may return NULL ptr from AFS_KALLOC, so we special-case
#else
size = x;
tm = (struct osimem *)AFS_KALLOC(size);
-#ifdef AFS_SUN_ENV
+#ifdef AFS_SUN5_ENV
if (!tm)
osi_Panic("osi_Alloc: Couldn't allocate %d bytes; out of memory!\n",
size);
#endif
}
-#if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
void *
afs_osi_Alloc_NoSleep(size_t x)
#endif
#endif /* AFS_AIX32_ENV */
-#if defined (AFS_SUN_ENV)
+#if defined (AFS_SUN5_ENV)
if (avc->states & CMAPPED) {
struct page *pg;
for (pg = avc->v.v_s.v_Pages; pg; pg = pg->p_vpnext) {
#if defined(AFS_SUN5_ENV)
return afs_suser(credp);
#else
- return afs_suser();
+ return afs_suser(NULL);
#endif
}
#endif
#endif
#if defined(AFS_OSF_ENV)
+
+#ifdef AFS_DUX50_ENV
+extern struct pid_entry *pidtab;
+extern int npid;
+#endif
+
void
afs_osi_TraverseProcTable(void)
{
}
#endif
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if (defined(AFS_DARWIN_ENV) && !defined(AFS_DARWIN80_ENV)) || defined(AFS_FBSD_ENV)
void
afs_osi_TraverseProcTable(void)
{
#endif
#if defined(AFS_LINUX22_ENV)
+extern rwlock_t tasklist_lock __attribute__((weak));
void
afs_osi_TraverseProcTable()
{
struct task_struct *p;
-
-#ifdef EXPORTED_TASKLIST_LOCK
- read_lock(&tasklist_lock);
-#endif
+ if (&tasklist_lock)
+ read_lock(&tasklist_lock);
#ifdef DEFINED_FOR_EACH_PROCESS
for_each_process(p) if (p->pid) {
+#ifdef STRUCT_TASK_STRUCT_HAS_EXIT_STATE
+ if (p->exit_state)
+ continue;
+#else
if (p->state & TASK_ZOMBIE)
continue;
+#endif
afs_GCPAGs_perproc_func(p);
}
#else
for_each_task(p) if (p->pid) {
+#ifdef STRUCT_TASK_STRUCT_HAS_EXIT_STATE
+ if (p->exit_state)
+ continue;
+#else
if (p->state & TASK_ZOMBIE)
continue;
+#endif
afs_GCPAGs_perproc_func(p);
}
#endif
-#ifdef EXPORTED_TASKLIST_LOCK
- read_unlock(&tasklist_lock);
-#endif
+ if (&tasklist_lock)
+ read_unlock(&tasklist_lock);
}
#endif
return rv;
}
+#elif defined(AFS_DARWIN80_ENV)
+const struct AFS_UCRED *
+afs_osi_proc2cred(AFS_PROC * pr)
+{
+ struct AFS_UCRED *rv = NULL;
+ static struct AFS_UCRED cr;
+ struct ucred *pcred;
+
+ if (pr == NULL) {
+ return NULL;
+ }
+ pcred = proc_ucred(pr);
+ cr.cr_ref = 1;
+ cr.cr_uid = pcred->cr_uid;
+ cr.cr_ngroups = pcred->cr_ngroups;
+ memcpy(cr.cr_groups, pcred->cr_groups,
+ NGROUPS * sizeof(gid_t));
+ return &cr;
+}
#elif defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
const struct AFS_UCRED *
afs_osi_proc2cred(AFS_PROC * pr)
cr.cr_ref = 1;
cr.cr_uid = pr->uid;
#if defined(AFS_LINUX26_ENV)
-{
- int i;
-
- memset(cr.cr_groups, 0, NGROUPS * sizeof(gid_t));
-
- cr.cr_ngroups = pr->group_info->ngroups;
- for(i = 0; i < pr->group_info->ngroups; ++i)
- cr.cr_groups[i] = GROUP_AT(pr->group_info, i);
-}
+ get_group_info(pr->group_info);
+ cr.cr_group_info = pr->group_info;
#else
cr.cr_ngroups = pr->ngroups;
memcpy(cr.cr_groups, pr->groups, NGROUPS * sizeof(gid_t));