Second attempt at avoiding the use of newproc() on Solaris.
This time, use thread_create to spawn a kernel thread, and
use a dummy packet to wake up the listener during shutdown.
(cherry picked from commit
5d3545610b83905e220d18c948d0fc621db851a5)
{
extern int rxk_ListenerPid;
struct sonode *so = (struct sonode *)asocket;
- vnode_t *vp = SOTOV(so);
+ struct sockaddr_in taddr;
+ struct iovec dvec;
+ char c;
AFS_STATCNT(osi_FreeSocket);
+
+ taddr.sin_family = AF_INET;
+ taddr.sin_port = htons(rx_port);
+ taddr.sin_addr.s_addr = htonl(0x7f000001);
+
+ dvec.iov_base = &c;
+ dvec.iov_len = 1;
+
while (rxk_ListenerPid) {
- kill(rxk_ListenerPid, SIGUSR1);
+ osi_NetSend(rx_socket, &taddr, &dvec, 1, 1, 0);
afs_osi_Sleep(&rxk_ListenerPid);
}
#ifdef AFS_SUN5_ENV
/*
- * Run the listener as a kernel process.
+ * Run the listener as a kernel thread.
*/
void rxk_Listener(void)
{
extern id_t syscid;
void rxk_ListenerProc(void);
- if (newproc(rxk_ListenerProc, syscid, 59))
- osi_Panic("rxk_Listener: failed to fork listener process!\n");
+ if (thread_create(NULL, DEFAULTSTKSZ, rxk_ListenerProc,
+ 0, 0, &p0, TS_RUN, minclsyspri) == NULL)
+ osi_Panic("rxk_Listener: failed to start listener thread!\n");
}
void rxk_ListenerProc(void)
rxk_ListenerPid = current->pid;
#endif
#ifdef AFS_SUN5_ENV
- rxk_ListenerPid = ttoproc(curthread)->p_pidp->pid_id;
+ rxk_ListenerPid = 1; /* No PID, just a flag that we're alive */
#endif /* AFS_SUN5_ENV */
#ifdef AFS_FBSD_ENV
rxk_ListenerPid = curproc->p_pid;
#endif
#ifdef AFS_SUN5_ENV
AFS_GUNLOCK();
-#ifdef HAVE_P_COREFILE
- 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 */
}
#include "../h/vfs.h" /* stops SUN56 socketvar.h warnings */
#include "../h/stropts.h" /* stops SUN56 socketvar.h warnings */
#include "../h/stream.h" /* stops SUN56 socketvar.h errors */
+#include "../h/disp.h"
#endif
#include "../h/socket.h"
#ifndef AFS_LINUX22_ENV
*/
static int rx_pthread_event_rescheduled = 0;
-static void rx_ListenerProc(void *);
+static void *rx_ListenerProc(void *);
/*
* We supply an event handling thread for Rx's event processing.
int *tnop;
struct rx_call **newcallp;
{
- u_long host;
+ unsigned int host;
u_short port;
register struct rx_packet *p = (struct rx_packet *)0;
/* This is the listener process request loop. The listener process loop
* becomes a server thread when rxi_ListenerProc returns, and stays
* server thread until rxi_ServerProc returns. */
-static void rx_ListenerProc(void *argp)
+static void *rx_ListenerProc(void *argp)
{
int threadID;
int sock = (int) argp;
int maxio;
int nbytes;
{
- int bytes;
+ char bytes;
SPLVAR;
NETPRI;