*/
#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"
-#include "../rx/rx_globals.h"
+#include "afs/sysincludes.h" /* Standard vendor system headers */
+#include "afsincludes.h" /* Afs-based standard headers */
+#include "afs/afs_stats.h"
+#include "rx/rx_globals.h"
#if !defined(UKERNEL) && !defined(AFS_LINUX20_ENV)
#include "net/if.h"
#ifdef AFS_SGI62_ENV
-#include "../h/hashing.h"
+#include "h/hashing.h"
#endif
#if !defined(AFS_HPUX110_ENV) && !defined(AFS_DARWIN60_ENV)
#include "netinet/in_var.h"
#endif
#endif /* !defined(UKERNEL) */
#ifdef AFS_LINUX22_ENV
-#include "../h/smp_lock.h"
+#include "h/smp_lock.h"
#endif
struct afs_icl_set *afs_iclSetp = (struct afs_icl_set*)0;
struct afs_icl_set *afs_iclLongTermSetp = (struct afs_icl_set*)0;
-#if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
-
+#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
kmutex_t afs_global_lock;
kmutex_t afs_rxglobal_lock;
+#endif
#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
long afs_global_owner;
#endif
-#endif
#if defined(AFS_OSF_ENV)
simple_lock_data_t afs_global_lock;
-#elif defined(AFS_DARWIN_ENV)
+#endif
+
+#if defined(AFS_DARWIN_ENV)
struct lock__bsd__ afs_global_lock;
-#elif defined(AFS_FBSD_ENV)
+#endif
+
+#if defined(AFS_XBSD_ENV)
struct lock afs_global_lock;
+#ifdef AFS_FBSD50_ENV
+struct thread *afs_global_owner;
+#else
struct proc *afs_global_owner;
#endif
+#endif
+
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
thread_t afs_global_owner;
#endif /* AFS_OSF_ENV */
static int afs_RX_Running = 0;
static int afs_InitSetup_done = 0;
+afs_int32 afs_rx_deadtime = AFS_RXDEADTIME;
+afs_int32 afs_rx_harddead = AFS_HARDDEADTIME;
+
static int
Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval);
int code;
if (afs_InitSetup_done)
- return;
+ return EAGAIN;
#ifndef AFS_NOSTATS
/*
printf("AFS: RX failed to initialize.\n");
return code;
}
- rx_SetRxDeadTime(AFS_RXDEADTIME);
+ rx_SetRxDeadTime(afs_rx_deadtime);
/* resource init creates the services */
afs_ResourceInit(preallocs);
return code;
}
+#if defined(AFS_LINUX24_ENV) && defined(COMPLETION_H_EXISTS)
+struct afsd_thread_info {
+ unsigned long parm;
+ struct completion *complete;
+};
+
+static int afsd_thread(void *rock) {
+ struct afsd_thread_info *arg=rock;
+ unsigned long parm=arg->parm;
+#ifdef SYS_SETPRIORITY_EXPORTED
+ int (*sys_setpriority)(int,int,int) = sys_call_table[__NR_setpriority];
+#endif
+ daemonize(); /* doesn't do much, since we were forked from keventd, but
+ does call mm_release, which wakes up our parent (since it
+ used CLONE_VFORK) */
+ reparent_to_init();
+ afs_osi_MaskSignals();
+ switch (parm) {
+ case AFSOP_START_RXCALLBACK:
+ sprintf(current->comm, "afs_cbstart");
+ AFS_GLOCK();
+ complete(arg->complete);
+ afs_CB_Running = 1;
+ while (afs_RX_Running != 2)
+ afs_osi_Sleep(&afs_RX_Running);
+ sprintf(current->comm, "afs_callback");
+ afs_RXCallBackServer();
+ AFS_GUNLOCK();
+ complete_and_exit(0,0);
+ break;
+ case AFSOP_START_AFS:
+ sprintf(current->comm, "afs_afsstart");
+ AFS_GLOCK();
+ complete(arg->complete);
+ AFS_Running = 1;
+ while (afs_initState < AFSOP_START_AFS)
+ afs_osi_Sleep(&afs_initState);
+ afs_initState = AFSOP_START_BKG;
+ afs_osi_Wakeup(&afs_initState);
+ sprintf(current->comm, "afsd");
+ afs_Daemon();
+ AFS_GUNLOCK();
+ complete_and_exit(0,0);
+ break;
+ case AFSOP_START_BKG:
+ sprintf(current->comm, "afs_bkgstart");
+ AFS_GLOCK();
+ complete(arg->complete);
+ while (afs_initState < AFSOP_START_BKG)
+ afs_osi_Sleep(&afs_initState);
+ if (afs_initState < AFSOP_GO) {
+ afs_initState = AFSOP_GO;
+ afs_osi_Wakeup(&afs_initState);
+ }
+ sprintf(current->comm, "afs_background");
+ afs_BackgroundDaemon();
+ AFS_GUNLOCK();
+ complete_and_exit(0,0);
+ break;
+ case AFSOP_START_TRUNCDAEMON:
+ sprintf(current->comm, "afs_trimstart");
+ AFS_GLOCK();
+ complete(arg->complete);
+ while (afs_initState < AFSOP_GO)
+ afs_osi_Sleep(&afs_initState);
+ sprintf(current->comm, "afs_cachetrim");
+ afs_CacheTruncateDaemon();
+ AFS_GUNLOCK();
+ complete_and_exit(0,0);
+ break;
+ case AFSOP_START_CS:
+ sprintf(current->comm, "afs_checkserver");
+ AFS_GLOCK();
+ complete(arg->complete);
+ afs_CheckServerDaemon();
+ AFS_GUNLOCK();
+ complete_and_exit(0,0);
+ break;
+ case AFSOP_RXEVENT_DAEMON:
+ sprintf(current->comm, "afs_evtstart");
+#ifdef SYS_SETPRIORITY_EXPORTED
+ sys_setpriority(PRIO_PROCESS,0,-10);
+#else
+#ifdef CURRENT_INCLUDES_NICE
+ current->nice=-10;
+#endif
+#endif
+ AFS_GLOCK();
+ complete(arg->complete);
+ while (afs_initState < AFSOP_START_BKG)
+ afs_osi_Sleep(&afs_initState);
+ sprintf(current->comm, "afs_rxevent");
+ afs_rxevent_daemon();
+ AFS_GUNLOCK();
+ complete_and_exit(0,0);
+ break;
+ case AFSOP_RXLISTENER_DAEMON:
+ sprintf(current->comm, "afs_lsnstart");
+#ifdef SYS_SETPRIORITY_EXPORTED
+ sys_setpriority(PRIO_PROCESS,0,-10);
+#else
+#ifdef CURRENT_INCLUDES_NICE
+ current->nice=-10;
+#endif
+#endif
+ AFS_GLOCK();
+ complete(arg->complete);
+ afs_initState = AFSOP_START_AFS;
+ afs_osi_Wakeup(&afs_initState);
+ afs_RX_Running = 2;
+ afs_osi_Wakeup(&afs_RX_Running);
+ afs_osi_RxkRegister();
+ sprintf(current->comm, "afs_rxlistener");
+ rxk_Listener();
+ AFS_GUNLOCK();
+ complete_and_exit(0,0);
+ break;
+ default:
+ printf("Unknown op %d in StartDaemon()\n");
+ break;
+ }
+ return 0;
+}
+
+void afsd_launcher(void *rock) {
+ if (!kernel_thread(afsd_thread,rock, CLONE_VFORK|SIGCHLD))
+ printf("kernel_thread failed. afs startup will not complete\n");
+}
+
+void afs_DaemonOp(long parm, long parm2, long parm3, long parm4, long parm5,
+ long parm6)
+{
+ int code;
+ DECLARE_COMPLETION(c);
+ struct tq_struct tq;
+ struct afsd_thread_info info;
+ if (parm == AFSOP_START_RXCALLBACK) {
+ if (afs_CB_Running) return;
+ } else if (parm == AFSOP_RXLISTENER_DAEMON) {
+ if (afs_RX_Running) return;
+ afs_RX_Running=1;
+ code = afs_InitSetup(parm2);
+ if (parm3) {
+ rx_enablePeerRPCStats();
+ }
+ if (parm4) {
+ rx_enableProcessRPCStats();
+ }
+ if (code)
+ return;
+ } else if (parm == AFSOP_START_AFS) {
+ if (AFS_Running) return;
+ } /* other functions don't need setup in the parent */
+ info.complete=&c;
+ info.parm=parm;
+ tq.sync=0;
+ INIT_LIST_HEAD(&tq.list);
+ tq.routine=afsd_launcher;
+ tq.data=&info;
+ schedule_task(&tq);
+ AFS_GUNLOCK();
+ /* we need to wait cause we passed stack pointers around.... */
+ wait_for_completion(&c);
+ AFS_GLOCK();
+}
+#endif
+
/* leaving as is, probably will barf if we add prototypes here since it's likely being called
with partial list */
+int
afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6)
long parm, parm2, parm3, parm4, parm5, parm6;
{
afs_int32 code = 0;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
size_t bufferSize;
#else /* AFS_SGI61_ENV */
u_int bufferSize;
if (!afs_suser() && (parm != AFSOP_GETMTU)
&& (parm != AFSOP_GETMASK)) {
/* only root can run this code */
-#if defined(KERNEL_HAVE_SETUERROR)
+#if defined(KERNEL_HAVE_UERROR)
setuerror(EACCES);
return(EACCES);
#else
-#if defined(AFS_OSF_ENV)
+#if defined(AFS_OSF_ENV)
return EACCES;
-#else /* AFS_OSF_ENV */
+#else /* AFS_OSF_ENV */
return EPERM;
-#endif
+#endif /* AFS_OSF_ENV */
#endif
#endif
}
AFS_GLOCK();
+#if defined(AFS_LINUX24_ENV) && defined(COMPLETION_H_EXISTS) && !defined(UKERNEL)
+ if (parm < AFSOP_ADDCELL || parm == AFSOP_RXEVENT_DAEMON
+ || parm == AFSOP_RXLISTENER_DAEMON) {
+ afs_DaemonOp(parm,parm2,parm3,parm4,parm5,parm6);
+ }
+#else /* !(AFS_LINUX24_ENV && !UKERNEL) */
if (parm == AFSOP_START_RXCALLBACK) {
if (afs_CB_Running) goto out;
afs_CB_Running = 1;
#ifndef RXK_LISTENER_ENV
code = afs_InitSetup(parm2);
if (!code)
-#endif /* RXK_LISTENER_ENV */
+#endif /* !RXK_LISTENER_ENV */
{
#ifdef RXK_LISTENER_ENV
while (afs_RX_Running != 2)
afs_osi_Sleep(&afs_RX_Running);
-#else
+#else /* !RXK_LISTENER_ENV */
afs_initState = AFSOP_START_AFS;
afs_osi_Wakeup(&afs_initState);
#endif /* RXK_LISTENER_ENV */
afs_osi_Invisible();
afs_RXCallBackServer();
}
-#ifdef AFS_SGI_ENV
+#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, code);
-#endif
+#endif /* AFS_SGI_ENV */
}
#ifdef RXK_LISTENER_ENV
else if (parm == AFSOP_RXLISTENER_DAEMON) {
afs_osi_Wakeup(&afs_RX_Running);
#ifndef UKERNEL
afs_osi_RxkRegister();
-#endif
+#endif /* !UKERNEL */
rxk_Listener();
}
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, code);
-#endif
- }
-#endif
- else if (parm == AFSOP_BASIC_INIT) {
- afs_int32 temp;
-
- while (!afs_InitSetup_done)
- afs_osi_Sleep(&afs_InitSetup_done);
-
-#if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
- temp = AFS_MINBUFFERS; /* Should fix this soon */
-#else
- /* number of 2k buffers we could get from all of the buffer space */
- temp = ((afs_bufferpages * NBPG)>>11);
- temp = temp>>2; /* don't take more than 25% (our magic parameter) */
- if (temp < AFS_MINBUFFERS)
- temp = AFS_MINBUFFERS; /* though we really should have this many */
-#endif
- DInit(temp);
- afs_rootFid.Fid.Volume = 0;
- code = 0;
+#endif /* AFS_SGI_ENV */
}
+#endif /* RXK_LISTENER_ENV */
else if (parm == AFSOP_START_AFS) {
/* afs daemon */
if (AFS_Running) goto out;
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
-#endif
+#endif /* AFS_SGI_ENV */
}
else if (parm == AFSOP_START_CS) {
afs_osi_Invisible();
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
-#endif
+#endif /* AFS_SGI_ENV */
}
else if (parm == AFSOP_START_BKG) {
while (afs_initState < AFSOP_START_BKG)
}
/* start the bkg daemon */
afs_osi_Invisible();
-#ifdef AFS_AIX32_ENV
+#ifdef AFS_AIX32_ENV
if (parm2)
afs_BioDaemon(parm2);
else
-#endif
+#endif /* AFS_AIX32_ENV */
afs_BackgroundDaemon();
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
-#endif
+#endif /* AFS_SGI_ENV */
}
else if (parm == AFSOP_START_TRUNCDAEMON) {
while (afs_initState < AFSOP_GO)
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
-#endif
+#endif /* AFS_SGI_ENV */
}
#if defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV)
else if (parm == AFSOP_RXEVENT_DAEMON) {
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
+#endif /* AFS_SGI_ENV */
+ }
+#endif /* AFS_SUN5_ENV || RXK_LISTENER_ENV */
+#endif /* AFS_LINUX24_ENV && !UKERNEL */
+ else if (parm == AFSOP_BASIC_INIT) {
+ afs_int32 temp;
+
+ while (!afs_InitSetup_done)
+ afs_osi_Sleep(&afs_InitSetup_done);
+
+#if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+ temp = AFS_MINBUFFERS; /* Should fix this soon */
+#else
+ /* number of 2k buffers we could get from all of the buffer space */
+ temp = ((afs_bufferpages * NBPG)>>11);
+ temp = temp>>2; /* don't take more than 25% (our magic parameter) */
+ if (temp < AFS_MINBUFFERS)
+ temp = AFS_MINBUFFERS; /* though we really should have this many */
#endif
+ DInit(temp);
+ afs_rootFid.Fid.Volume = 0;
+ code = 0;
}
-#endif
else if (parm == AFSOP_ADDCELL) {
/* add a cell. Parameter 2 is 8 hosts (in net order), parm 3 is the null-terminated
name. Parameter 4 is the length of the name, including the null. Parm 5 is the
} else if (parm == AFSOP_ADDCELL2) {
struct afsop_cell tcell;
char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *lcnamep = 0;
- char *tbuffer1 = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *cnamep = 0;
+ char *tbuffer1 = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
int cflags = parm4;
- /* wait for basic init */
+#if 0
+ /* wait for basic init - XXX can't find any reason we need this? */
while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
+#endif
AFS_COPYIN((char *)parm2, (char *)tcell.hosts, sizeof(tcell.hosts), code);
if (!code) {
AFS_COPYIN((char *)parm2, (caddr_t) &cparms, sizeof(cparms), code);
if (code) {
-#if defined(KERNEL_HAVE_SETUERROR)
+#if defined(KERNEL_HAVE_UERROR)
setuerror(code);
code = -1;
#endif
/* initialize the ICL system */
code = afs_icl_CreateLog("cmfx", 60*1024, &logp);
if (code == 0)
- code = afs_icl_CreateSetWithFlags("cm", logp,
- (struct icl_log *) 0,
+ code = afs_icl_CreateSetWithFlags("cm", logp, NULL,
ICL_CRSET_FLAG_DEFAULT_OFF,
&afs_iclSetp);
- code = afs_icl_CreateSet("cmlongterm", logp, (struct icl_log*) 0,
+ code = afs_icl_CreateSet("cmlongterm", logp, NULL,
&afs_iclLongTermSetp);
}
afs_setTime = cparms.setTimeFlag;
#endif /* AFS_SGI62_ENV && !AFS_SGI65_ENV */
#endif /* AFS_SGI53_ENV */
else if (parm == AFSOP_SHUTDOWN) {
-#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
- extern struct mount *afs_globalVFS;
-#else /* AFS_OSF_ENV */
- extern struct vfs *afs_globalVFS;
-#endif
afs_cold_shutdown = 0;
if (parm == 1) afs_cold_shutdown = 1;
+#ifndef AFS_DARWIN_ENV
if (afs_globalVFS != 0) {
afs_warn("AFS isn't unmounted yet! Call aborted\n");
code = EACCES;
} else
+#endif
afs_shutdown();
}
-
-#if ! defined(AFS_HPUX90_ENV) || defined(AFS_HPUX100_ENV)
else if (parm == AFSOP_AFS_VFSMOUNT) {
#ifdef AFS_HPUX_ENV
-#if defined(AFS_HPUX100_ENV)
vfsmount(parm2, parm3, parm4, parm5);
-#else
- afs_vfs_mount(parm2, parm3, parm4, parm5);
-#endif /* AFS_HPUX100_ENV */
#else /* defined(AFS_HPUX_ENV) */
-#if defined(KERNEL_HAVE_SETUERROR)
+#if defined(KERNEL_HAVE_UERROR)
setuerror(EINVAL);
#else
code = EINVAL;
#endif
#endif /* defined(AFS_HPUX_ENV) */
}
-#endif
else if (parm == AFSOP_CLOSEWAIT) {
afs_SynchronousCloses = 'S';
}
mtu = ((i == -1) ? htonl(1500) : afs_cb_interface.mtu[i]);
#else /* AFS_USERSPACE_IP_ADDR */
struct ifnet *tifnp;
- struct in_ifaddr *tifadp = (struct in_ifaddr *) 0;
- extern struct ifnet *rxi_FindIfnet();
-
- tifnp = rxi_FindIfnet(parm2, &tifadp); /* make iterative */
+
+ tifnp = rxi_FindIfnet(parm2, NULL); /* make iterative */
mtu = (tifnp ? tifnp->if_mtu : htonl(1500));
#endif /* else AFS_USERSPACE_IP_ADDR */
#endif /* !AFS_SUN5_ENV */
}
#else /* AFS_USERSPACE_IP_ADDR */
struct ifnet *tifnp;
-#ifdef AFS_DARWIN60_ENV
- struct ifaddr *tifadp = (struct ifaddr *) 0;
-#else
- struct in_ifaddr *tifadp = (struct in_ifaddr *) 0;
-#endif
- extern struct ifnet *rxi_FindIfnet();
- tifnp = rxi_FindIfnet(parm2, &tifadp); /* make iterative */
- if (tifnp && tifadp) {
-#ifdef AFS_DARWIN60_ENV
- mask = ((struct sockaddr_in *)tifadp->ifa_netmask)->sin_addr.s_addr;
-#else
- mask = tifadp->ia_subnetmask;
-#endif
- } else {
+
+ tifnp = rxi_FindIfnet(parm2, &mask); /* make iterative */
+ if (!tifnp)
code = -1;
- }
#endif /* else AFS_USERSPACE_IP_ADDR */
#endif /* !AFS_SUN5_ENV */
if (!code)
#ifdef AFS_SPARC64_LINUX24_ENV
if (current->thread.flags & SPARC_FLAG_32BIT)
-#elif AFS_SPARC64_LINUX20_ENV
+#elif defined(AFS_SPARC64_LINUX20_ENV)
if (current->tss.flags & SPARC_FLAG_32BIT)
+#elif defined(AFS_AMD64_LINUX20_ENV)
+ if (current->thread.flags & THREAD_IA32)
#else
#error Not done for this linux version
-#endif /* AFS_SPARC64_LINUX20_ENV */
+#endif
{
AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code);
if (!code)
};
#endif
-Afs_syscall (uap, rvp)
- register struct afssysa *uap;
- rval_t *rvp;
+Afs_syscall(register struct afssysa *uap, rval_t *rvp)
{
int *retval = &rvp->r_val1;
#else /* AFS_SUN5_ENV */
-#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+int
afs3_syscall(p, args, retval)
- struct proc *p;
- void *args;
- int *retval;
+#ifdef AFS_FBSD50_ENV
+ struct thread *p;
+#else
+ struct proc *p;
+#endif
+ void *args;
+ int *retval;
{
register struct a {
- long syscall;
- long parm1;
- long parm2;
- long parm3;
- long parm4;
- long parm5;
- long parm6;
- } *uap = (struct a *)args;
+ long syscall;
+ long parm1;
+ long parm2;
+ long parm3;
+ long parm4;
+ long parm5;
+ long parm6;
+ } *uap = (struct a *)args;
#else /* AFS_OSF_ENV */
#ifdef AFS_LINUX20_ENV
struct afssysargs {
long parm6; /* not actually used - should be removed */
};
/* Linux system calls only set up for 5 arguments. */
-asmlinkage int afs_syscall(long syscall, long parm1, long parm2, long parm3,
+asmlinkage long afs_syscall(long syscall, long parm1, long parm2, long parm3,
long parm4)
{
struct afssysargs args, *uap = &args;
long parm6;
} *uap = (struct a *)u.u_ap;
#else /* UKERNEL */
+int
#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
afs_syscall ()
#else
#endif /* UKERNEL */
#if defined(AFS_DEC_ENV)
int *retval = &u.u_r.r_val1;
-#else
-#if defined(AFS_HPUX_ENV)
+#elif defined(AFS_HPUX_ENV)
long *retval = &u.u_rval1;
#else
int *retval = &u.u_rval1;
#endif
-#endif
#endif /* AFS_LINUX20_ENV */
#endif /* AFS_OSF_ENV */
#endif /* AFS_SUN5_ENV */
AFS_GUNLOCK();
#else
AFS_GLOCK();
-#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
code = afs_setpag(p, args, retval);
#else /* AFS_OSF_ENV */
code = afs_setpag();
#endif
} else if (uap->syscall == AFSCALL_PIOCTL) {
AFS_GLOCK();
-#ifdef AFS_SUN5_ENV
+#if defined(AFS_SUN5_ENV)
code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4, rvp, CRED());
-#else
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#elif defined(AFS_FBSD50_ENV)
+ code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4, p->td_ucred);
+#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4, p->p_cred->pc_ucred);
#else
code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4);
#endif
-#endif
AFS_GUNLOCK();
} else if (uap->syscall == AFSCALL_ICREATE) {
struct iparam iparams;
code = copyin_iparam((char *)uap->parm3, &iparams);
if (code) {
-#if defined(KERNEL_HAVE_SETUERROR)
+#if defined(KERNEL_HAVE_UERROR)
setuerror(code);
#endif
} else
iparams.param3, iparams.param4, rvp, CRED());
#else
code = afs_syscall_icreate(uap->parm1, uap->parm2, iparams.param1, iparams.param2,
-#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
iparams.param3, iparams.param4, retval);
#else
iparams.param3, iparams.param4);
#ifdef AFS_SUN5_ENV
code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3, rvp, CRED());
#else
-#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3, retval);
#else
code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3);
}
#else
if (code) {
-#if defined(KERNEL_HAVE_SETUERROR)
+#if defined(KERNEL_HAVE_UERROR)
setuerror(code);
#endif
}
#endif /* !AFS_LINUX20_ENV */
} else {
-#if defined(KERNEL_HAVE_SETUERROR)
+#if defined(KERNEL_HAVE_UERROR)
setuerror(EINVAL);
#else
code = EINVAL;
#endif
}
-out:
+
#ifdef AFS_LINUX20_ENV
code = -code;
unlock_kernel();
#endif
#if defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV)
afs_warn("RxEvent... ");
- /* cancel rx event deamon */
+ /* cancel rx event daemon */
while (afs_termState == AFSOP_STOP_RXEVENT)
afs_osi_Sleep(&afs_termState);
#if defined(RXK_LISTENER_ENV)
/* In case there is a bunch of dynamically build bkg daemons to free */
void afs_shutdown_BKG(void)
{
- AFS_STATCNT(shutdown_BKG);
+ AFS_STATCNT(shutdown_BKG);
}
static int
Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval)
{
- register int i;
afs_int32 *lp, elts, flags;
register afs_int32 code;
struct afs_icl_log *logp;
struct afs_icl_set *setp;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
size_t temp;
#else /* AFS_SGI61_ENV */
afs_uint32 temp;
}
#else
if (!afs_suser()) { /* only root can run this code */
-#if defined(KERNEL_HAVE_SETUERROR)
+#if defined(KERNEL_HAVE_UERROR)
setuerror(EACCES);
return EACCES;
#else
int afs_icl_Event4(register struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1, long p2, long p3, long p4)
{
- register struct afs_icl_log *logp;
afs_int32 mask;
register int i;
register afs_int32 tmask;
int ix;
/* If things aren't init'ed yet (or the set is inactive), don't panic */
- if (!ICL_SETACTIVE(setp)) return;
+ if (!ICL_SETACTIVE(setp))
+ return 0;
AFS_ASSERT_GLOCK();
mask = lAndT>>24 & 0xff; /* mask of which logs to log to */
}
}
ReleaseReadLock(&setp->lock);
+ return 0;
}
/* Next 4 routines should be implemented via var-args or something.
*
* Log must be write-locked.
*/
-static afs_icl_GetLogSpace(register struct afs_icl_log *logp, afs_int32 minSpace)
+static void afs_icl_GetLogSpace(register struct afs_icl_log *logp, afs_int32 minSpace)
{
register unsigned int tsize;
* log must be write-locked.
*/
#define ICL_CHARSPERLONG 4
-static afs_int32 afs_icl_AppendString(struct afs_icl_log *logp, char *astr)
+static void afs_icl_AppendString(struct afs_icl_log *logp, char *astr)
{
char *op; /* ptr to char to write */
int tc;
* pretty soon, anyway. The log must be unlocked.
*/
-int afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op,
+void afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op,
afs_int32 types, long p1, long p2, long p3, long p4)
{
int rsize; /* record size in longs */
{
afs_int32 nwords; /* number of words to copy out */
afs_uint32 startCookie; /* first cookie to use */
- register afs_int32 i;
afs_int32 outWords; /* words we've copied out */
afs_int32 inWords; /* max words to copy out */
afs_int32 code; /* return code */
logp->logSize = ICL_DEFAULT_LOGSIZE;
}
logp->datap = (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logp->logSize);
-#ifdef AFS_AIX32_ENV
+#ifdef KERNEL_HAVE_PIN
pin((char *)logp->datap, sizeof(afs_int32) * logp->logSize);
#endif
}
if (--logp->setCount == 0) {
/* no more users -- free it (but keep log structure around)*/
afs_osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize);
-#ifdef AFS_AIX32_ENV
+#ifdef KERNEL_HAVE_PIN
unpin((char *)logp->datap, sizeof(afs_int32) * logp->logSize);
#endif
logp->firstUsed = logp->firstFree = 0;
/* free and allocate a new one */
afs_osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize);
-#ifdef AFS_AIX32_ENV
+#ifdef KERNEL_HAVE_PIN
unpin((char *)logp->datap, sizeof(afs_int32) * logp->logSize);
#endif
logp->datap = (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logSize);
-#ifdef AFS_AIX32_ENV
+#ifdef KERNEL_HAVE_PIN
pin((char *)logp->datap, sizeof(afs_int32) * logSize);
#endif
logp->logSize = logSize;
return tp;
}
-int afs_icl_EnumerateLogs(int (*aproc)(), char *arock)
+int afs_icl_EnumerateLogs(int (*aproc)(char *name,char *arock,struct afs_icl_log *tp), char *arock)
{
register struct afs_icl_log *tp;
register afs_int32 code;
strcpy(setp->name, name);
setp->nevents = ICL_DEFAULTEVENTS;
setp->eventFlags = afs_osi_Alloc(ICL_DEFAULTEVENTS);
-#ifdef AFS_AIX32_ENV
+#ifdef KERNEL_HAVE_PIN
pin((char *)setp->eventFlags, ICL_DEFAULTEVENTS);
#endif
for(i=0; i<ICL_DEFAULTEVENTS; i++)
*lpp = setp->nextp;
osi_FreeSmallSpace(setp->name);
afs_osi_Free(setp->eventFlags, ICL_DEFAULTEVENTS);
-#ifdef AFS_AIX32_ENV
+#ifdef KERNEL_HAVE_PIN
unpin((char *)setp->eventFlags, ICL_DEFAULTEVENTS);
#endif
for(i=0; i < ICL_LOGSPERSET; i++) {
return code;
}
-int afs_icl_EnumerateSets(int (*aproc)(), char *arock)
+int afs_icl_EnumerateSets(int (*aproc)(char *name,char *arock,struct afs_icl_log *tp), char *arock)
{
register struct afs_icl_set *tp, *np;
register afs_int32 code;
{
register int i;
int code = -1;
- struct afs_icl_log *logp;
ObtainWriteLock(&setp->lock,207);
for(i = 0; i < ICL_LOGSPERSET; i++) {