From: Nickolai Zeldovich Date: Fri, 19 Apr 2002 04:55:54 +0000 (+0000) Subject: Allow AFS to shutdown on Solaris (and subsequently be reloaded X-Git-Tag: openafs-stable-1_2_4~71 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=994a5b4bf16294fc1364fede7d5c62a2cd345462;p=packages%2Fo%2Fopenafs.git Allow AFS to shutdown on Solaris (and subsequently be reloaded and restarted). Still leaks memory, unlike the Linux module. (cherry picked from commit c446c128e9be75fa8617a11403d867a8885ee80b) --- diff --git a/src/afs/SOLARIS/osi_vfsops.c b/src/afs/SOLARIS/osi_vfsops.c index 1a9279315..239a5c57b 100644 --- a/src/afs/SOLARIS/osi_vfsops.c +++ b/src/afs/SOLARIS/osi_vfsops.c @@ -241,6 +241,9 @@ void (*ufs_iupdatp)(); int (*ufs_igetp)(); void (*ufs_itimes_nolockp)(); +int (*afs_orig_ioctl)(), (*afs_orig_ioctl32)(); +int (*afs_orig_setgroups)(), (*afs_orig_setgroups32)(); + struct streamtab *udp_infop = 0; struct ill_s *ill_g_headp = 0; @@ -259,15 +262,19 @@ extern Afs_syscall(); afsinit(struct vfssw *vfsswp, int fstype) { - extern int afs_xioctl(), afs_xflock(); + extern int afs_xioctl(); extern int afs_xsetgroups(); AFS_STATCNT(afsinit); + afs_orig_setgroups = sysent[SYS_setgroups].sy_callc; + afs_orig_ioctl = sysent[SYS_ioctl].sy_call; sysent[SYS_setgroups].sy_callc = afs_xsetgroups; sysent[SYS_ioctl].sy_call = afs_xioctl; #if defined(AFS_SUN57_64BIT_ENV) + afs_orig_setgroups32 = sysent32[SYS_setgroups].sy_callc; + afs_orig_ioctl32 = sysent32[SYS_ioctl].sy_call; sysent32[SYS_setgroups].sy_callc = afs_xsetgroups; sysent32[SYS_ioctl].sy_call = afs_xioctl; #endif @@ -400,6 +407,9 @@ _init() extern struct bind *sb_hashtab[]; struct modctl *mp = 0; + if (afs_sinited) + return EBUSY; + if ((!(mp = mod_find_by_filename("fs", "ufs")) && !(mp = mod_find_by_filename(NULL, "/kernel/fs/ufs")) && !(mp = mod_find_by_filename(NULL, "sys/ufs"))) || @@ -481,8 +491,17 @@ _fini() { int code; - if (afs_sinited) - return (EBUSY); + if (afs_globalVFS) + return EBUSY; + + if (afs_sinited) { + sysent[SYS_setgroups].sy_callc = afs_orig_setgroups; + sysent[SYS_ioctl].sy_call = afs_orig_ioctl; +#if defined(AFS_SUN57_64BIT_ENV) + sysent32[SYS_setgroups].sy_callc = afs_orig_setgroups32; + sysent32[SYS_ioctl].sy_call = afs_orig_ioctl32; +#endif + } code = mod_remove(&afs_modlinkage); return code; } diff --git a/src/rx/SOLARIS/rx_knet.c b/src/rx/SOLARIS/rx_knet.c index 04f8d5132..a2a75ca0c 100644 --- a/src/rx/SOLARIS/rx_knet.c +++ b/src/rx/SOLARIS/rx_knet.c @@ -51,6 +51,10 @@ int (*sockfs_sosendmsg) (struct sonode *, struct nmsghdr *, struct uio *) = NULL; int (*sockfs_sosetsockopt) (struct sonode *, int, int, void *, int) = NULL; +int (*sockfs_sounbind) + (struct sonode *, int); +void (*sockfs_sockfree) + (struct sonode *); static afs_uint32 myNetAddrs[ADDRSPERSITE]; static int myNetMTUs[ADDRSPERSITE]; @@ -238,6 +242,16 @@ struct osi_socket *rxk_NewSocket(short aport) return NULL; } } + if (sockfs_sounbind == NULL) { + sockfs_sounbind = (int (*)())modlookup("sockfs", "sounbind"); + if (sockfs_sounbind == NULL) + return NULL; + } + if (sockfs_sockfree == NULL) { + sockfs_sockfree = (void (*)())modlookup("sockfs", "sockfree"); + if (sockfs_sockfree == NULL) + return NULL; + } accessvp = sockfs_solookup(AF_INET, SOCK_DGRAM, 0, "/dev/udp", &error); if (accessvp == NULL) { @@ -285,6 +299,9 @@ int osi_FreeSocket(asocket) kill(rxk_ListenerPid, SIGUSR1); afs_osi_Sleep(&rxk_ListenerPid); } + + sockfs_sounbind(so, 0); + sockfs_sockfree(so); return 0; } diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 85e52ac03..e63a36e74 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -1064,6 +1064,11 @@ void rxk_Listener(void) #endif #ifdef AFS_SUN5_ENV AFS_GUNLOCK(); +#ifdef AFS_SUN57_ENV + if (!curproc->p_corefile) /* newproc doesn't set it, but exit frees it */ + curproc->p_corefile = refstr_alloc("core"); +#endif + exit(CLD_EXITED, 0); #endif /* AFS_SUN5_ENV */ }