From: Douglas Engert Date: Thu, 27 Nov 2003 05:52:51 +0000 (+0000) Subject: hpux-rx-attach-file-struct-to-socket-20031124 X-Git-Tag: openafs-devel-1_3_50 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=6e2f4f9df4d1370f3131d0904229e51a6365604d hpux-rx-attach-file-struct-to-socket-20031124 FIXES 2450 attach a struct file to the socket; clean up when done --- diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 6563ef8..f8e13ee 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -767,6 +767,8 @@ rxk_NewSocket(short aport) extern MBLKP allocb_wait(int, int); MBLKP bindnam; int addrsize = sizeof(struct sockaddr_in); + struct file *fp; + extern struct fileops socketops; #endif #ifdef AFS_SGI65_ENV bhv_desc_t bhv; @@ -778,8 +780,19 @@ rxk_NewSocket(short aport) #endif #if defined(AFS_HPUX102_ENV) #if defined(AFS_HPUX110_ENV) + /* we need a file associated with the socket so sosend in NetSend + will not fail */ /* blocking socket */ code = socreate(AF_INET, &newSocket, SOCK_DGRAM, 0, 0); + fp = falloc(); + if (!fp) goto bad; + fp->f_flag = FREAD | FWRITE; + fp->f_type = DTYPE_SOCKET; + fp->f_ops = &socketops; + + fp->f_data = (void *) newSocket; + newSocket->so_fp = (void *)fp; + #else /* AFS_HPUX110_ENV */ code = socreate(AF_INET, &newSocket, SOCK_DGRAM, 0, SS_NOWAIT); #endif /* else AFS_HPUX110_ENV */ @@ -896,6 +909,18 @@ rxk_FreeSocket(register struct socket *asocket) #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL) thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL); #endif +#ifdef AFS_HPUX110_ENV + if (asocket->so_fp) { + struct file * fp = asocket->so_fp; +#if !defined(AFS_HPUX1123_ENV) + /* 11.23 still has falloc, but not FPENTRYFREE ! + so for now if we shutdown, we will waist a file + structure */ + FPENTRYFREE(fp); + asocket->so_fp = NULL; +#endif + } +#endif /* AFS_HPUX110_ENV */ soclose(asocket); #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL) thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);