Intial commit
This commit is contained in:
130
prospero/patches/done/10Mar94.dircache.patch
Normal file
130
prospero/patches/done/10Mar94.dircache.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
This patch was created on pand05 at Tue Apr 26 20:36:09 EDT 1994
|
||||
The command used to create it was: gnudiff -b -r -c 10Mar94.all 10Mar94+
|
||||
|
||||
It is made available on an as-is basis, and carries no guarrantee that
|
||||
it even works, much less that it is fit for its purpose.
|
||||
|
||||
If you find any problems with it, please report to mitra@pand05
|
||||
You may use it as you wish, but if you make it pulicly available anywhere
|
||||
please notify me.
|
||||
|
||||
To apply the patch cd to the directory with the source in it, and run
|
||||
|
||||
patch -l -p1 <patchfile
|
||||
|
||||
diff -b -r -c -N 10Mar94.all/include/pserver.h 10Mar94+/include/pserver.h
|
||||
*** 10Mar94.all/include/pserver.h Tue Apr 26 20:36:04 1994
|
||||
--- 10Mar94+/include/pserver.h Tue Apr 26 20:09:36 1994
|
||||
***************
|
||||
*** 523,528 ****
|
||||
--- 523,535 ----
|
||||
*/
|
||||
|
||||
#define DNSCACHE_MAX 300
|
||||
+
|
||||
+ /*
|
||||
+ * If DIRECTORYCACHING is defined, then dirsrv will cache directories
|
||||
+ * on disk under /usr/pfs/shadow/{GOPHER-GW,WAIS-GW}
|
||||
+ */
|
||||
+ #define DIRECTORYCACHING
|
||||
+
|
||||
|
||||
/*
|
||||
* If ACKOWLEDGE_ALL_PACKETS is defined, then ardp_accept will acknowledge
|
||||
diff -b -r -c -N 10Mar94.all/lib/psrv/dsrobject.c 10Mar94+/lib/psrv/dsrobject.c
|
||||
*** 10Mar94.all/lib/psrv/dsrobject.c Tue Apr 26 15:37:10 1994
|
||||
--- 10Mar94+/lib/psrv/dsrobject.c Tue Apr 26 19:50:22 1994
|
||||
***************
|
||||
*** 19,35 ****
|
||||
#include <perrno.h>
|
||||
#include <psrv.h>
|
||||
#include <plog.h>
|
||||
|
||||
- #define DIRECTORYCACHING
|
||||
static PATTRIB newamat(void);
|
||||
|
||||
#ifdef DIRECTORYCACHING
|
||||
|
||||
/* Just under one day - so cron tasks will renew them */
|
||||
#define SECONDSPERDAY (60*60*24)
|
||||
#define MAXDIRCACHEAGE (1*SECONDSPERDAY - 60*30)
|
||||
int cache_attempt = 0; int cache_can = 0; int cache_yes = 0;
|
||||
- int dsrobject_fail = 0;
|
||||
|
||||
int
|
||||
vdir_outofdate(VDIR dir, char *hsoname)
|
||||
--- 19,36 ----
|
||||
#include <perrno.h>
|
||||
#include <psrv.h>
|
||||
#include <plog.h>
|
||||
+ #include <pserver.h> /* For DIRECTORYCACHING */
|
||||
|
||||
static PATTRIB newamat(void);
|
||||
|
||||
+ int dsrobject_fail = 0;
|
||||
+
|
||||
#ifdef DIRECTORYCACHING
|
||||
|
||||
/* Just under one day - so cron tasks will renew them */
|
||||
#define SECONDSPERDAY (60*60*24)
|
||||
#define MAXDIRCACHEAGE (1*SECONDSPERDAY - 60*30)
|
||||
int cache_attempt = 0; int cache_can = 0; int cache_yes = 0;
|
||||
|
||||
int
|
||||
vdir_outofdate(VDIR dir, char *hsoname)
|
||||
***************
|
||||
*** 134,140 ****
|
||||
}
|
||||
|
||||
#endif
|
||||
! if (dirretval != PSUCCESS || vdir_outofdate(dir,hsoname)
|
||||
|| !(dir->links) ) {
|
||||
for (i = 0; i < db_num_ents; i++) {
|
||||
if (strnequal(hsoname, db_prefixes[i].prefix,
|
||||
--- 135,144 ----
|
||||
}
|
||||
|
||||
#endif
|
||||
! if (dirretval != PSUCCESS
|
||||
! #ifdef DIRECTORYCACHING
|
||||
! || vdir_outofdate(dir,hsoname)
|
||||
! #endif
|
||||
|| !(dir->links) ) {
|
||||
for (i = 0; i < db_num_ents; i++) {
|
||||
if (strnequal(hsoname, db_prefixes[i].prefix,
|
||||
diff -b -r -c -N 10Mar94.all/server/dirsrv.c 10Mar94+/server/dirsrv.c
|
||||
*** 10Mar94.all/server/dirsrv.c Tue Apr 26 16:49:13 1994
|
||||
--- 10Mar94+/server/dirsrv.c Tue Apr 26 19:28:25 1994
|
||||
***************
|
||||
*** 70,77 ****
|
||||
extern int vlink_count, pattrib_count, acl_count, pfile_count;
|
||||
extern int rreq_count, ptext_count, string_count, token_count;
|
||||
extern int pauth_count, opt_count, filter_count, p_object_count;
|
||||
!
|
||||
extern int cache_attempt, cache_can, cache_yes, dsrobject_fail;
|
||||
extern int vlink_max, pattrib_max, acl_max, pfile_max;
|
||||
extern int rreq_max, ptext_max, string_max, token_max;
|
||||
extern int pauth_max, opt_max, filter_max, p_object_max;
|
||||
--- 70,78 ----
|
||||
extern int vlink_count, pattrib_count, acl_count, pfile_count;
|
||||
extern int rreq_count, ptext_count, string_count, token_count;
|
||||
extern int pauth_count, opt_count, filter_count, p_object_count;
|
||||
! #ifdef DIRECTORYCACHING
|
||||
extern int cache_attempt, cache_can, cache_yes, dsrobject_fail;
|
||||
+ #endif
|
||||
extern int vlink_max, pattrib_max, acl_max, pfile_max;
|
||||
extern int rreq_max, ptext_max, string_max, token_max;
|
||||
extern int pauth_max, opt_max, filter_max, p_object_max;
|
||||
***************
|
||||
*** 1086,1093 ****
|
||||
--- 1085,1094 ----
|
||||
string_count,string_max, token_count, token_max,
|
||||
pauth_count, pauth_max, /* opt_count, opt_max, */
|
||||
filter_count, filter_max, p_object_count, p_object_max);
|
||||
+ #ifdef DIRECTORYCACHING
|
||||
replyf(req, "Caching: %d attempts, %d can, %d yes, %d fail\n",
|
||||
cache_attempt, cache_can, cache_yes, dsrobject_fail);
|
||||
+ #endif
|
||||
#ifdef PSRV_GOPHER_GW
|
||||
replyf(req, " Memory: %d(%d)glink\n", glink_count, glink_max);
|
||||
#endif
|
||||
392
prospero/patches/done/10Mar94.dnscache.patch
Normal file
392
prospero/patches/done/10Mar94.dnscache.patch
Normal file
@@ -0,0 +1,392 @@
|
||||
diff -b -r -c -N 10Mar94.all/include/pserver.h 10Mar94+/include/pserver.h
|
||||
*** 10Mar94.all/include/pserver.h Tue Apr 26 15:38:11 1994
|
||||
--- 10Mar94+/include/pserver.h Sun Apr 24 17:14:56 1994
|
||||
***************
|
||||
*** 515,518 ****
|
||||
--- 515,526 ----
|
||||
* #define PSRV_CACHE_NATIVE
|
||||
*/
|
||||
|
||||
+
|
||||
+ /*
|
||||
+ * If DNSCACHE_MAX is defined, then dirsrv will cache up to that many
|
||||
+ * DNS addresses. "undef" this for no caching at all.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+ #define DNSCACHE_MAX 300
|
||||
|
||||
diff -b -r -c -N 10Mar94.all/lib/ardp/ardp_mutexes.c 10Mar94+/lib/ardp/ardp_mutexes.c
|
||||
*** 10Mar94.all/lib/ardp/ardp_mutexes.c Tue Apr 26 15:36:22 1994
|
||||
--- 10Mar94+/lib/ardp/ardp_mutexes.c Tue Apr 26 01:51:17 1994
|
||||
***************
|
||||
*** 18,23 ****
|
||||
--- 18,24 ----
|
||||
p_th_mutex p_th_mutexGETHOSTBYNAME; /* declared in pfs_mutexes.c */
|
||||
p_th_mutex p_th_mutexARDP_SELFNUM; /* declared in pfs_mutexes.c */
|
||||
p_th_mutex p_th_mutexDNSCACHE; /* declared in pfs_mutexes.c */
|
||||
+ p_th_mutex p_th_mutexALLDNSCACHE; /* declared in pfs_mutexes.c */
|
||||
p_th_mutex p_th_mutexFILES; /* declared on p__self_num.c */
|
||||
p_th_mutex p_th_mutexFILELOCK; /* declared in flock.c */
|
||||
#endif
|
||||
***************
|
||||
*** 35,40 ****
|
||||
--- 36,42 ----
|
||||
p_th_mutex_init(p_th_mutexARDP_RQALLOC);
|
||||
p_th_mutex_init(p_th_mutexARDP_SELFNUM);
|
||||
p_th_mutex_init(p_th_mutexDNSCACHE);
|
||||
+ p_th_mutex_init(p_th_mutexALLDNSCACHE);
|
||||
p_th_mutex_init(p_th_mutexFILES);
|
||||
p_th_mutex_init(p_th_mutexFILELOCK);
|
||||
#endif
|
||||
***************
|
||||
*** 54,59 ****
|
||||
--- 56,62 ----
|
||||
DIAGMUTEX(ARDP_RQALLOC,"ARDP_RQALLOC");
|
||||
DIAGMUTEX(ARDP_SELFNUM,"ARDP_SELFNUM");
|
||||
DIAGMUTEX(DNSCACHE,"DNSCACHE");
|
||||
+ DIAGMUTEX(ALLDNSCACHE,"ALLDNSCACHE");
|
||||
DIAGMUTEX(FILES,"FILES");
|
||||
DIAGMUTEX(FILELOCK,"FILELOCK");
|
||||
#endif
|
||||
diff -b -r -c -N 10Mar94.all/lib/ardp/dnscache_alloc.c 10Mar94+/lib/ardp/dnscache_alloc.c
|
||||
*** 10Mar94.all/lib/ardp/dnscache_alloc.c Fri Mar 11 05:30:24 1994
|
||||
--- 10Mar94+/lib/ardp/dnscache_alloc.c Thu Apr 21 21:39:41 1994
|
||||
***************
|
||||
*** 32,37 ****
|
||||
--- 32,38 ----
|
||||
|
||||
TH_STRUC_ALLOC(dnscache,DNSCACHE,acache);
|
||||
acache->name = NULL;
|
||||
+ acache->usecount = 0;
|
||||
bzero(&acache->sockad,sizeof(acache->sockad));
|
||||
return(acache);
|
||||
}
|
||||
diff -b -r -c -N 10Mar94.all/lib/ardp/dnscache_alloc.h 10Mar94+/lib/ardp/dnscache_alloc.h
|
||||
*** 10Mar94.all/lib/ardp/dnscache_alloc.h Fri Mar 11 05:30:25 1994
|
||||
--- 10Mar94+/lib/ardp/dnscache_alloc.h Tue Apr 26 01:51:18 1994
|
||||
***************
|
||||
*** 11,17 ****
|
||||
#endif
|
||||
char *name;
|
||||
struct sockaddr_in sockad;
|
||||
!
|
||||
struct dnscache *next;
|
||||
struct dnscache *previous;
|
||||
};
|
||||
--- 11,17 ----
|
||||
#endif
|
||||
char *name;
|
||||
struct sockaddr_in sockad;
|
||||
! int usecount; /* For determining size of cache */
|
||||
struct dnscache *next;
|
||||
struct dnscache *previous;
|
||||
};
|
||||
***************
|
||||
*** 26,31 ****
|
||||
--- 26,32 ----
|
||||
|
||||
#ifdef PFS_THREADS
|
||||
extern p_th_mutex p_th_mutexDNSCACHE;
|
||||
+ extern p_th_mutex p_th_mutexALLDNSCACHE;
|
||||
#endif
|
||||
|
||||
#endif /*dnscache_alloc_h*/
|
||||
diff -b -r -c -N 10Mar94.all/lib/ardp/hostname2adr.c 10Mar94+/lib/ardp/hostname2adr.c
|
||||
*** 10Mar94.all/lib/ardp/hostname2adr.c Tue Apr 26 15:36:31 1994
|
||||
--- 10Mar94+/lib/ardp/hostname2adr.c Tue Apr 26 01:51:21 1994
|
||||
***************
|
||||
*** 15,21 ****
|
||||
#include <netinet/in.h> /* for struct sockaddr_in */
|
||||
#include <pmachine.h> /* for bzero */
|
||||
#include <string.h> /* for strcasecmp */
|
||||
!
|
||||
#ifdef PROSPERO
|
||||
#include <pcompat.h>
|
||||
#else /* not PROSPERO */
|
||||
--- 15,24 ----
|
||||
#include <netinet/in.h> /* for struct sockaddr_in */
|
||||
#include <pmachine.h> /* for bzero */
|
||||
#include <string.h> /* for strcasecmp */
|
||||
! #include <pserver.h> /* For DNSCACHE_MAX */
|
||||
! #ifdef DNSCACHE_MAX
|
||||
! #include "dnscache_alloc.h"
|
||||
! #endif
|
||||
#ifdef PROSPERO
|
||||
#include <pcompat.h>
|
||||
#else /* not PROSPERO */
|
||||
***************
|
||||
*** 49,63 ****
|
||||
* It also converts numeric addresses appropriately.
|
||||
*/
|
||||
/* If change this - uncomment/comment initialization in server/dirsrv.c */
|
||||
- #define CACHE_ARDP_HOSTNAME2ADDR
|
||||
|
||||
! #ifdef CACHE_ARDP_HOSTNAME2ADDR
|
||||
#include "dnscache_alloc.h"
|
||||
#include <mitra_macros.h> /* FIND_FNCTN_LIST */
|
||||
#include <string.h> /* For strcmp */
|
||||
|
||||
- DNSCACHE last_dnscache = NULL;
|
||||
DNSCACHE alldnscaches = NULL;
|
||||
|
||||
void
|
||||
sockaddr_copy(struct sockaddr_in *src, struct sockaddr_in *destn)
|
||||
--- 52,65 ----
|
||||
* It also converts numeric addresses appropriately.
|
||||
*/
|
||||
/* If change this - uncomment/comment initialization in server/dirsrv.c */
|
||||
|
||||
! #ifdef DNSCACHE_MAX
|
||||
#include "dnscache_alloc.h"
|
||||
#include <mitra_macros.h> /* FIND_FNCTN_LIST */
|
||||
#include <string.h> /* For strcmp */
|
||||
|
||||
DNSCACHE alldnscaches = NULL;
|
||||
+ int alldnscache_count = 0;
|
||||
|
||||
void
|
||||
sockaddr_copy(struct sockaddr_in *src, struct sockaddr_in *destn)
|
||||
***************
|
||||
*** 65,71 ****
|
||||
/* Nothing in a sockaddr_in is a pointer */
|
||||
memcpy(destn, src, sizeof(struct sockaddr_in));
|
||||
}
|
||||
! #endif /*CACHE_ARDP_HOSTNAME2ADDR*/
|
||||
|
||||
/* Caching has been added, to this - take care that it does what you
|
||||
want, I'm certainly open to changes if this isnt what we need.
|
||||
--- 67,73 ----
|
||||
/* Nothing in a sockaddr_in is a pointer */
|
||||
memcpy(destn, src, sizeof(struct sockaddr_in));
|
||||
}
|
||||
! #endif /*DNSCACHE_MAX*/
|
||||
|
||||
/* Caching has been added, to this - take care that it does what you
|
||||
want, I'm certainly open to changes if this isnt what we need.
|
||||
***************
|
||||
*** 89,132 ****
|
||||
void
|
||||
ardp_hostname2addr_initcache()
|
||||
{
|
||||
! if (!alldnscaches) {
|
||||
! last_dnscache = dnscache_alloc();
|
||||
! last_dnscache->name=stcopy("NoThInG.CoM---");
|
||||
! APPEND_ITEM(last_dnscache,alldnscaches);
|
||||
}
|
||||
}
|
||||
int
|
||||
ardp_hostname2addr(const char *hostname, struct sockaddr_in *hostaddr)
|
||||
{
|
||||
struct hostent *hp; /* Remote host we're connecting to. */
|
||||
!
|
||||
#ifdef PROSPERO
|
||||
int DpfStmp; /* for DISABLE_PFS_START() */
|
||||
#endif
|
||||
! #ifdef CACHE_ARDP_HOSTNAME2ADDR
|
||||
! DNSCACHE acache;
|
||||
|
||||
acache = alldnscaches;
|
||||
|
||||
! p_th_mutex_lock(p_th_mutexDNSCACHE);
|
||||
/* Cant use TH_FIND_FNCTN_LIST because must retain lock */
|
||||
FIND_FNCTN_LIST(acache, name, hostname, stcaseequal);
|
||||
if(acache) {
|
||||
if (hostaddr) {
|
||||
/* Note is is pointless, but not harmfull to call again
|
||||
for same hostaddr - may just want to rerun*/
|
||||
sockaddr_copy(&(acache->sockad),hostaddr);
|
||||
}
|
||||
! p_th_mutex_unlock(p_th_mutexDNSCACHE); /* Also released below*/
|
||||
! return ARDP_SUCCESS;
|
||||
}
|
||||
! p_th_mutex_unlock(p_th_mutexDNSCACHE); /* Note also released above*/
|
||||
! if (!hostaddr){ /* Initializing cache */
|
||||
acache = dnscache_alloc(); /*locks DNSCACHE temporarily*/
|
||||
acache->name = stcopy(hostname);
|
||||
! hostaddr = &(acache->sockad);
|
||||
! }
|
||||
! #endif /*CACHE_ARDP_HOSTNAME2ADDR*/
|
||||
|
||||
DISABLE_PFS_START(); /* Turn off compatibility library if on */
|
||||
p_th_mutex_lock(p_th_mutexGETHOSTBYNAME);
|
||||
--- 91,148 ----
|
||||
void
|
||||
ardp_hostname2addr_initcache()
|
||||
{
|
||||
! }
|
||||
!
|
||||
! static void
|
||||
! dnscache_clean()
|
||||
! {
|
||||
! DNSCACHE dc, nextdc;
|
||||
! if (alldnscache_count > DNSCACHE_MAX) {
|
||||
! p_th_mutex_lock(p_th_mutexALLDNSCACHE);
|
||||
! for (dc = alldnscaches; dc ; dc = nextdc) {
|
||||
! nextdc = dc->next;
|
||||
! if (!(--dc->usecount)) {
|
||||
! EXTRACT_ITEM(dc,alldnscaches);
|
||||
! dnscache_free(dc);
|
||||
! alldnscache_count--;
|
||||
! }
|
||||
! }
|
||||
! p_th_mutex_unlock(p_th_mutexALLDNSCACHE);
|
||||
}
|
||||
}
|
||||
+
|
||||
int
|
||||
ardp_hostname2addr(const char *hostname, struct sockaddr_in *hostaddr)
|
||||
{
|
||||
struct hostent *hp; /* Remote host we're connecting to. */
|
||||
! int retval; /* Value to return */
|
||||
! #define RETURN(rv) { retval = (rv); goto cleanup; }
|
||||
#ifdef PROSPERO
|
||||
int DpfStmp; /* for DISABLE_PFS_START() */
|
||||
#endif
|
||||
! #ifdef DNSCACHE_MAX
|
||||
! DNSCACHE acache = NULL;
|
||||
|
||||
acache = alldnscaches;
|
||||
|
||||
! p_th_mutex_lock(p_th_mutexALLDNSCACHE);
|
||||
/* Cant use TH_FIND_FNCTN_LIST because must retain lock */
|
||||
FIND_FNCTN_LIST(acache, name, hostname, stcaseequal);
|
||||
if(acache) {
|
||||
+ acache->usecount++;
|
||||
if (hostaddr) {
|
||||
/* Note is is pointless, but not harmfull to call again
|
||||
for same hostaddr - may just want to rerun*/
|
||||
sockaddr_copy(&(acache->sockad),hostaddr);
|
||||
}
|
||||
! p_th_mutex_unlock(p_th_mutexALLDNSCACHE); /* Also released below*/
|
||||
! return(ARDP_SUCCESS); /* Dont free acache */
|
||||
}
|
||||
! p_th_mutex_unlock(p_th_mutexALLDNSCACHE); /* Note also released above*/
|
||||
acache = dnscache_alloc(); /*locks DNSCACHE temporarily*/
|
||||
acache->name = stcopy(hostname);
|
||||
! if (!hostaddr) { hostaddr = &(acache->sockad); }
|
||||
! #endif /*DNSCACHE_MAX*/
|
||||
|
||||
DISABLE_PFS_START(); /* Turn off compatibility library if on */
|
||||
p_th_mutex_lock(p_th_mutexGETHOSTBYNAME);
|
||||
***************
|
||||
*** 141,148 ****
|
||||
hostaddr->sin_addr.s_addr = inet_addr(hostname);
|
||||
if(hostaddr->sin_addr.s_addr == -1) {
|
||||
p_clear_errors(); /* clear p_err_string if set. */
|
||||
! return(perrno = ARDP_BAD_HOSTNAME);
|
||||
}
|
||||
}
|
||||
bzero((char *) hostaddr, sizeof *hostaddr);
|
||||
memcpy((char *)&hostaddr->sin_addr, hp->h_addr, hp->h_length);
|
||||
--- 157,165 ----
|
||||
hostaddr->sin_addr.s_addr = inet_addr(hostname);
|
||||
if(hostaddr->sin_addr.s_addr == -1) {
|
||||
p_clear_errors(); /* clear p_err_string if set. */
|
||||
! RETURN(perrno = ARDP_BAD_HOSTNAME);
|
||||
}
|
||||
+ RETURN(ARDP_SUCCESS);
|
||||
}
|
||||
bzero((char *) hostaddr, sizeof *hostaddr);
|
||||
memcpy((char *)&hostaddr->sin_addr, hp->h_addr, hp->h_length);
|
||||
***************
|
||||
*** 150,164 ****
|
||||
/* Don't unlock the mutex until we're no longer reading from hp. */
|
||||
p_th_mutex_unlock(p_th_mutexGETHOSTBYNAME); /* Note can be unlocked above*/
|
||||
/* Copy last result into cache */
|
||||
! #ifdef CACHE_ARDP_HOSTNAME2ADDR
|
||||
if (alldnscaches == NULL)
|
||||
ardp_hostname2addr_initcache();
|
||||
! p_th_mutex_lock(p_th_mutexDNSCACHE);
|
||||
! last_dnscache->name = stcopyr(hostname, last_dnscache->name);
|
||||
! sockaddr_copy(hostaddr,&(last_dnscache->sockad));
|
||||
! p_th_mutex_unlock(p_th_mutexDNSCACHE);
|
||||
! #endif /*CACHE_ARDP_HOSTNAME2ADDR*/
|
||||
! return(ARDP_SUCCESS);
|
||||
}
|
||||
|
||||
/* Prototype needs to go into here, not just in pfs.h. */
|
||||
--- 167,191 ----
|
||||
/* Don't unlock the mutex until we're no longer reading from hp. */
|
||||
p_th_mutex_unlock(p_th_mutexGETHOSTBYNAME); /* Note can be unlocked above*/
|
||||
/* Copy last result into cache */
|
||||
! #ifdef DNSCACHE_MAX
|
||||
if (alldnscaches == NULL)
|
||||
ardp_hostname2addr_initcache();
|
||||
! sockaddr_copy(hostaddr,&(acache->sockad));
|
||||
! /* Boost initially, to bias towards keeping recent*/
|
||||
! acache->usecount = 5;
|
||||
! p_th_mutex_lock(p_th_mutexALLDNSCACHE);
|
||||
! APPEND_ITEM(acache,alldnscaches);
|
||||
! alldnscache_count++;
|
||||
! p_th_mutex_unlock(p_th_mutexALLDNSCACHE);
|
||||
! dnscache_clean(); /* Only does anything if cache too big */
|
||||
! #endif /*DNSCACHE_MAX*/
|
||||
! return(ARDP_SUCCESS); /* Dont free acache */
|
||||
!
|
||||
! cleanup:
|
||||
! #ifdef DNSCACHE_MAX
|
||||
! if (acache) dnscache_free(acache);
|
||||
! #endif
|
||||
! return(retval);
|
||||
}
|
||||
|
||||
/* Prototype needs to go into here, not just in pfs.h. */
|
||||
diff -b -r -c -N 10Mar94.all/lib/pfs/myhost.c 10Mar94+/lib/pfs/myhost.c
|
||||
*** 10Mar94.all/lib/pfs/myhost.c Tue Apr 26 15:37:03 1994
|
||||
--- 10Mar94+/lib/pfs/myhost.c Tue Apr 19 14:35:31 1994
|
||||
***************
|
||||
*** 94,105 ****
|
||||
/* gethostbyname reads files, so we must disable pfs */
|
||||
p_th_mutex_lock(p_th_mutexGETHOSTBYNAME);
|
||||
DISABLE_PFS(current_host = gethostbyname(myhname));
|
||||
- p_th_mutex_unlock(p_th_mutexGETHOSTBYNAME);
|
||||
strcpy(myhname,current_host->h_name);
|
||||
ucase(myhname);
|
||||
|
||||
/* Save the address too */
|
||||
! bcopy1(current_host->h_addr,&myhaddr);
|
||||
++initialized;
|
||||
#ifdef P__MYHOST_MUTEX_AUTOINITIALIZATION
|
||||
#ifdef PFS_THREADS
|
||||
--- 94,107 ----
|
||||
/* gethostbyname reads files, so we must disable pfs */
|
||||
p_th_mutex_lock(p_th_mutexGETHOSTBYNAME);
|
||||
DISABLE_PFS(current_host = gethostbyname(myhname));
|
||||
strcpy(myhname,current_host->h_name);
|
||||
ucase(myhname);
|
||||
|
||||
/* Save the address too */
|
||||
! /* Huh - since when is the address 1 byte!! XXX */
|
||||
! bcopy(current_host->h_addr,&myhaddr,4);
|
||||
! /* Dont unlock GETHOSTBYNAME till data safely copied */
|
||||
! p_th_mutex_unlock(p_th_mutexGETHOSTBYNAME);
|
||||
++initialized;
|
||||
#ifdef P__MYHOST_MUTEX_AUTOINITIALIZATION
|
||||
#ifdef PFS_THREADS
|
||||
diff -b -r -c -N 10Mar94.all/server/dirsrv.c 10Mar94+/server/dirsrv.c
|
||||
*** 10Mar94.all/server/dirsrv.c Tue Apr 26 15:37:57 1994
|
||||
--- 10Mar94+/server/dirsrv.c Sun Apr 24 17:19:53 1994
|
||||
***************
|
||||
*** 79,81 ****
|
||||
#ifdef PSRV_GOPHER_GW
|
||||
extern int glink_count, glink_max;
|
||||
#endif
|
||||
--- 80,83 ----
|
||||
+ extern int dnscache_count, dnscache_max, alldnscache_count;
|
||||
#ifdef PSRV_GOPHER_GW
|
||||
extern int glink_count, glink_max;
|
||||
#endif
|
||||
***************
|
||||
*** 1069,1071 ****
|
||||
replyf(req," Memory: %d(%d)vlink %d(%d)pattrib %d(%d)acl \
|
||||
%d(%d)pfile %d(%d)rreq %d(%d)ptext\n",
|
||||
vlink_count,vlink_max,pattrib_count,pattrib_max,
|
||||
--- 1070,1076 ----
|
||||
+ #ifdef DNSCACHE_MAX
|
||||
+ replyf(req," DNS: %d(%d) caching %d(%d)\n",
|
||||
+ dnscache_count,dnscache_max,alldnscache_count,DNSCACHE_MAX);
|
||||
+ #endif
|
||||
replyf(req," Memory: %d(%d)vlink %d(%d)pattrib %d(%d)acl \
|
||||
%d(%d)pfile %d(%d)rreq %d(%d)ptext\n",
|
||||
vlink_count,vlink_max,pattrib_count,pattrib_max,
|
||||
31
prospero/patches/done/10Mar94.dnscache1.patch
Normal file
31
prospero/patches/done/10Mar94.dnscache1.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
diff -b -r -c -N 10Mar94.all/lib/ardp/hostname2adr.c 10Mar94+/lib/ardp/hostname2adr.c
|
||||
*** 10Mar94.all/lib/ardp/hostname2adr.c Tue Apr 26 16:33:30 1994
|
||||
--- 10Mar94+/lib/ardp/hostname2adr.c Wed Apr 27 01:07:43 1994
|
||||
***************
|
||||
*** 98,104 ****
|
||||
{
|
||||
DNSCACHE dc, nextdc;
|
||||
if (alldnscache_count > DNSCACHE_MAX) {
|
||||
! p_th_mutex_lock(p_th_mutexALLDNSCACHE);
|
||||
for (dc = alldnscaches; dc ; dc = nextdc) {
|
||||
nextdc = dc->next;
|
||||
if (!(--dc->usecount)) {
|
||||
--- 98,105 ----
|
||||
{
|
||||
DNSCACHE dc, nextdc;
|
||||
if (alldnscache_count > DNSCACHE_MAX) {
|
||||
! if (! p_th_mutex_trylock(p_th_mutexALLDNSCACHE)) {
|
||||
! /* Since this is only optimisation, skip if its locked already */
|
||||
for (dc = alldnscaches; dc ; dc = nextdc) {
|
||||
nextdc = dc->next;
|
||||
if (!(--dc->usecount)) {
|
||||
***************
|
||||
*** 109,114 ****
|
||||
--- 110,116 ----
|
||||
}
|
||||
p_th_mutex_unlock(p_th_mutexALLDNSCACHE);
|
||||
}
|
||||
+ }
|
||||
}
|
||||
|
||||
int
|
||||
46
prospero/patches/done/10Mar94.doc1.patch
Normal file
46
prospero/patches/done/10Mar94.doc1.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
This patch was created on pand05 at Tue Apr 26 17:02:31 EDT 1994
|
||||
The command used to create it was: gnudiff -b -r -c 10Mar94.all 10Mar94+
|
||||
|
||||
It is made available on an as-is basis, and carries no guarrantee that
|
||||
it even works, much less that it is fit for its purpose.
|
||||
|
||||
If you find any problems with it, please report to mitra@pand05
|
||||
You may use it as you wish, but if you make it pulicly available anywhere
|
||||
please notify me.
|
||||
|
||||
To apply the patch cd to the directory with the source in it, and run
|
||||
|
||||
patch -l -p1 <patchfile
|
||||
|
||||
diff -b -r -c -N 10Mar94.all/doc/pandora.todolist 10Mar94+/doc/pandora.todolist
|
||||
*** 10Mar94.all/doc/pandora.todolist Tue Apr 26 15:37:58 1994
|
||||
--- 10Mar94+/doc/pandora.todolist Wed Apr 20 19:52:33 1994
|
||||
***************
|
||||
*** 1,5 ****
|
||||
--- 1,6 ----
|
||||
# This is the to do list I have as discussed with BCN @ ietf-Seattle
|
||||
# - Mitra Mar 28, 94
|
||||
+ # - Mitra Apr 20, 94
|
||||
|
||||
IMPORT SIZE Task
|
||||
1 1 Standardisation of URL's - bcn agreed to return URL's
|
||||
***************
|
||||
*** 10,18 ****
|
||||
working group making a decision
|
||||
1 3 Ftp directory retrieval
|
||||
2 3 Multi-threaded client libraries
|
||||
- 3 2 Fix crashes with multi-threaded servers
|
||||
1 2 Gopher+ gateway
|
||||
- 3 2 Fix server not restarting
|
||||
1 1 getdomainname efficiency hack
|
||||
2 2 Ability to make a ulink optional (i.e. dont fail if ulink fails
|
||||
2 1 Define interface for replica's
|
||||
--- 11,17 ----
|
||||
***************
|
||||
*** 24,28 ****
|
||||
2 2 hsonames and gateways GATEWAY GOPHER ASCII path.net(70)/aaa
|
||||
2 2 Seperation of libraries and removal of dependancies
|
||||
1 3 Charging mechanisms
|
||||
- 1 1 Total number of queries not being incremented.
|
||||
-
|
||||
--- 23,25 ----
|
||||
63
prospero/patches/done/10Mar94.memleaks.patch
Normal file
63
prospero/patches/done/10Mar94.memleaks.patch
Normal file
@@ -0,0 +1,63 @@
|
||||
diff -b -r -c -N 10Mar94.all/lib/psrv/wais_gw/inface.c 10Mar94+/lib/psrv/wais_gw/inface.c
|
||||
*** 10Mar94.all/lib/psrv/wais_gw/inface.c Tue Apr 26 15:37:17 1994
|
||||
--- 10Mar94+/lib/psrv/wais_gw/inface.c Tue Apr 26 18:21:42 1994
|
||||
***************
|
||||
*** 861,866 ****
|
||||
--- 861,867 ----
|
||||
int
|
||||
waisRetrieveFileByHsoname(char *local,char *hsoname)
|
||||
{
|
||||
+ any *DocumentId = NULL;
|
||||
char *host = NULL;
|
||||
char *port = NULL;
|
||||
char *type = NULL;
|
||||
***************
|
||||
*** 875,884 ****
|
||||
"Invalid WAIS hsoname: %s", hsoname);
|
||||
RETURN(-1);
|
||||
}
|
||||
RETURN(waisRetrieveFile(host,port,database,
|
||||
! un_urlascii(query),type,0,local));
|
||||
|
||||
cleanup:
|
||||
stfree(host);
|
||||
stfree(port);
|
||||
stfree(type);
|
||||
--- 876,890 ----
|
||||
"Invalid WAIS hsoname: %s", hsoname);
|
||||
RETURN(-1);
|
||||
}
|
||||
+ DocumentId = un_urlascii(query);
|
||||
RETURN(waisRetrieveFile(host,port,database,
|
||||
! DocumentId,type,0,local));
|
||||
|
||||
cleanup:
|
||||
+ if (DocumentId) {
|
||||
+ stfree(DocumentId->bytes);
|
||||
+ free(DocumentId);
|
||||
+ }
|
||||
stfree(host);
|
||||
stfree(port);
|
||||
stfree(type);
|
||||
diff -b -r -c -N 10Mar94.all/lib/psrv/wais_gw/wais_gw_dsdb.c 10Mar94+/lib/psrv/wais_gw/wais_gw_dsdb.c
|
||||
*** 10Mar94.all/lib/psrv/wais_gw/wais_gw_dsdb.c Fri Mar 11 05:31:43 1994
|
||||
--- 10Mar94+/lib/psrv/wais_gw/wais_gw_dsdb.c Tue Apr 26 18:30:59 1994
|
||||
***************
|
||||
*** 298,305 ****
|
||||
} else {
|
||||
APPEND_ITEM(vl,head);
|
||||
}
|
||||
- }
|
||||
stfree(str);
|
||||
return(head);
|
||||
}
|
||||
|
||||
--- 298,305 ----
|
||||
} else {
|
||||
APPEND_ITEM(vl,head);
|
||||
}
|
||||
stfree(str);
|
||||
+ } /*for*/
|
||||
return(head);
|
||||
}
|
||||
|
||||
7
prospero/patches/done/10Mar94.purify2.patch
Normal file
7
prospero/patches/done/10Mar94.purify2.patch
Normal file
@@ -0,0 +1,7 @@
|
||||
diff -b -r -c -N 10Mar94.all/server/.purify 10Mar94+/server/.purify
|
||||
*** 10Mar94.all/server/.purify Wed Dec 31 19:00:00 1969
|
||||
--- 10Mar94+/server/.purify Fri Mar 25 14:36:27 1994
|
||||
***************
|
||||
*** 0 ****
|
||||
--- 1 ----
|
||||
+ suppress umr _s_alloc_bugs
|
||||
1784
prospero/patches/done/10Mar94.thread.patch
Normal file
1784
prospero/patches/done/10Mar94.thread.patch
Normal file
File diff suppressed because it is too large
Load Diff
1457
prospero/patches/done/10Mar94.thread2.patch
Normal file
1457
prospero/patches/done/10Mar94.thread2.patch
Normal file
File diff suppressed because it is too large
Load Diff
121
prospero/patches/done/10Mar94.thread3.patch
Normal file
121
prospero/patches/done/10Mar94.thread3.patch
Normal file
@@ -0,0 +1,121 @@
|
||||
diff -b -r -c -N 10Mar94.all/include/ardp.h 10Mar94+/include/ardp.h
|
||||
*** 10Mar94.all/include/ardp.h Tue Apr 26 15:38:02 1994
|
||||
--- 10Mar94+/include/ardp.h Mon Apr 18 21:36:31 1994
|
||||
***************
|
||||
*** 342,347 ****
|
||||
--- 342,358 ----
|
||||
int ardp_acknowledge(RREQ req);
|
||||
extern char *unixerrstr(void);
|
||||
|
||||
+ #include <../lib/ardp/flocks.h>
|
||||
+ FILELOCK filelock_alloc(void);
|
||||
+ void filelock_free(FILELOCK fl);
|
||||
+ void filelock_lfree(FILELOCK fl);
|
||||
+ void filelock_freespares(void);
|
||||
+ void filelock_release(const char *filename, int readonly);
|
||||
+ int locked_fclose_A(FILE *afle, const char *filename, int readonly);
|
||||
+ void filelock_obtain(const char *filename, int readonly);
|
||||
+ FILE *locked_fopen(const char *filename, const char *mode);
|
||||
+ int locked_fclose_and_rename(FILE *afile, const char *tmpfilename, const char *filename, int retval);
|
||||
+
|
||||
extern int ardp_priority;
|
||||
/* Check for case-blind string equality, where s1 or s2 may be null
|
||||
pointer. */
|
||||
diff -b -r -c -N 10Mar94.all/lib/ardp/flocks.c 10Mar94+/lib/ardp/flocks.c
|
||||
*** 10Mar94.all/lib/ardp/flocks.c Tue Apr 26 15:37:42 1994
|
||||
--- 10Mar94+/lib/ardp/flocks.c Mon Apr 18 21:08:38 1994
|
||||
***************
|
||||
*** 18,23 ****
|
||||
--- 18,25 ----
|
||||
int filelock_max = 0;
|
||||
int filelock_open = 0;
|
||||
int filelock_open_max = 0;
|
||||
+ int filelock_sepwaits = 0;
|
||||
+ int filelock_secwaits = 0;
|
||||
FILELOCK filelock_locked = NULL;
|
||||
|
||||
/************* Standard routines to alloc, free and copy *************/
|
||||
***************
|
||||
*** 69,75 ****
|
||||
TH_STRUC_LFREE(FILELOCK,fl,filelock_free);
|
||||
}
|
||||
|
||||
! void
|
||||
filelock_unreaders(FILELOCK flock)
|
||||
{
|
||||
/* Assumes p_th_mutexFILES is locked already */
|
||||
--- 71,77 ----
|
||||
TH_STRUC_LFREE(FILELOCK,fl,filelock_free);
|
||||
}
|
||||
|
||||
! static void
|
||||
filelock_unreaders(FILELOCK flock)
|
||||
{
|
||||
/* Assumes p_th_mutexFILES is locked already */
|
||||
***************
|
||||
*** 80,86 ****
|
||||
}
|
||||
}
|
||||
|
||||
! void
|
||||
filelock_unwriters(FILELOCK flock)
|
||||
{
|
||||
/* Assumes p_th_mutexFILES is locked already */
|
||||
--- 82,88 ----
|
||||
}
|
||||
}
|
||||
|
||||
! static void
|
||||
filelock_unwriters(FILELOCK flock)
|
||||
{
|
||||
/* Assumes p_th_mutexFILES is locked already */
|
||||
***************
|
||||
*** 131,136 ****
|
||||
--- 133,139 ----
|
||||
filelock_obtain(const char *filename, int readonly)
|
||||
{
|
||||
FILELOCK(flock);
|
||||
+ int haswaited = 0;
|
||||
for (;;) {
|
||||
p_th_mutex_lock(p_th_mutexFILES);
|
||||
flock = filelock_locked;
|
||||
***************
|
||||
*** 159,164 ****
|
||||
--- 162,169 ----
|
||||
/* At this point we cant lock it, so unlock mutex, wait, and try again*/
|
||||
p_th_mutex_unlock(p_th_mutexFILES);
|
||||
plog(L_QUEUE_INFO,NOREQ, "Waiting for filelock for %s", filename, 0);
|
||||
+ if (!haswaited) filelock_sepwaits++;
|
||||
+ filelock_secwaits++;
|
||||
sleep(1); /* Maybe too long */
|
||||
} /*for*/
|
||||
if (++filelock_open > filelock_open_max) {
|
||||
diff -b -r -c -N 10Mar94.all/server/dirsrv.c 10Mar94+/server/dirsrv.c
|
||||
*** 10Mar94.all/server/dirsrv.c Tue Apr 26 16:33:30 1994
|
||||
--- 10Mar94+/server/dirsrv.c Sun Apr 24 17:19:53 1994
|
||||
***************
|
||||
*** 75,78 ****
|
||||
extern int vlink_max, pattrib_max, acl_max, pfile_max;
|
||||
extern int rreq_max, ptext_max, string_max, token_max;
|
||||
extern int pauth_max, opt_max, filter_max, p_object_max;
|
||||
! extern int filelock_open, filelock_open_max;
|
||||
--- 75,79 ----
|
||||
extern int vlink_max, pattrib_max, acl_max, pfile_max;
|
||||
extern int rreq_max, ptext_max, string_max, token_max;
|
||||
extern int pauth_max, opt_max, filter_max, p_object_max;
|
||||
! extern int filelock_open, filelock_open_max, filelock_sepwaits;
|
||||
! extern int filelock_secwaits;
|
||||
***************
|
||||
*** 1065,1069 ****
|
||||
subthread_count + free_subthread_count, subthread_count,
|
||||
subthread_max, free_subthread_count);
|
||||
#endif
|
||||
! replyf(req," Files: %d(%d)open\n",
|
||||
! filelock_open,filelock_open_max);
|
||||
--- 1066,1071 ----
|
||||
subthread_count + free_subthread_count, subthread_count,
|
||||
subthread_max, free_subthread_count);
|
||||
#endif
|
||||
! replyf(req," Files: %d(%d)open, %d waits, %d secs\n",
|
||||
! filelock_open,filelock_open_max, filelock_sepwaits,
|
||||
! filelock_secwaits);
|
||||
979
prospero/patches/done/10Mar94.thread4.patch
Normal file
979
prospero/patches/done/10Mar94.thread4.patch
Normal file
@@ -0,0 +1,979 @@
|
||||
diff -b -r -c -N 10Mar94.all/include/pfs.h 10Mar94+/include/pfs.h
|
||||
*** 10Mar94.all/include/pfs.h Tue Apr 26 15:36:21 1994
|
||||
--- 10Mar94+/include/pfs.h Mon Apr 18 21:40:49 1994
|
||||
***************
|
||||
*** 1052,1058 ****
|
||||
--- 1052,1061 ----
|
||||
extern int lookup_precedence_by_precedencename(const char t_precedence[]);
|
||||
extern char *lookup_precedencename_by_precedence(int precedence);
|
||||
extern void p__set_username(char *un);
|
||||
+ #include <sys/socket.h>
|
||||
extern int quick_connect(int s, struct sockaddr *name, int namelen, int timeout);
|
||||
+ extern int quick_fgetc(FILE *stream, int timeout);
|
||||
+ extern int quick_read(int fd, char *nptr, int nbytes, int timeout);
|
||||
extern char *p_timetoasn_stcopyr(time_t ourtime, char *target);
|
||||
extern int vcache2(char *host, char *remote, char *local, char *method,
|
||||
int argc, char *argv[]);
|
||||
diff -b -r -c -N 10Mar94.all/include/vcache.h 10Mar94+/include/vcache.h
|
||||
*** 10Mar94.all/include/vcache.h Tue Apr 26 15:36:22 1994
|
||||
--- 10Mar94+/include/vcache.h Mon Apr 18 21:30:57 1994
|
||||
***************
|
||||
*** 1,5 ****
|
||||
/* Internal commands used in user/vcache */
|
||||
void setpeer(char *hostn);
|
||||
void set_type(char *t);
|
||||
! int recvrequest(char *cmd, char *local, char *remote, char *mode);
|
||||
|
||||
--- 1,10 ----
|
||||
/* Internal commands used in user/vcache */
|
||||
void setpeer(char *hostn);
|
||||
void set_type(char *t);
|
||||
! int recvrequest(char *cmd, char *local, char *remote, char *amode);
|
||||
! int ruserpass(char *host, char **aname, char **apass, char **aacct);
|
||||
! void lostpeer(void);
|
||||
! int login(char *host);
|
||||
! /* Dont define command - it should use vargs, but doesnt */
|
||||
! void pswitch(int flag);
|
||||
|
||||
diff -b -r -c -N 10Mar94.all/lib/pcompat/scandir.c 10Mar94+/lib/pcompat/scandir.c
|
||||
*** 10Mar94.all/lib/pcompat/scandir.c Tue Apr 26 15:37:29 1994
|
||||
--- 10Mar94+/lib/pcompat/scandir.c Fri Apr 15 19:48:00 1994
|
||||
***************
|
||||
*** 40,45 ****
|
||||
--- 40,46 ----
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
+ #include <pfs_threads.h> /* For PFS_THREADS */
|
||||
/*
|
||||
* The DIRSIZ macro gives the minimum record length which will hold
|
||||
* the directory entry. This requires the amount of space in struct dirent
|
||||
diff -b -r -c -N 10Mar94.all/lib/pfs/socket.c 10Mar94+/lib/pfs/socket.c
|
||||
*** 10Mar94.all/lib/pfs/socket.c Tue Apr 26 15:36:32 1994
|
||||
--- 10Mar94+/lib/pfs/socket.c Tue Apr 19 00:49:21 1994
|
||||
***************
|
||||
*** 22,31 ****
|
||||
#include <pfs_threads.h>
|
||||
#include <sockettime.h>
|
||||
|
||||
- /* How long do we want to wait before returning an error */
|
||||
- #define CONNECT_TIMEOUT 5
|
||||
- #define READ_TIMEOUT 5
|
||||
-
|
||||
#ifdef TIMEOUT_APPROACH
|
||||
EXTERN_TYPEP_DEF(jmp_buf, Jmpenv);
|
||||
#define Jmpenv p_th_arJmpenv[p__th_self_num()]
|
||||
--- 22,27 ----
|
||||
***************
|
||||
*** 53,58 ****
|
||||
--- 49,64 ----
|
||||
|
||||
#endif /*TIMEOUT_APPROACH*/
|
||||
|
||||
+ #ifdef SELECT_APPROACH
|
||||
+ int
|
||||
+ wait_till_stream_readable(FILE *str, int timeout)
|
||||
+ {
|
||||
+ if (str->_cnt > 0) return 1;
|
||||
+ return (wait_till_readable(fileno(str),timeout));
|
||||
+ }
|
||||
+
|
||||
+ #endif /*SELECT_APPROACH*/
|
||||
+
|
||||
/* This is adapted from interruptable_connect in gopher */
|
||||
int
|
||||
quick_connect(int s, struct sockaddr *name, int namelen, int timeout)
|
||||
***************
|
||||
*** 130,136 ****
|
||||
}
|
||||
#endif
|
||||
#ifdef SELECT_APPROACH
|
||||
! switch (wait_till_readable(fileno(stream),timeout)) {
|
||||
case -1: p_err_string = qsprintf_stcopyr(p_err_string,
|
||||
"INTERNAL: read select failed: %s", unixerrstr());
|
||||
return NULL;
|
||||
--- 136,142 ----
|
||||
}
|
||||
#endif
|
||||
#ifdef SELECT_APPROACH
|
||||
! switch (wait_till_stream_readable(stream,timeout)) {
|
||||
case -1: p_err_string = qsprintf_stcopyr(p_err_string,
|
||||
"INTERNAL: read select failed: %s", unixerrstr());
|
||||
return NULL;
|
||||
***************
|
||||
*** 147,153 ****
|
||||
/* fgets can retunr an incomplete line, since it is non-blocking */
|
||||
if (retval) {
|
||||
int buflen = strlen(s);
|
||||
! if (s[buflen -1 ] != '\n') {
|
||||
retval = quick_fgets(s+buflen, n-buflen, stream, timeout);
|
||||
}
|
||||
}
|
||||
--- 153,159 ----
|
||||
/* fgets can retunr an incomplete line, since it is non-blocking */
|
||||
if (retval) {
|
||||
int buflen = strlen(s);
|
||||
! if ((s[buflen -1 ] != '\n') && (n-1 > buflen)) {
|
||||
retval = quick_fgets(s+buflen, n-buflen, stream, timeout);
|
||||
}
|
||||
}
|
||||
***************
|
||||
*** 158,160 ****
|
||||
--- 164,223 ----
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
+
|
||||
+ #if 0
|
||||
+
|
||||
+ int
|
||||
+ quick_fgetc(FILE *stream, int timeout)
|
||||
+ {
|
||||
+ int retval;
|
||||
+
|
||||
+ #ifdef TIMEOUT_APPROACH
|
||||
+ syscall_oldalarmtime = alarm(timeout);
|
||||
+ if ((syscall_oldintr = signal(SIGALRM, alarmJmp)) == SIG_ERR)
|
||||
+ perror("signal died:\n"), exit(-1);
|
||||
+ if (setjmp(Jmpenv)) {
|
||||
+ /* Note alarmJmp will reprime alarm*/
|
||||
+ errno = ETIMEDOUT;
|
||||
+ return(EOF);
|
||||
+ }
|
||||
+ #endif
|
||||
+ #ifdef SELECT_APPROACH
|
||||
+ switch (wait_till_stream_readable(stream,timeout)) {
|
||||
+ case -1: p_err_string = qsprintf_stcopyr(p_err_string,
|
||||
+ "INTERNAL: quick_fgetc: select failed: %s", unixerrstr());
|
||||
+ return EOF;
|
||||
+ case 0: p_err_string = qsprintf_stcopyr(p_err_string,
|
||||
+ "waited more than %d secs for a response", timeout);
|
||||
+ errno = ETIMEDOUT;
|
||||
+ return EOF;
|
||||
+ }
|
||||
+ /* Default is going to be 1 - which is success */
|
||||
+
|
||||
+ #endif /*SELECT_APPROACH*/
|
||||
+ retval = getc(stream);
|
||||
+
|
||||
+ #ifdef TIMEOUT_APPROACH
|
||||
+ reprimeAlarm(syscall_oldalarmtime,syscall_oldintr);
|
||||
+ #endif
|
||||
+ return retval;
|
||||
+
|
||||
+
|
||||
+ }
|
||||
+ #endif
|
||||
+
|
||||
+ int quick_fgetc (FILE *stream, int timeout)
|
||||
+ {
|
||||
+ char c[2];
|
||||
+ char *retval;
|
||||
+
|
||||
+ if (!(retval = quick_fgets(c, 2, stream, timeout))) {
|
||||
+ /* errno set in quick_fgets */
|
||||
+ return EOF;
|
||||
+ }
|
||||
+ return c[0];
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
diff -b -r -c -N 10Mar94.all/lib/psrv/wais_gw/irfileio.c 10Mar94+/lib/psrv/wais_gw/irfileio.c
|
||||
*** 10Mar94.all/lib/psrv/wais_gw/irfileio.c Fri Mar 11 05:31:38 1994
|
||||
--- 10Mar94+/lib/psrv/wais_gw/irfileio.c Mon Apr 18 14:53:21 1994
|
||||
***************
|
||||
*** 215,221 ****
|
||||
#define S (4L)
|
||||
#define QUOTE (5L)
|
||||
|
||||
!
|
||||
boolean ReadStartOfList(file)
|
||||
FILE* file;
|
||||
{
|
||||
--- 214,220 ----
|
||||
#define S (4L)
|
||||
#define QUOTE (5L)
|
||||
|
||||
! #if !defined(IN_RMG)
|
||||
boolean ReadStartOfList(file)
|
||||
FILE* file;
|
||||
{
|
||||
***************
|
||||
*** 242,248 ****
|
||||
}
|
||||
|
||||
|
||||
-
|
||||
boolean ReadEndOfList(file)
|
||||
FILE* file;
|
||||
{
|
||||
--- 241,246 ----
|
||||
***************
|
||||
*** 255,260 ****
|
||||
--- 253,259 ----
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
+ #endif /*!IN_RMG*/
|
||||
|
||||
#define STRING_ESC '\\'
|
||||
|
||||
***************
|
||||
*** 487,493 ****
|
||||
|
||||
}
|
||||
}
|
||||
!
|
||||
long ReadEndOfListOrStruct(file)
|
||||
FILE* file;
|
||||
{
|
||||
--- 486,492 ----
|
||||
|
||||
}
|
||||
}
|
||||
! #if !defined(IN_RMG)
|
||||
long ReadEndOfListOrStruct(file)
|
||||
FILE* file;
|
||||
{
|
||||
***************
|
||||
*** 502,508 ****
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
!
|
||||
|
||||
long ReadString(string,file,string_size)
|
||||
char* string;
|
||||
--- 501,507 ----
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
! #endif
|
||||
|
||||
long ReadString(string,file,string_size)
|
||||
char* string;
|
||||
***************
|
||||
*** 544,550 ****
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
long ReadStartOfStruct(name,file)
|
||||
char* name;
|
||||
FILE* file;
|
||||
--- 543,548 ----
|
||||
***************
|
||||
*** 586,592 ****
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
long CheckStartOfStruct(name,file)
|
||||
char* name;
|
||||
FILE* file;
|
||||
--- 584,589 ----
|
||||
***************
|
||||
*** 603,608 ****
|
||||
--- 600,606 ----
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
+ #if !defined(IN_RMG)
|
||||
|
||||
long ReadAny(destination,file)
|
||||
any* destination;
|
||||
***************
|
||||
*** 656,662 ****
|
||||
return(retval);
|
||||
}
|
||||
|
||||
-
|
||||
long Read8BitArray(destination,file,length)
|
||||
char* destination;
|
||||
FILE* file;
|
||||
--- 654,659 ----
|
||||
***************
|
||||
*** 771,773 ****
|
||||
--- 768,771 ----
|
||||
|
||||
return(true);
|
||||
}
|
||||
+ #endif
|
||||
diff -b -r -c -N 10Mar94.all/lib/psrv/wais_gw/irfileio.h 10Mar94+/lib/psrv/wais_gw/irfileio.h
|
||||
*** 10Mar94.all/lib/psrv/wais_gw/irfileio.h Fri Mar 11 05:31:38 1994
|
||||
--- 10Mar94+/lib/psrv/wais_gw/irfileio.h Mon Apr 18 14:56:58 1994
|
||||
***************
|
||||
*** 22,34 ****
|
||||
long ReadString(char* string, FILE* file, long string_size);
|
||||
long CheckStartOfStruct(char* name, FILE* file);
|
||||
long ReadAny(any* destination, FILE* file);
|
||||
! long ReadTM(struct tm* time, FILE* file);
|
||||
! long Read8BitArray(char* destination, FILE* file, long length);
|
||||
long ReadEndOfListOrStruct(FILE* file);
|
||||
long ReadStartOfStruct(char* name, FILE* file);
|
||||
boolean ReadStartOfList(FILE* file);
|
||||
boolean ReadEndOfList(FILE* file);
|
||||
! boolean readAbsoluteTime(struct tm* time,FILE* file);
|
||||
long WriteStartOfStruct(char* name, FILE* file);
|
||||
long WriteEndOfStruct(FILE* file);
|
||||
long WriteSymbol(char* name, FILE* file);
|
||||
--- 22,34 ----
|
||||
long ReadString(char* string, FILE* file, long string_size);
|
||||
long CheckStartOfStruct(char* name, FILE* file);
|
||||
long ReadAny(any* destination, FILE* file);
|
||||
! long ReadTM(struct tm* atime, FILE* file);
|
||||
! long Read8BitArray(char* destination, FILE* file, long len);
|
||||
long ReadEndOfListOrStruct(FILE* file);
|
||||
long ReadStartOfStruct(char* name, FILE* file);
|
||||
boolean ReadStartOfList(FILE* file);
|
||||
boolean ReadEndOfList(FILE* file);
|
||||
! boolean readAbsoluteTime(struct tm* atime,FILE* file);
|
||||
long WriteStartOfStruct(char* name, FILE* file);
|
||||
long WriteEndOfStruct(FILE* file);
|
||||
long WriteSymbol(char* name, FILE* file);
|
||||
***************
|
||||
*** 37,46 ****
|
||||
long WriteLong(long number, FILE* file);
|
||||
long WriteDouble(double number, FILE* file);
|
||||
long WriteAny(any* value, FILE* file);
|
||||
! long Write8BitArray(long length, char* array, FILE* file);
|
||||
! long WriteTM(struct tm* time, FILE* file);
|
||||
long WriteStartOfList(FILE* file);
|
||||
long WriteEndOfList(FILE* file);
|
||||
! boolean writeAbsoluteTime(struct tm* time,FILE* file);
|
||||
|
||||
#endif
|
||||
--- 37,46 ----
|
||||
long WriteLong(long number, FILE* file);
|
||||
long WriteDouble(double number, FILE* file);
|
||||
long WriteAny(any* value, FILE* file);
|
||||
! long Write8BitArray(long len, char* array, FILE* file);
|
||||
! long WriteTM(struct tm* atime, FILE* file);
|
||||
long WriteStartOfList(FILE* file);
|
||||
long WriteEndOfList(FILE* file);
|
||||
! boolean writeAbsoluteTime(struct tm* atime,FILE* file);
|
||||
|
||||
#endif
|
||||
diff -b -r -c -N 10Mar94.all/user/vcache/cmds.c 10Mar94+/user/vcache/cmds.c
|
||||
*** 10Mar94.all/user/vcache/cmds.c Tue Apr 26 15:37:23 1994
|
||||
--- 10Mar94+/user/vcache/cmds.c Mon Apr 18 21:18:42 1994
|
||||
***************
|
||||
*** 38,44 ****
|
||||
#include <pmachine.h> /* after netdb.h */
|
||||
#include <perrno.h>
|
||||
#include "vcache_macros.h"
|
||||
!
|
||||
extern char *home;
|
||||
extern short gflag;
|
||||
extern char *getenv();
|
||||
--- 38,44 ----
|
||||
#include <pmachine.h> /* after netdb.h */
|
||||
#include <perrno.h>
|
||||
#include "vcache_macros.h"
|
||||
! #include <vcache.h>
|
||||
extern char *home;
|
||||
extern short gflag;
|
||||
extern char *getenv();
|
||||
***************
|
||||
*** 46,51 ****
|
||||
--- 46,53 ----
|
||||
extern char *rindex();
|
||||
char *mname;
|
||||
jmp_buf jabort;
|
||||
+ /* Forward declerations */
|
||||
+ static void disconnect(void);
|
||||
|
||||
/*
|
||||
* Connect to peer server and
|
||||
***************
|
||||
*** 143,149 ****
|
||||
/*
|
||||
* Terminate session, but don't exit.
|
||||
*/
|
||||
! void
|
||||
disconnect()
|
||||
{
|
||||
extern FILE *cout;
|
||||
--- 145,151 ----
|
||||
/*
|
||||
* Terminate session, but don't exit.
|
||||
*/
|
||||
! static void
|
||||
disconnect()
|
||||
{
|
||||
extern FILE *cout;
|
||||
diff -b -r -c -N 10Mar94.all/user/vcache/ftp.c 10Mar94+/user/vcache/ftp.c
|
||||
*** 10Mar94.all/user/vcache/ftp.c Tue Apr 26 15:37:39 1994
|
||||
--- 10Mar94+/user/vcache/ftp.c Tue Apr 19 01:02:11 1994
|
||||
***************
|
||||
*** 44,52 ****
|
||||
#include <pmachine.h>
|
||||
#include <perrno.h>
|
||||
#include "vcache_macros.h"
|
||||
!
|
||||
#include <pfs.h> /* For quick_connect */
|
||||
#include <implicit_fixes.h>
|
||||
|
||||
#ifdef SOLARIS
|
||||
/* Should be defined in stdio.h */
|
||||
--- 44,53 ----
|
||||
#include <pmachine.h>
|
||||
#include <perrno.h>
|
||||
#include "vcache_macros.h"
|
||||
! #include <vcache.h>
|
||||
#include <pfs.h> /* For quick_connect */
|
||||
#include <implicit_fixes.h>
|
||||
+ #include <sockettime.h>
|
||||
|
||||
#ifdef SOLARIS
|
||||
/* Should be defined in stdio.h */
|
||||
***************
|
||||
*** 56,61 ****
|
||||
--- 57,66 ----
|
||||
#define F_OPEN_TIMEOUT 5
|
||||
#endif
|
||||
|
||||
+ #ifndef F_READ_TIMEOUT
|
||||
+ #define F_READ_TIMEOUT 60
|
||||
+ #endif
|
||||
+
|
||||
struct sockaddr_in hisctladdr;
|
||||
struct sockaddr_in data_addr;
|
||||
int data = -1;
|
||||
***************
|
||||
*** 81,95 ****
|
||||
static void tvsub(struct timeval *tdiff, struct timeval *t1,
|
||||
struct timeval *t0);
|
||||
static void proxtrans( char *cmd, char *local, char *remote);
|
||||
|
||||
/* Returns hostname, or if fails then returns 0 and closes socket */
|
||||
char *
|
||||
! hookup(host, port)
|
||||
! char *host;
|
||||
! int port;
|
||||
{
|
||||
- register struct hostent *hp = 0;
|
||||
int s,len;
|
||||
static char hostnamebuf[80];
|
||||
|
||||
bzero((char *)&hisctladdr, sizeof (hisctladdr));
|
||||
--- 86,101 ----
|
||||
static void tvsub(struct timeval *tdiff, struct timeval *t1,
|
||||
struct timeval *t0);
|
||||
static void proxtrans( char *cmd, char *local, char *remote);
|
||||
+ static int getreply(int expecteof);
|
||||
+ static int initconn();
|
||||
|
||||
/* Returns hostname, or if fails then returns 0 and closes socket */
|
||||
char *
|
||||
! hookup(char *host, int port)
|
||||
{
|
||||
int s,len;
|
||||
+ #ifndef SELECT_APPROACH
|
||||
+ register struct hostent *hp = 0;
|
||||
static char hostnamebuf[80];
|
||||
|
||||
bzero((char *)&hisctladdr, sizeof (hisctladdr));
|
||||
***************
|
||||
*** 146,151 ****
|
||||
--- 152,164 ----
|
||||
code = -1;
|
||||
goto bad;
|
||||
}
|
||||
+ #else
|
||||
+ if ((s = quick_open_tcp_stream(host,port,F_OPEN_TIMEOUT)) < 0) {
|
||||
+ ERRSYS("ftp: socket:%s %s");
|
||||
+ code = -1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ #endif /*SELECT_APPROACH*/
|
||||
len = sizeof (myctladdr);
|
||||
if (getsockname(s, (char *)&myctladdr, &len) < 0) {
|
||||
ERRSYS("ftp: getsockname:%s %s");
|
||||
***************
|
||||
*** 181,198 ****
|
||||
}
|
||||
#endif SO_OOBINLINE
|
||||
|
||||
return (hostname);
|
||||
bad:
|
||||
(void) close(s);
|
||||
return ((char *)0);
|
||||
}
|
||||
|
||||
int
|
||||
! login(host)
|
||||
! char *host;
|
||||
{
|
||||
char tmp[80];
|
||||
! char *user, *pass, *acct, *getlogin(), *getpass();
|
||||
int n, aflag = 0;
|
||||
|
||||
char *myhstnm, username[120], password[120], account[120];
|
||||
--- 194,214 ----
|
||||
}
|
||||
#endif SO_OOBINLINE
|
||||
|
||||
+ #ifdef SELECT_APPROACH
|
||||
+ return(host);
|
||||
+ #else
|
||||
return (hostname);
|
||||
+ #endif /*SELECT_APPROACH*/
|
||||
bad:
|
||||
(void) close(s);
|
||||
return ((char *)0);
|
||||
}
|
||||
|
||||
int
|
||||
! login(char *host)
|
||||
{
|
||||
char tmp[80];
|
||||
! char *user, *pass, *l_acct, *getlogin(), *getpass();
|
||||
int n, aflag = 0;
|
||||
|
||||
char *myhstnm, username[120], password[120], account[120];
|
||||
***************
|
||||
*** 201,207 ****
|
||||
assert(P_IS_THIS_THREAD_MASTER()); /* getpwuid MT-Unsafe */
|
||||
DISABLE_PFS(whoiampw = getpwuid(getuid()));
|
||||
|
||||
! user = pass = acct = 0;
|
||||
if (anonlogin) {
|
||||
user = "anonymous";
|
||||
|
||||
--- 217,223 ----
|
||||
assert(P_IS_THIS_THREAD_MASTER()); /* getpwuid MT-Unsafe */
|
||||
DISABLE_PFS(whoiampw = getpwuid(getuid()));
|
||||
|
||||
! user = pass = l_acct = 0;
|
||||
if (anonlogin) {
|
||||
user = "anonymous";
|
||||
|
||||
***************
|
||||
*** 221,227 ****
|
||||
if (whoiampw != NULL)
|
||||
myname = whoiampw->pw_name;
|
||||
}
|
||||
! DISABLE_PFS(code = ruserpass(host, &user, &pass, &acct));
|
||||
if (user) {
|
||||
strncpy(username, user, sizeof(username)-1);
|
||||
free(user);
|
||||
--- 237,243 ----
|
||||
if (whoiampw != NULL)
|
||||
myname = whoiampw->pw_name;
|
||||
}
|
||||
! DISABLE_PFS(code = ruserpass(host, &user, &pass, &l_acct));
|
||||
if (user) {
|
||||
strncpy(username, user, sizeof(username)-1);
|
||||
free(user);
|
||||
***************
|
||||
*** 231,243 ****
|
||||
strncpy(password, pass, sizeof(password)-1);
|
||||
free(pass);
|
||||
}
|
||||
! if (acct) {
|
||||
! strncpy(account, acct, sizeof(account)-1);
|
||||
! free(acct);
|
||||
! acct = account;
|
||||
}
|
||||
if (code < 0) {
|
||||
! user = pass = acct = NULL;
|
||||
}
|
||||
if (user) myname = user; /* Use name found in .netrc */
|
||||
if (myname) {
|
||||
--- 247,259 ----
|
||||
strncpy(password, pass, sizeof(password)-1);
|
||||
free(pass);
|
||||
}
|
||||
! if (l_acct) {
|
||||
! strncpy(account, l_acct, sizeof(account)-1);
|
||||
! free(l_acct);
|
||||
! l_acct = account;
|
||||
}
|
||||
if (code < 0) {
|
||||
! user = pass = l_acct = NULL;
|
||||
}
|
||||
if (user) myname = user; /* Use name found in .netrc */
|
||||
if (myname) {
|
||||
***************
|
||||
*** 262,276 ****
|
||||
}
|
||||
if (n == CONTINUE) {
|
||||
aflag++;
|
||||
! acct = getpass("Account:");
|
||||
! n = command("ACCT %s", acct);
|
||||
}
|
||||
if (n != COMPLETE) {
|
||||
ERR("Login failed.");
|
||||
return (0);
|
||||
}
|
||||
! if (!aflag && acct != NULL)
|
||||
! (void) command("ACCT %s", acct);
|
||||
if (proxy)
|
||||
return(1);
|
||||
#ifdef UNDEFINED
|
||||
--- 278,292 ----
|
||||
}
|
||||
if (n == CONTINUE) {
|
||||
aflag++;
|
||||
! l_acct = getpass("Account:");
|
||||
! n = command("ACCT %s", l_acct);
|
||||
}
|
||||
if (n != COMPLETE) {
|
||||
ERR("Login failed.");
|
||||
return (0);
|
||||
}
|
||||
! if (!aflag && l_acct != NULL)
|
||||
! (void) command("ACCT %s", l_acct);
|
||||
if (proxy)
|
||||
return(1);
|
||||
#ifdef UNDEFINED
|
||||
***************
|
||||
*** 333,339 ****
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
! int
|
||||
getreply(int expecteof)
|
||||
{
|
||||
register int c, firstchar;
|
||||
--- 349,355 ----
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
! static int
|
||||
getreply(int expecteof)
|
||||
{
|
||||
register int c, firstchar;
|
||||
***************
|
||||
*** 350,360 ****
|
||||
for (;;) {
|
||||
dig = firstchar = code = 0;
|
||||
cp = reply_string;
|
||||
! while ((c = getc(cin)) != '\n') {
|
||||
if (verbose)
|
||||
fputc(c,stderr);
|
||||
if (c == IAC) { /* handle telnet commands */
|
||||
! switch (c = getc(cin)) {
|
||||
case WILL:
|
||||
case WONT:
|
||||
c = getc(cin);
|
||||
--- 366,376 ----
|
||||
for (;;) {
|
||||
dig = firstchar = code = 0;
|
||||
cp = reply_string;
|
||||
! while ((c = quick_fgetc(cin,F_READ_TIMEOUT)) != '\n') {
|
||||
if (verbose)
|
||||
fputc(c,stderr);
|
||||
if (c == IAC) { /* handle telnet commands */
|
||||
! switch (c = quick_fgetc(cin,F_READ_TIMEOUT)) {
|
||||
case WILL:
|
||||
case WONT:
|
||||
c = getc(cin);
|
||||
***************
|
||||
*** 367,373 ****
|
||||
fprintf(cout, "%c%c%c",IAC,WONT,c);
|
||||
(void) fflush(cout);
|
||||
break;
|
||||
! default:
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
--- 383,389 ----
|
||||
fprintf(cout, "%c%c%c",IAC,WONT,c);
|
||||
(void) fflush(cout);
|
||||
break;
|
||||
! default: /* Including EOF */
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
***************
|
||||
*** 380,386 ****
|
||||
--- 396,407 ----
|
||||
return (0);
|
||||
}
|
||||
lostpeer();
|
||||
+ if (errno == ETIMEDOUT) {
|
||||
+ /* Unfortunately haveto return error this way*/
|
||||
+ ERR("421 Service timed out");
|
||||
+ } else {
|
||||
ERR("421 Service not available, remote server has closed connection");
|
||||
+ }
|
||||
code = 421;
|
||||
return(4);
|
||||
}
|
||||
***************
|
||||
*** 464,470 ****
|
||||
old formula VLINKS uses #defines. */
|
||||
#endif
|
||||
int
|
||||
! recvrequest(char *cmd, char *local, char *remote, char *mode)
|
||||
{
|
||||
FILE *fout, *din = 0, *mypopen();
|
||||
int (*closefunc)(), mypclose(), fclose();
|
||||
--- 485,491 ----
|
||||
old formula VLINKS uses #defines. */
|
||||
#endif
|
||||
int
|
||||
! recvrequest(char *cmd, char *local, char *remote, char *rr_mode)
|
||||
{
|
||||
FILE *fout, *din = 0, *mypopen();
|
||||
int (*closefunc)(), mypclose(), fclose();
|
||||
***************
|
||||
*** 618,624 ****
|
||||
closefunc = mypclose;
|
||||
}
|
||||
else {
|
||||
! fout = fopen(local, mode);
|
||||
if (fout == NULL) {
|
||||
ERRSYS("%s%s: %s",localerrst);
|
||||
goto abort;
|
||||
--- 639,645 ----
|
||||
closefunc = mypclose;
|
||||
}
|
||||
else {
|
||||
! fout = fopen(local, rr_mode);
|
||||
if (fout == NULL) {
|
||||
ERRSYS("%s%s: %s",localerrst);
|
||||
goto abort;
|
||||
***************
|
||||
*** 631,637 ****
|
||||
case TYPE_I:
|
||||
case TYPE_L:
|
||||
errno = d = 0;
|
||||
! while ((c = read(fileno(din), buf, sizeof (buf))) > 0) {
|
||||
if ((d = write(fileno(fout), buf, c)) < 0)
|
||||
break;
|
||||
bytes += c;
|
||||
--- 652,658 ----
|
||||
case TYPE_I:
|
||||
case TYPE_L:
|
||||
errno = d = 0;
|
||||
! while ((c = quick_read(fileno(din), buf, sizeof (buf),F_READ_TIMEOUT)) > 0) {
|
||||
if ((d = write(fileno(fout), buf, c)) < 0)
|
||||
break;
|
||||
bytes += c;
|
||||
***************
|
||||
*** 651,657 ****
|
||||
break;
|
||||
|
||||
case TYPE_A:
|
||||
! while ((c = getc(din)) != EOF) {
|
||||
while (c == '\r') {
|
||||
while (hash && (bytes >= hashbytes)) {
|
||||
(void) putchar('#');
|
||||
--- 672,678 ----
|
||||
break;
|
||||
|
||||
case TYPE_A:
|
||||
! while ((c = quick_fgetc(din,F_READ_TIMEOUT)) != EOF) {
|
||||
while (c == '\r') {
|
||||
while (hash && (bytes >= hashbytes)) {
|
||||
(void) putchar('#');
|
||||
***************
|
||||
*** 659,665 ****
|
||||
hashbytes += sizeof (buf);
|
||||
}
|
||||
bytes++;
|
||||
! if ((c = getc(din)) != '\n' || tcrflag) {
|
||||
if (ferror (fout))
|
||||
break;
|
||||
(void) putc ('\r', fout);
|
||||
--- 680,687 ----
|
||||
hashbytes += sizeof (buf);
|
||||
}
|
||||
bytes++;
|
||||
! if ((c = quick_fgetc(din, F_READ_TIMEOUT))
|
||||
! != '\n' || tcrflag) {
|
||||
if (ferror (fout))
|
||||
break;
|
||||
(void) putc ('\r', fout);
|
||||
***************
|
||||
*** 764,770 ****
|
||||
lostpeer();
|
||||
}
|
||||
if (din && FD_ISSET(fileno(din), &mask)) {
|
||||
! while ((c = read(fileno(din), buf, sizeof (buf))) > 0)
|
||||
;
|
||||
}
|
||||
if ((c = getreply(0)) == ERROR && code == 552) { /* needed for nic style abort */
|
||||
--- 786,792 ----
|
||||
lostpeer();
|
||||
}
|
||||
if (din && FD_ISSET(fileno(din), &mask)) {
|
||||
! while ((c = quick_read(fileno(din), buf, sizeof (buf),F_READ_TIMEOUT)) > 0)
|
||||
;
|
||||
}
|
||||
if ((c = getreply(0)) == ERROR && code == 552) { /* needed for nic style abort */
|
||||
***************
|
||||
*** 798,804 ****
|
||||
int sendport = -1;
|
||||
|
||||
/* Returns: 1 failure to socket !! Can leave socket open on failure */
|
||||
! int
|
||||
initconn()
|
||||
{
|
||||
register char *p, *a;
|
||||
--- 820,826 ----
|
||||
int sendport = -1;
|
||||
|
||||
/* Returns: 1 failure to socket !! Can leave socket open on failure */
|
||||
! static int
|
||||
initconn()
|
||||
{
|
||||
register char *p, *a;
|
||||
***************
|
||||
*** 863,870 ****
|
||||
}
|
||||
|
||||
FILE *
|
||||
! dataconn(mode)
|
||||
! char *mode;
|
||||
{
|
||||
struct sockaddr_in from;
|
||||
int s, fromlen = sizeof (from);
|
||||
--- 885,891 ----
|
||||
}
|
||||
|
||||
FILE *
|
||||
! dataconn(char *dc_mode)
|
||||
{
|
||||
struct sockaddr_in from;
|
||||
int s, fromlen = sizeof (from);
|
||||
***************
|
||||
*** 877,883 ****
|
||||
}
|
||||
(void) close(data);
|
||||
data = s;
|
||||
! return (fdopen(data, mode));
|
||||
}
|
||||
|
||||
void
|
||||
--- 898,904 ----
|
||||
}
|
||||
(void) close(data);
|
||||
data = s;
|
||||
! return (fdopen(data, dc_mode));
|
||||
}
|
||||
|
||||
void
|
||||
***************
|
||||
*** 923,930 ****
|
||||
}
|
||||
|
||||
void
|
||||
! pswitch(flag)
|
||||
! int flag;
|
||||
{
|
||||
extern int proxy, abrtflag;
|
||||
SIGNAL_RET_TYPE (*oldintr)();
|
||||
--- 944,950 ----
|
||||
}
|
||||
|
||||
void
|
||||
! pswitch(int flag)
|
||||
{
|
||||
extern int proxy, abrtflag;
|
||||
SIGNAL_RET_TYPE (*oldintr)();
|
||||
diff -b -r -c -N 10Mar94.all/user/vcache/ruserpass.c 10Mar94+/user/vcache/ruserpass.c
|
||||
*** 10Mar94.all/user/vcache/ruserpass.c Fri Mar 11 05:31:24 1994
|
||||
--- 10Mar94+/user/vcache/ruserpass.c Mon Apr 18 21:18:44 1994
|
||||
***************
|
||||
*** 79,86 ****
|
||||
};
|
||||
|
||||
int
|
||||
! ruserpass(host, aname, apass, aacct)
|
||||
! char *host, **aname, **apass, **aacct;
|
||||
{
|
||||
char *hdir, buf[BUFSIZ], *tmp;
|
||||
char myname[MAXHOSTNAMELEN], *mydomain;
|
||||
--- 79,85 ----
|
||||
};
|
||||
|
||||
int
|
||||
! ruserpass(char *host, char **aname, char **apass, char **aacct)
|
||||
{
|
||||
char *hdir, buf[BUFSIZ], *tmp;
|
||||
char myname[MAXHOSTNAMELEN], *mydomain;
|
||||
diff -b -r -c -N 10Mar94.all/user/vcache/vcache.c 10Mar94+/user/vcache/vcache.c
|
||||
*** 10Mar94.all/user/vcache/vcache.c Tue Apr 26 15:37:39 1994
|
||||
--- 10Mar94+/user/vcache/vcache.c Mon Apr 25 19:47:25 1994
|
||||
***************
|
||||
*** 213,230 ****
|
||||
}
|
||||
}
|
||||
|
||||
- /* Return PFAILURE or PSUCCESS. Displays a message if cache_verbose is set. */
|
||||
- /* This function deliberately leaks memory. That's ok, since VCACHE will exit
|
||||
- quickly, so it would be a waste of time to explicitly free the memory. */
|
||||
static int
|
||||
prospero_contents_get(VLINK vl, char *local)
|
||||
{
|
||||
! PATTRIB at;
|
||||
FILE *local_file = NULL; /* file pointer for local destination */
|
||||
int retval = PSUCCESS; /* return from function */
|
||||
int need_newline = 0; /* set to 1 if data didn't end with a newline
|
||||
*/
|
||||
-
|
||||
/* Seek multiple instances of the attribute. */
|
||||
|
||||
for (at = pget_at(vl,"CONTENTS"); at; at = at->next) {
|
||||
--- 213,226 ----
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
prospero_contents_get(VLINK vl, char *local)
|
||||
{
|
||||
! PATTRIB at = NULL;
|
||||
FILE *local_file = NULL; /* file pointer for local destination */
|
||||
int retval = PSUCCESS; /* return from function */
|
||||
int need_newline = 0; /* set to 1 if data didn't end with a newline
|
||||
*/
|
||||
/* Seek multiple instances of the attribute. */
|
||||
|
||||
for (at = pget_at(vl,"CONTENTS"); at; at = at->next) {
|
||||
***************
|
||||
*** 240,246 ****
|
||||
if (local_file == NULL) {
|
||||
ERRSYS ( "vcache: Couldn't create the local file %s: %s",
|
||||
local);
|
||||
! return PFAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
--- 236,242 ----
|
||||
if (local_file == NULL) {
|
||||
ERRSYS ( "vcache: Couldn't create the local file %s: %s",
|
||||
local);
|
||||
! RETURN(PFAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
***************
|
||||
*** 264,272 ****
|
||||
}
|
||||
if (!local_file) {
|
||||
ERR("vcache: Couldn't get remote object's CONTENTS attribute.%s");
|
||||
! return PFAILURE;
|
||||
}
|
||||
if (ferror(local_file)) retval = PFAILURE;
|
||||
! return retval;
|
||||
}
|
||||
|
||||
--- 260,271 ----
|
||||
}
|
||||
if (!local_file) {
|
||||
ERR("vcache: Couldn't get remote object's CONTENTS attribute.%s");
|
||||
! RETURN(PFAILURE);
|
||||
}
|
||||
if (ferror(local_file)) retval = PFAILURE;
|
||||
! cleanup:
|
||||
! if (local_file) { if (fclose(local_file)) { retval = PFAILURE; } }
|
||||
! if (at) atfree(at);
|
||||
! return(retval);
|
||||
}
|
||||
|
||||
424
prospero/patches/done/pfs_threads.h
Normal file
424
prospero/patches/done/pfs_threads.h
Normal file
@@ -0,0 +1,424 @@
|
||||
/*
|
||||
* Copyright (c) 1993-1994 by the University of Southern California
|
||||
*
|
||||
* For copying and distribution information, please see the file
|
||||
* <usc-license.h>.
|
||||
*/
|
||||
|
||||
#include <usc-license.h>
|
||||
|
||||
/* This is the Prospero interface to threads. This threads package
|
||||
is currently used exclusively by the Prospero server when it is operating in
|
||||
multi-threaded mode.
|
||||
|
||||
At the moment, this stuff is experimental. It will only be tested on the
|
||||
server side, not on the client.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The interface to the Prospero server's use of threads is fully defined in
|
||||
* this file. That means that as long as you provide the external interface
|
||||
* herein defined, you're OK. */
|
||||
|
||||
/* This interface does not currently attempt to handle issues of cancelling
|
||||
* threads, although that will be a later extension.
|
||||
*/
|
||||
/* Every thread (on the server) has an active RREQ associated with it. Every
|
||||
* active RREQ has a live thread associated with it. RREQs get moved off of
|
||||
* the queue of items to be processed to the list of items in progress when an
|
||||
* available thread is there for them. When a thread is available,
|
||||
* ardp_accept() is called.
|
||||
*/
|
||||
|
||||
#ifndef PFS_THREADS_H
|
||||
#define PFS_THREADS_H
|
||||
|
||||
|
||||
/* #define P_MAX_NUM_THREADS here if you want any threads, and PFS_THREADS. */
|
||||
#define PFS_THREADS /* Part of the external interface. */
|
||||
|
||||
#ifdef PFS_THREADS
|
||||
#define P_MAX_NUM_THREADS 61 /* enough for now - i.e. threads 0-6*/
|
||||
/* Also change in dirsrv.c */
|
||||
#define PFS_THREADS_HAVE_SAFE_MALLOC /* Version */
|
||||
/* Define which PFS_THREADS package you have, options supported currently
|
||||
include PFS_THREADS_SOLARIS or PFS_THREADS_FLORIDA - note NONE
|
||||
of these must be defined if PFS_THREADS is undefined*/
|
||||
#define PFS_THREADS_SOLARIS
|
||||
#endif
|
||||
|
||||
#include <pfs_utils.h> /* assert */
|
||||
|
||||
/* To port to a new threads package
|
||||
- pick an identifer (e.g. PFS_THREADS_DCE).
|
||||
-- Note PFS_THREADS_POSIX is reservered for post-balloting implementation
|
||||
-- Tell prospero-developers@isi.edu which you are using.
|
||||
- Grep through all of the source for instances of PFS_THREADS_
|
||||
-- Editing these is documented where they apply
|
||||
-- This will include lib/ardp/p_th_self_num server/dirsrv
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PFS_THREADS_FLORIDA
|
||||
/* pthreads/pthread.h is the include file from the PTHREADS distribution.
|
||||
It prototypes all of the functions and interfaces whose names start with
|
||||
pthread_.
|
||||
*/
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#ifdef PFS_THREADS_SOLARIS
|
||||
/* Make sure we get our signal.h with _POSIX_C_SOURCE before thread.h
|
||||
includes sys/signal.h */
|
||||
#include <posix_signal.h>
|
||||
/* Thread.h prototypes most functions starting thr_ */
|
||||
#include <thread.h>
|
||||
#endif
|
||||
|
||||
#ifdef PFS_THREADS
|
||||
/* Yield a unique integer between 0 and P_MAX_NUM_THREADS - 1 for the current
|
||||
thread. Hopefully this function will go away eventually as the server's
|
||||
internal structure changes in a way that a reference to the current thread
|
||||
is passed around to all subfunctions. But maybe not, too.
|
||||
This is implemented using the per-thread key mechanisms. */
|
||||
extern void p_th_allocate_self_num(void); /* external; must be called by thread
|
||||
after startup. */
|
||||
extern void p_th_deallocate_self_num(void); /* external; must be called by
|
||||
thread before exit. */
|
||||
#endif /*PFS_THREADS*/
|
||||
|
||||
#ifdef PFS_THREADS
|
||||
extern int p__th_self_num(void); /* not external interface. */
|
||||
#else
|
||||
#define p__th_self_num() 0
|
||||
#endif
|
||||
|
||||
/* We don't include a trailing ; at the end of our declarations and definitions
|
||||
because a ; by itself in a declarations list is treated by C as a statement,
|
||||
not as an empty declaration. This means that the AUTOSTAT declaration has to
|
||||
be the last one. */
|
||||
|
||||
|
||||
/* This declares an automatic variable name VARNAME of type char **. *VARNAME
|
||||
will be a reference to a persistent per-thread static variable of type char
|
||||
*, with function scope. Note that *varname will be initially NULL, but may
|
||||
expand with time. Part of the external interface.*/
|
||||
#ifdef PFS_THREADS
|
||||
#define AUTOSTAT_CHARPP(VARNAME) \
|
||||
static char *(VARNAME##_target[P_MAX_NUM_THREADS]); /* NULL by default. */\
|
||||
char **VARNAME = (VARNAME##_target + p__th_self_num())
|
||||
#else
|
||||
#define AUTOSTAT_CHARPP(VARNAME) \
|
||||
static char *VARNAME##_target = NULL; \
|
||||
char **VARNAME = &VARNAME##_target
|
||||
#endif
|
||||
|
||||
|
||||
/* ditto, for int* . Part of the external interface. */
|
||||
#ifdef PFS_THREADS
|
||||
#define AUTOSTAT_INTP(VARNAME) \
|
||||
static int (VARNAME##_target[P_MAX_NUM_THREADS]); /* automatically 0 */\
|
||||
int *VARNAME = (VARNAME##_target + p__th_self_num())
|
||||
#else
|
||||
#define AUTOSTAT_INTP(VARNAME) \
|
||||
static int VARNAME##_target = 0; \
|
||||
int *VARNAME = &VARNAME##_target
|
||||
#endif
|
||||
|
||||
#ifdef PFS_THREADS
|
||||
#define AUTOSTATIC_VAR_INITIALIZED(TYPE,VARNAME,INITIALIZER) \
|
||||
static TYPE (VARNAME##_target[P_MAX_NUM_THREADS]); /* automatically 0 */\
|
||||
TYPE *VARNAME = (VARNAME##_target + p__th_self_num())
|
||||
#else
|
||||
#define AUTOSTATIC_VAR_INITIALIZED(VARNAME) \
|
||||
static TYPE VARNAME##_target = 0; \
|
||||
TYPE *VARNAME = &VARNAME##_target
|
||||
#endif
|
||||
|
||||
|
||||
/* Possible alternative interface for a common case. I'm experimenting with
|
||||
it. Experimental part of external interface. */
|
||||
#if 1
|
||||
#define SCRATCHBUF_CHARPP_DEF(VARNAME) AUTOSTAT_CHARPP(VARNAME)
|
||||
/* Set using *VARNAME = or passing VARNAME as a pointer to the target. */
|
||||
#define SCRATCHBUF_CHARPP_CLEANUP(VARNAME)
|
||||
|
||||
#else
|
||||
/* This version of the interface will always allocate a new buffer upon
|
||||
entry. It has the sole advantage that it does not leave static buffers
|
||||
around. It has disadvantages too: presumably the many calls to malloc()
|
||||
will not be an efficient way of using the processor. */
|
||||
/* A good optimizing compiler should clean up the following (I hope). */
|
||||
#define SCRATCHBUF_CHARPP_DEF(VARNAME) \
|
||||
char * VARNAME##_target = NULL; \
|
||||
char **VARNAME = &VARNAME##_target
|
||||
|
||||
/* Set using *VARNAME = or passing VARNAME as a pointer to the target. */
|
||||
#define SCRATCHBUF_CHARPP_CLEANUP(VARNAME) do { \
|
||||
stfree(*VARNAME); \
|
||||
*VARNAME = NULL; \
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* The following abstraction is used for statics (per-file externs) and
|
||||
real externs. */
|
||||
|
||||
/* Externs need separate declarations and data definitions. */
|
||||
/* Each extern will need one of these after the declaration, to keep the old
|
||||
stuff working. */
|
||||
#ifdef PFS_THREADS
|
||||
#define EXTERN_LONG_DECL(VARNAME) \
|
||||
extern long p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define EXTERN_LONG_DEF(VARNAME) \
|
||||
long p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define PERFILE_STATIC_LONG_DEF(VARNAME) \
|
||||
static long p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define EXTERN_INT_DECL(VARNAME) \
|
||||
extern int p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define EXTERN_INT_DEF(VARNAME) \
|
||||
int p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define PERFILE_STATIC_INT_DEF(VARNAME) \
|
||||
static int p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define EXTERN_CHARP_DECL(VARNAME) \
|
||||
extern char * p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define EXTERN_CHARP_DEF(VARNAME) \
|
||||
char * p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define PERFILE_STATIC_CHARP_DEF(VARNAME) \
|
||||
static char * p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define EXTERN_TYPEP_DECL(TYPE,VARNAME) \
|
||||
extern TYPE p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#define EXTERN_TYPEP_DEF(TYPE,VARNAME) \
|
||||
TYPE p_th_ar##VARNAME[P_MAX_NUM_THREADS]
|
||||
#else
|
||||
#define EXTERN_LONG_DECL(VARNAME) \
|
||||
extern long p_th_ar##VARNAME[1]
|
||||
#define EXTERN_LONG_DEF(VARNAME) \
|
||||
long p_th_ar##VARNAME[1]
|
||||
#define PERFILE_STATIC_LONG_DEF(VARNAME) \
|
||||
static long p_th_ar##VARNAME[1]
|
||||
#define EXTERN_INT_DECL(VARNAME) \
|
||||
extern int p_th_ar##VARNAME[1]
|
||||
#define EXTERN_INT_DEF(VARNAME) \
|
||||
int p_th_ar##VARNAME[1]
|
||||
#define PERFILE_STATIC_INT_DEF(VARNAME) \
|
||||
static int p_th_ar##VARNAME[1]
|
||||
#define EXTERN_CHARP_DECL(VARNAME) \
|
||||
extern char * p_th_ar##VARNAME[1]
|
||||
#define EXTERN_CHARP_DEF(VARNAME) \
|
||||
char * p_th_ar##VARNAME[1]
|
||||
#define PERFILE_STATIC_CHARP_DEF(VARNAME) \
|
||||
static char * p_th_ar##VARNAME[1]
|
||||
#define EXTERN_TYPEP_DECL(VARNAME) \
|
||||
extern TYPE p_th_ar##VARNAME[1]
|
||||
#define EXTERN_TYPEP_DEF(VARNAME) \
|
||||
TYPE p_th_ar##VARNAME[1]
|
||||
#endif
|
||||
/* In any case, follow definitions with a:
|
||||
#define VARNAME p_th_arVARNAME[p__th_self_num()] */
|
||||
|
||||
|
||||
#if 0 /* first attempt */
|
||||
/* Externs need separate declarations and data definitions. */
|
||||
#define EXTERN_INTP_DECL(VARNAMEP) extern int *VARNAMEP
|
||||
/* Each extern will need one of these after the declaration, to keep the old
|
||||
stuff working. */
|
||||
/* #define VARNAME (*VARNAMEP) */
|
||||
|
||||
/* Definition. */
|
||||
#define EXTERN_INTP_DEF(VARNAMEP) int *VARNAMEP
|
||||
#endif
|
||||
|
||||
/* Mutexes,implemented on top of the pthreads package. */
|
||||
/* p_th_mutex is an exported data type, used when we mutex functions or
|
||||
collections of functions. See lib/ardp/ptalloc.c for an example of this.
|
||||
*/
|
||||
/*
|
||||
Do so in init code, to keep
|
||||
from depending on ONCE implementation. Again, this interface is only
|
||||
called directly by Prospero and ARDP code when a set of functions need to be
|
||||
mutexed; otherwise, the *_MUTEXED_* variable declaration and definition
|
||||
interfaces below are used. */
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define zz(a) assert((a) == 0)
|
||||
#else
|
||||
#define zz(a) a
|
||||
#endif
|
||||
|
||||
#if defined(PFS_THREADS) && !defined(NDEBUG)
|
||||
#define DIAGMUTEX(MX1,MX2) if (p_th_mutex_islocked(&p_th_mutex##MX1 )) { printf(mutex_locked_msg,MX2); }
|
||||
extern char mutex_locked_msg[];
|
||||
#else
|
||||
#define DIAGMUTEX(MX1,MX2) do { } while(0)
|
||||
#endif
|
||||
|
||||
#ifdef PFS_THREADS_FLORIDA
|
||||
#typedef pthread_mutex_t p_th_mutex;
|
||||
#define p_th_mutex_init(MUTEX) \
|
||||
pthread_mutex_init(&(MUTEX), (pthread_mutexattr_t *) NULL)
|
||||
#define p_th_mutex_lock(MUTEX) { pthread_mutex_lock(&(MUTEX)) }
|
||||
#define p_th_mutex_unlock(MUTEX) pthread_mutex_unlock(&(MUTEX))
|
||||
#define p_th_mutex_islocked(MUTEX) (pthread_mutex_trylock(&(MUTEX)) == -1)
|
||||
#define p_th_mutex_trylock(MUTEX) \
|
||||
( (p_th_mutex_trylock(&(MUTEX)) != -1) \
|
||||
? p_th_mutex_lock(MUTEX) \
|
||||
: TRUE )
|
||||
#endif /*PFS_THREADS_FLORIDA*/
|
||||
|
||||
#ifdef PFS_THREADS_SOLARIS
|
||||
typedef mutex_t p_th_mutex;
|
||||
#define p_th_mutex_init(MUTEX) zz(mutex_init(&(MUTEX), USYNC_THREAD, NULL))
|
||||
#define p_th_mutex_lock(MUTEX) zz(mutex_lock(&(MUTEX)))
|
||||
#define p_th_mutex_unlock(MUTEX) zz(mutex_unlock(&(MUTEX)))
|
||||
extern int p_th_mutex_islocked(mutex_t *mp);
|
||||
#define p_th_mutex_trylock(MUTEX) (mutex_trylock(&(MUTEX)))
|
||||
#endif /*PFS_THREADS_SOLARIS*/
|
||||
|
||||
#ifndef PFS_THREADS
|
||||
#define p_th_mutex_init(MUTEX) do { } while(0)
|
||||
#define p_th_mutex_lock(MUTEX) do { } while(0)
|
||||
#define p_th_mutex_unlock(MUTEX) do { } while(0)
|
||||
/* Used only in ardp_accept() */
|
||||
#define p_th_mutex_islocked(MUTEX) 0
|
||||
#define p_th_mutex_trylock(MUTEX) 0
|
||||
#endif /*!PFS_THREADS*/
|
||||
|
||||
|
||||
/* Handling of global shared variables (e.g., ardp_runQ) */
|
||||
/* Mutex initialized in ardp_mutexes.c (ardp_init_mutexes()). */
|
||||
/* Variable defined and declared as mutexed. */
|
||||
#ifdef PFS_THREADS
|
||||
#define EXTERN_MUTEX_DECL(VARNAME) \
|
||||
extern p_th_mutex p_th_mutex##VARNAME
|
||||
#define EXTERN_MUTEX_DEF(VARNAME) \
|
||||
p_th_mutex p_th_mutex##VARNAME
|
||||
|
||||
/* Initialize the mutex (in ardp_init_mutexes(), pfs_init_mutexes(),
|
||||
dirsrv_init_mutexes()) */
|
||||
#define EXTERN_MUTEXED_INIT_MUTEX(VARNAME) \
|
||||
p_th_mutex_init(p_th_mutex##VARNAME)
|
||||
#else
|
||||
/* No-ops if not threaded. */
|
||||
#define EXTERN_MUTEX_DECL(VARNAME)
|
||||
#define EXTERN_MUTEX_DEF(VARNAME)
|
||||
#define EXTERN_MUTEXED_INIT_MUTEX(VARNAME) do {} while(0) /* no-op */
|
||||
#endif
|
||||
|
||||
#define EXTERN_ALLOC_DECL(VARNAME) \
|
||||
EXTERN_MUTEX_DECL(VARNAME)
|
||||
#define EXTERN_MUTEXED_DECL(TYPE,VARNAME) \
|
||||
EXTERN_MUTEX_DECL(VARNAME); \
|
||||
extern TYPE VARNAME
|
||||
#define EXTERN_MUTEXED_DEF(TYPE,VARNAME) \
|
||||
EXTERN_MUTEX_DEF(VARNAME); \
|
||||
TYPE VARNAME
|
||||
#define EXTERN_MUTEXED_DEF_INITIALIZER(TYPE,VARNAME,INITIALIZER) \
|
||||
EXTERN_MUTEX_DEF(VARNAME); \
|
||||
TYPE VARNAME = (INITIALIZER)
|
||||
|
||||
/* Lock and unlock a mutexed external variable. */
|
||||
/* In order to avoid potential deadlock situations, all variables must be
|
||||
locked in alphabetical order. */
|
||||
|
||||
#ifdef PFS_THREADS
|
||||
#define EXTERN_MUTEXED_LOCK(VARNAME) p_th_mutex_lock(p_th_mutex##VARNAME)
|
||||
#define EXTERN_MUTEXED_UNLOCK(VARNAME) p_th_mutex_unlock(p_th_mutex##VARNAME)
|
||||
#else
|
||||
#define EXTERN_MUTEXED_LOCK(VARNAME) do {} while (0)
|
||||
#define EXTERN_MUTEXED_UNLOCK(VARNAME) do {} while (0)
|
||||
#endif
|
||||
|
||||
/* This is found in assertions inside functions that expect to be called only
|
||||
when they are running as the 'master' thread in Prospero. */
|
||||
/* The master thread is the one that is started off. When we're
|
||||
single-threaded, that's the master. */
|
||||
/* This is used entirely in assertions. */
|
||||
#define P_IS_THIS_THREAD_MASTER() (p__th_self_num() == 0)
|
||||
|
||||
|
||||
#ifdef PFS_THREADS_FLORIDA
|
||||
/* Note that under the Draft 7 standard, pthread_detach
|
||||
takes a pthread_t, whereas under Draft 6, it takes a pointer to
|
||||
a pthread_t. This implementation uses Draft 6. */
|
||||
#define p_th_t pthread_t
|
||||
#define p_th_create_detached(NEWTHREAD,FUNC,ARG) ( \
|
||||
pthread_create(&NEWTHREAD, (pthread_attr_t *) NULL, \
|
||||
(pthread_funct_t) FUNC, (any_t) ARG) \
|
||||
: pthread_detach(&NEWTHREAD) \
|
||||
)
|
||||
#define p_th_self pthread_self
|
||||
#define p_th_equal(a,b) pthread_equal(a,b)
|
||||
#endif
|
||||
|
||||
#ifdef PFS_THREADS_SOLARIS
|
||||
#define p_th_t thread_t
|
||||
/* caller needs to check this for errors */
|
||||
#define p_th_create_detached(NEWTHREAD,FUNC,ARG) \
|
||||
thr_create(NULL,0,(void *)FUNC,ARG,THR_DETACHED, &NEWTHREAD)
|
||||
#define p_th_self thr_self
|
||||
/* thread_t is an int so ...*/
|
||||
#define p_th_equal(a,b) (a == b)
|
||||
#endif
|
||||
|
||||
|
||||
/* Mutexed versions of everything that might possibly call malloc() and free().
|
||||
We can yank this out once we have thread-safe libraries, but that might be a
|
||||
few years off. */
|
||||
|
||||
/* Note that we have converted over all of the server code that might be
|
||||
called when multi-threaded to not call any of the printf() family of
|
||||
functions. With a thread_safe malloc() now available from FSU, that
|
||||
means we need none of these special definitions. Hooray! */
|
||||
#ifdef PFS_THREADS /* commented out */
|
||||
#if !defined(PFS_THREADS_SOLARIS) && !defined(PFS_THREADS_FLORIDA)
|
||||
#define free(P) p_th_free((P))
|
||||
#define malloc(P) p_th_malloc((P))
|
||||
extern void *p_th_malloc(unsigned size);
|
||||
#define calloc(A,B) p_th_calloc((A),(B))
|
||||
extern void *p_th_calloc(unsigned nelem, unsigned size);
|
||||
#define _filbuf(p) p_th__filbuf((p))
|
||||
#define _flsbuf(p,q) p_th__flsbuf((p),(q))
|
||||
#define fgets(a,b,c) p_th_fgets((a),(b), (c))
|
||||
extern char *p_th_fgets(char *s, int n, FILE *stream);
|
||||
#define gets(a) p_th_gets((a))
|
||||
extern char *p_th_gets(char *s);
|
||||
#define fputs(a,b) p_th_fputs((a),(b))
|
||||
extern int p_th_fputs(const char *s, FILE *stream);
|
||||
#define puts(a) p_th_puts((a))
|
||||
extern int p_th_puts(const char *s);
|
||||
#define sprintf p_th_sprintf
|
||||
extern char *p_th_sprintf();
|
||||
#define fprintf p_th_fprintf
|
||||
#define printf p_th_printf
|
||||
#define fflush(a) p_th_fflush((a))
|
||||
extern int p_th_fflush(FILE *);
|
||||
#define fgetc(a) p_th_fgetc((a))
|
||||
extern int p_th_fgetc(FILE *);
|
||||
#define fputc(a,b) p_th_fputc((a),(b))
|
||||
extern int p_th_fputc();
|
||||
#define fread(a,b,c,d) p_th_fread((a),(b),(c), (d))
|
||||
extern int p_th_fread(char *ptr, int size, int nitems, FILE*stream);
|
||||
#define fwrite(a,b,c,d) p_th_fwrite((a),(b),(c), (d))
|
||||
extern int p_th_fwrite(const char *ptr, int size, int nitems, FILE *stream);
|
||||
#define fopen(a,b) p_th_fopen((a),(b))
|
||||
extern FILE *p_th_fopen(const char *a, const char *b);
|
||||
#define fclose(a) p_th_fclose((a))
|
||||
extern int p_th_fclose(FILE *a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h> /* For FILE*/
|
||||
#ifdef PFS_THREADS
|
||||
extern FILE *locked_fopen(const char *a, const char *b);
|
||||
extern int locked_fclose_A(FILE *a, const char *filename, int readonly);
|
||||
#else
|
||||
#define locked_fopen(a,b) fopen((a),(b))
|
||||
#define locked_fclose_A(a,b,c) fclose((a))
|
||||
#endif /*PFS_THREADS*/
|
||||
extern void p__th_set_self_master();
|
||||
#endif /* PFS_THREADS_H */
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user