From 984774fba89d88cec9149a8903a6194738519420 Mon Sep 17 00:00:00 2001 From: Steven Jenkins Date: Wed, 2 Apr 2008 21:06:31 +0000 Subject: [PATCH] DEVEL15-pthreaded-ubik-20080402 LICENSE IPL10 add pthreaded ubik and various binaries (cherry picked from commit 9fbbc3f50cc6f04796a8a444bc06acc66a9c55a6) --- Makefile.in | 79 +++++++- acinclude.m4 | 8 + configure.in | 4 + doc/man-pages/pod8/buserver.pod | 15 +- doc/man-pages/pod8/ptserver.pod | 16 +- doc/man-pages/pod8/vlserver.pod | 13 +- src/budb/Makefile.in | 12 +- src/budb/database.c | 6 + src/budb/db_dump.c | 24 +++ src/budb/dbs_dump.c | 55 +++++- src/budb/globals.h | 10 +- src/budb/ol_verify.c | 3 +- src/budb/procs.c | 12 ++ src/budb/server.c | 32 +++- src/cf/osconf.m4 | 98 +++++----- src/libafsrpc/Makefile.in | 6 +- src/ptserver/Makefile.in | 53 ++++- src/ptserver/ptprocs.c | 30 ++- src/ptserver/pts.c | 4 + src/ptserver/ptserver.c | 4 + src/ptserver/ptutils.c | 56 ++++-- src/ptserver/utils.c | 4 + src/tbudb/Makefile.in | 243 +++++++++++++++++++++++ src/tptserver/Makefile.in | 416 ++++++++++++++++++++++++++++++++++++++++ src/tubik/Makefile.in | 292 ++++++++++++++++++++++++++++ src/tvlserver/Makefile.in | 285 +++++++++++++++++++++++++++ src/ubik/beacon.c | 12 +- src/ubik/disk.c | 9 +- src/ubik/phys.c | 7 + src/ubik/recovery.c | 26 +++ src/ubik/remote.c | 6 +- src/ubik/ubik.c | 85 +++++++- src/ubik/ubik.p.h | 8 + src/ubik/utst_client.c | 8 + src/ubik/utst_server.c | 20 ++ src/util/Makefile.in | 5 +- src/util/pthread_glock.c | 11 ++ src/util/pthread_glock.h | 2 + src/util/rxkstats.c | 4 +- src/vlserver/Makefile.in | 36 +++- src/vlserver/vlprocs.c | 12 ++ src/vlserver/vlserver.c | 4 + 42 files changed, 1923 insertions(+), 112 deletions(-) create mode 100644 src/tbudb/Makefile.in create mode 100644 src/tptserver/Makefile.in create mode 100644 src/tubik/Makefile.in create mode 100644 src/tvlserver/Makefile.in diff --git a/Makefile.in b/Makefile.in index ae23bb7..30258b0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,6 +15,7 @@ include @TOP_OBJDIR@/src/config/Makefile.config WITH_OBSOLETE=@WITH_OBSOLETE@ ENABLE_KERNEL_MODULE=@ENABLE_KERNEL_MODULE@ +ENABLE_PTHREADED_UBIK=@ENABLE_PTHREADED_UBIK@ # To compile AFS from scratch in the src tree run "make". # This recursively calls "make install ..." and does not depend on the @@ -187,11 +188,35 @@ auth: cmd comerr comerr des lwp rx sys rxkad audit auth_depinstall ubik: cmd comerr auth ubik_depinstall ${COMPILE_PART1} ubik ${COMPILE_PART2} +tubik: ubik libafsrpc + case ${SYS_NAME} in \ + alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*[of]bsd*|*nbsd[234]*) \ + ${COMPILE_PART1} tubik ${COMPILE_PART2} ;; \ + *_darwin_[1-6][0-9]) \ + echo Not building MT ubik for ${SYS_NAME} ;; \ + *_darwin_*) \ + ${COMPILE_PART1} tubik ${COMPILE_PART2} ;; \ + *) \ + echo Not building MT ubik for ${SYS_NAME} ;; \ + esac + ubiktests: ubik ptserver: cmd comerr ubik cmd comerr auth audit ptserver_depinstall ${COMPILE_PART1} ptserver ${COMPILE_PART2} +tptserver: cmd comerr ptserver tubik libafsrpc libafsauthent + case ${SYS_NAME} in \ + alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*[of]bsd*|*nbsd[234]*) \ + ${COMPILE_PART1} tptserver ${COMPILE_PART2} ;; \ + *_darwin_[1-6][0-9]) \ + echo Not building MT ptserver for ${SYS_NAME} ;; \ + *_darwin_*) \ + ${COMPILE_PART1} tptserver ${COMPILE_PART2} ;; \ + *) \ + echo Not building MT ptserver for ${SYS_NAME} ;; \ + esac + kauth: cmd comerr ubik cmd auth comerr ptserver audit libacl kauth_depinstall ${COMPILE_PART1} kauth ${COMPILE_PART2} @@ -238,10 +263,23 @@ tsalvaged: vol libafsrpc libafsauthent cmd util vlserver: cmd comerr vol audit vlserver_depinstall ${COMPILE_PART1} vlserver ${COMPILE_PART2} -viced: cmd comerr vlserver audit +tvlserver: cmd comerr vol audit tubik libafsrpc libafsauthent tvlserver_depinstall + case ${SYS_NAME} in \ + alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*[of]bsd*|*nbsd[234]*) \ + ${COMPILE_PART1} tvlserver ${COMPILE_PART2} ;; \ + *_darwin_[1-6][0-9]) \ + echo Not building MT tvlserver for ${SYS_NAME} ;; \ + *_darwin_*) \ + ${COMPILE_PART1} tvlserver ${COMPILE_PART2} ;; \ + *) \ + echo Not building MT tvlserver for ${SYS_NAME} ;; \ + esac + + +viced: cmd comerr vlserver tvlserver audit ${COMPILE_PART1} viced ${COMPILE_PART2} -tviced: cmd comerr viced vlserver libafsrpc libafsauthent +tviced: cmd comerr viced vlserver tvlserver libafsrpc libafsauthent case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*[of]bsd*|*nbsd[234]*) \ ${COMPILE_PART1} tviced ${COMPILE_PART2} ;; \ @@ -390,6 +428,9 @@ ubik_depinstall: pinstall comerr rxgen vlserver_depinstall: pinstall rxgen ubik_depinstall auth_depinstall ${COMPILE_PART1} vlserver ${COMPILE_DEPINSTALL} +tvlserver_depinstall: pinstall rxgen ubik_depinstall auth_depinstall + ${COMPILE_PART1} tvlserver ${COMPILE_DEPINSTALL} + auth_depinstall: pinstall comerr ${COMPILE_PART1} auth ${COMPILE_DEPINSTALL} @@ -427,11 +468,11 @@ ${DEST}/bin/dedebug: dedebug libafs_setup: config export src/config/config src/libafs/MakefileProto.${MKAFS_OSTYPE} src/libafs/Makefile ${SYS_NAME} -libafs: libafs_setup lwp_depinstall rx_depinstall vlserver_depinstall rxkad_depinstall fsint_depinstall \ +libafs: libafs_setup lwp_depinstall rx_depinstall vlserver_depinstall tvlserver_depinstall rxkad_depinstall fsint_depinstall \ libacl_depinstall afs_depinstall dir_depinstall rxstat_depinstall sys_depinstall ${COMPILE_PART1} libafs ${COMPILE_PART2} -libafs_tree: libafs_setup lwp_depinstall rx_depinstall vlserver_depinstall rxkad_depinstall fsint_depinstall \ +libafs_tree: libafs_setup lwp_depinstall rx_depinstall vlserver_depinstall tvlserver_depinstall rxkad_depinstall fsint_depinstall \ libacl_depinstall afs_depinstall dir_depinstall rxstat_depinstall sys_depinstall ${TOP_SRCDIR}/config/make_libafs_tree.pl \ -sn $(SYS_NAME) \ @@ -451,7 +492,7 @@ UKERNELDIR= \ libuafs_setup: config export src/config/config src/libuafs/MakefileProto.${MKAFS_OSTYPE} src/libuafs/Makefile ${SYS_NAME} -libuafs: libuafs_setup vlserver_depinstall rx_depinstall fsint_depinstall \ +libuafs: libuafs_setup vlserver_depinstall tvlserver_depinstall rx_depinstall fsint_depinstall \ auth_depinstall dir_depinstall libacl_depinstall rxkad_depinstall \ ubik_depinstall afs_depinstall kauth_depinstall ptserver_depinstall \ rxstat_depinstall lwp_depinstall sys_depinstall des @@ -498,6 +539,18 @@ tbutc: cmd comerr bubasics butm budb bucoord cmd butc libadmin budb: cmd comerr bubasics uss ${COMPILE_PART1} budb ${COMPILE_PART2} +tbudb: budb + case ${SYS_NAME} in \ + alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*[of]bsd*|*nbsd[234]*) \ + ${COMPILE_PART1} tbudb ${COMPILE_PART2} ;; \ + *_darwin_[1-6][0-9]) \ + echo Not building MT budb for ${SYS_NAME} ;; \ + *_darwin_*) \ + ${COMPILE_PART1} tbudb ${COMPILE_PART2} ;; \ + *) \ + echo Not building MT budb for ${SYS_NAME} ;; \ + esac + bucoord: cmd comerr bubasics budb volser ${COMPILE_PART1} bucoord ${COMPILE_PART2} @@ -589,15 +642,15 @@ jafs: libjafs jafsadm: libjafsadm -finale: project cmd comerr afsd butc tbutc @ENABLE_KERNEL_MODULE@ libuafs audit kauth log package \ - ptserver scout bu_utils ubik uss bozo vfsck volser tvolser tsalvaged \ +finale: project cmd comerr afsd butc tbutc tbudb @ENABLE_KERNEL_MODULE@ libuafs audit kauth log package \ + ptserver tptserver scout bu_utils ubik tubik uss bozo vfsck volser tvolser tsalvaged \ venus update xstat afsmonitor dauth rxdebug libafsrpc \ libafsauthent shlibafsrpc shlibafsauthent libadmin login man-pages \ platform ${COMPILE_PART1} finale ${COMPILE_PART2} -finale_nolibafs: project cmd comerr afsd butc tbutc libuafs audit kauth log package \ - ptserver scout bu_utils ubik uss bozo vfsck volser tvolser tsalvaged \ +finale_nolibafs: project cmd comerr afsd butc tbutc tbudb libuafs audit kauth log package \ + ptserver tptserver scout bu_utils ubik tubik uss bozo vfsck volser tvolser tsalvaged \ venus update xstat afsmonitor dauth rxdebug libafsrpc \ libafsauthent shlibafsrpc shlibafsauthent libadmin login man-pages \ platform @@ -645,13 +698,16 @@ clean2: -${COMPILE_PART1} rxkad ${COMPILE_CLEAN} -${COMPILE_PART1} auth ${COMPILE_CLEAN} -${COMPILE_PART1} ubik ${COMPILE_CLEAN} + -${COMPILE_PART1} tubik ${COMPILE_CLEAN} -${COMPILE_PART1} ptserver ${COMPILE_CLEAN} + -${COMPILE_PART1} tptserver ${COMPILE_CLEAN} -${COMPILE_PART1} kauth ${COMPILE_CLEAN} -${COMPILE_PART1} dauth ${COMPILE_CLEAN} -${COMPILE_PART1} libacl ${COMPILE_CLEAN} -${COMPILE_PART1} dir ${COMPILE_CLEAN} -${COMPILE_PART1} vol ${COMPILE_CLEAN} -${COMPILE_PART1} vlserver ${COMPILE_CLEAN} + -${COMPILE_PART1} tvlserver ${COMPILE_CLEAN} -${COMPILE_PART1} viced ${COMPILE_CLEAN} -${COMPILE_PART1} tviced ${COMPILE_CLEAN} -${COMPILE_PART1} volser ${COMPILE_CLEAN} @@ -683,6 +739,7 @@ clean2: -${COMPILE_PART1} butc ${COMPILE_CLEAN} -${COMPILE_PART1} tbutc ${COMPILE_CLEAN} -${COMPILE_PART1} budb ${COMPILE_CLEAN} + -${COMPILE_PART1} tbudb ${COMPILE_CLEAN} -${COMPILE_PART1} bucoord ${COMPILE_CLEAN} -${COMPILE_PART1} xstat ${COMPILE_CLEAN} -${COMPILE_PART1} afsmonitor ${COMPILE_CLEAN} @@ -736,6 +793,7 @@ distclean: clean src/bubasics/Makefile \ src/bucoord/Makefile \ src/budb/Makefile \ + src/tbudb/Makefile \ src/butc/Makefile \ src/butm/Makefile \ src/cmd/test/Makefile \ @@ -798,6 +856,7 @@ distclean: clean src/procmgmt/Makefile \ src/procmgmt/test/Makefile \ src/ptserver/Makefile \ + src/tptserver/Makefile \ src/rx/Makefile \ src/rx/bulk.example/Makefile \ src/rx/bulktest/Makefile \ @@ -823,6 +882,7 @@ distclean: clean src/tviced/Makefile \ src/tvolser/Makefile \ src/ubik/Makefile \ + src/tubik/Makefile \ src/update/Makefile \ src/usd/test/Makefile \ src/usd/Makefile \ @@ -834,6 +894,7 @@ distclean: clean src/vfsck/Makefile \ src/viced/Makefile \ src/vlserver/Makefile \ + src/tvlserver/Makefile \ src/vol/Makefile \ src/vol/test/Makefile \ src/volser/Makefile \ diff --git a/acinclude.m4 b/acinclude.m4 index c3df210..4776c3d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -93,6 +93,9 @@ AC_ARG_ENABLE(optimize-pam, AC_ARG_ENABLE(warnings, [ --enable-warnings enable compilation warnings when building with gcc (defaults to disabled)],, enable_warnings="no" ) +AC_ARG_ENABLE(pthreaded-ubik, +[ --enable-pthreaded-ubik enable installation of pthreaded ubik applications (defaults to disabled)],, enable_pthreaded_ubik="no" +) enable_login="no" @@ -1313,9 +1316,14 @@ if test "x$enable_kernel_module" = "xyes"; then ENABLE_KERNEL_MODULE=libafs fi +if test "x$enable_pthreaded_ubik" = "xyes"; then +ENABLE_PTHREADED_UBIK=yes +fi + AC_SUBST(AFS_SYSNAME) AC_SUBST(AFS_PARAM_COMMON) AC_SUBST(ENABLE_KERNEL_MODULE) +AC_SUBST(ENABLE_PTHREADED_UBIK) AC_SUBST(LIB_AFSDB) AC_SUBST(LINUX_KERNEL_PATH) AC_SUBST(HOST_CPU) diff --git a/configure.in b/configure.in index 52479f3..21b1c1b 100644 --- a/configure.in +++ b/configure.in @@ -32,6 +32,7 @@ src/bu_utils/Makefile \ src/bubasics/Makefile \ src/bucoord/Makefile \ src/budb/Makefile \ +src/tbudb/Makefile \ src/butc/Makefile \ src/butm/Makefile \ src/cmd/Makefile \ @@ -96,6 +97,7 @@ src/platform/${MKAFS_OSTYPE}/Makefile \ src/procmgmt/Makefile \ src/procmgmt/test/Makefile \ src/ptserver/Makefile \ +src/tptserver/Makefile \ src/rx/Makefile \ src/rx/bulk.example/Makefile \ src/rx/bulktest/Makefile \ @@ -121,6 +123,7 @@ src/tsm41/Makefile \ src/tviced/Makefile \ src/tvolser/Makefile \ src/ubik/Makefile \ +src/tubik/Makefile \ src/update/Makefile \ src/usd/Makefile \ src/usd/test/Makefile \ @@ -132,6 +135,7 @@ src/venus/test/Makefile \ src/vfsck/Makefile \ src/viced/Makefile \ src/vlserver/Makefile \ +src/tvlserver/Makefile \ src/vol/Makefile \ src/vol/test/Makefile \ src/volser/Makefile \ diff --git a/doc/man-pages/pod8/buserver.pod b/doc/man-pages/pod8/buserver.pod index 73e29a0..be8adce 100644 --- a/doc/man-pages/pod8/buserver.pod +++ b/doc/man-pages/pod8/buserver.pod @@ -9,8 +9,9 @@ buserver - Initializes the Backup Server B S<<< [B<-database> >] >>> S<<< [B<-cellservdb> >] >>> [B<-resetdb>] - [B<-noauth>] [B<-smallht>] [-servers >+] - [B<-enable_peer_stats>] [-enable_process_stats] [B<-help>] + [B<-noauth>] [B<-smallht>] [B<-servers> >+] + [B<-enable_peer_stats>] [B<-enable_process_stats>] [B<-rxbind>] + [B<-p> >] [B<-help>] =for html @@ -115,6 +116,16 @@ GetStatus, and so on) sent or received, aggregated over all connections to other machines. To display or otherwise access the records, use the Rx Monitoring API. +=item B<-rxbind> + +Bind the Rx socket to the primary interface only. (If not specified, the +Rx socket will listen on all interfaces.) + +=item B<-p> > + +Sets the number of server lightweight processes (LWPs or pthreads) to run. +Provide a positive integer from the range 3 to 16. The default value is 3. + =item B<-help> Prints the online help for this command. All other valid options are diff --git a/doc/man-pages/pod8/ptserver.pod b/doc/man-pages/pod8/ptserver.pod index b5214d2..228e58b 100644 --- a/doc/man-pages/pod8/ptserver.pod +++ b/doc/man-pages/pod8/ptserver.pod @@ -7,9 +7,9 @@ ptserver - Initializes the Protection Server =for html
-B S<<< [B<-database> >] >>> S<<< [B<-p> >] >>> +B S<<< [B<-database> >] >>> S<<< [B<-p> >] >>> [B<-rebuildDB>] [B<-enable_peer_stats>] [B<-enable_process_stats>] - [B<-allow-dotted-principal>] [B<-help>] + [B<-allow-dotted-principal>] [B<-rxbind>] [B<-help>] =for html
@@ -63,10 +63,11 @@ filename to which the C<.DB0> and C<.DBSYS1> extensions are appended. For example, the appropriate value for the default database files is F. -=item B<-p> > +=item B<-p> > -Sets the number of server lightweight processes (LWPs) to run. Provide a -positive integer from the range C<3> to C<16>. The default value is C<3>. +Sets the number of server lightweight processes (LWPs or pthreads) to run. +Provide a positive integer from the range C<3> to C<16>. The default +value is C<3>. =item B<-rebuildDB> @@ -99,6 +100,11 @@ user.admin PTS entry. Sites whose Kerberos realms don't have these collisions between principal names may disable this check by starting the server with this option. +=item B<-rxbind> + +Bind the Rx socket to the primary interface only. (If not specified, the +Rx socket will listen on all interfaces.) + =item B<-help> Prints the online help for this command. All other valid options are diff --git a/doc/man-pages/pod8/vlserver.pod b/doc/man-pages/pod8/vlserver.pod index 9d1e893..60978e5 100644 --- a/doc/man-pages/pod8/vlserver.pod +++ b/doc/man-pages/pod8/vlserver.pod @@ -7,7 +7,7 @@ vlserver - Initializes the Volume Location Server =for html
-B S<<< [B<-p> >] >>> [B<-nojumbo>] +B S<<< [B<-p> >] >>> [B<-nojumbo>] [B<-rxbind>] [B<-allow-dotted-principal>] [B<-enable_peer_stats>] [B<-enable_process_stats>] [B<-help>] @@ -55,10 +55,10 @@ suites. Provide the command name and all option names in full. =over 4 -=item B<-p> > +=item B<-p> > -Sets the number of server lightweight processes (LWPs) to run. Provide an -integer between C<4> and C<16>. The default is C<9>. +Sets the number of server lightweight processes (LWPs or pthreads) to run. +Provide an integer between C<3> and C<16>. The default is C<9>. =item B<-nojumbo> @@ -93,6 +93,11 @@ user.admin PTS entry. Sites whose Kerberos realms don't have these collisions between principal names may disable this check by starting the server with this option. +=item B<-rxbind> + +Bind the Rx socket to the primary interface only. (If not specified, the +Rx socket will listen on all interfaces.) + =item B<-help> Prints the online help for this command. All other valid options are diff --git a/src/budb/Makefile.in b/src/budb/Makefile.in index 4d3cbcf..f8598e9 100644 --- a/src/budb/Makefile.in +++ b/src/budb/Makefile.in @@ -117,7 +117,11 @@ ${DEST}/include/afs/budb_client.h: budb_client.h ${INSTALL} $? $@ ${DEST}/root.server/usr/afs/bin/buserver: budb_server - ${INSTALL} -f $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install buserver for ${SYS_NAME}" ; \ + else \ + ${INSTALL} -f $? $@ ; \ + fi # # Misc targets @@ -152,7 +156,11 @@ ${TOP_INCDIR}/afs/budb_client.h: budb_client.h ${INSTALL} $? $@ ${DESTDIR}${afssrvlibexecdir}/buserver: budb_server - ${INSTALL} -f $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install buserver for ${SYS_NAME}" ; \ + else \ + ${INSTALL} -f $? $@ ; \ + fi dest: \ ${DEST}/lib/afs/libbudb.a \ diff --git a/src/budb/database.c b/src/budb/database.c index 56797f6..ff1ddef 100644 --- a/src/budb/database.c +++ b/src/budb/database.c @@ -89,7 +89,9 @@ dbwrite(struct ubik_trans *ut, afs_int32 pos, void *buff, afs_int32 len) error_exit: if (((++pollCount) % 4) == 0) { /* Poll every 4 reads/writes */ +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollCount = 0; } return code; @@ -121,7 +123,9 @@ dbread(struct ubik_trans *ut, afs_int32 pos, void *buff, afs_int32 len) error_exit: if (((++pollCount) % 4) == 0) { /* Poll every 4 reads/writes */ +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollCount = 0; } return code; @@ -154,7 +158,9 @@ cdbread(struct ubik_trans *ut, int type, afs_int32 pos, void *buff, afs_int32 le error_exit: if (((++pollCount) % 4) == 0) { /* Poll every 4 reads/writes */ +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollCount = 0; } return code; diff --git a/src/budb/db_dump.c b/src/budb/db_dump.c index 4d0a11e..808c65e 100644 --- a/src/budb/db_dump.c +++ b/src/budb/db_dump.c @@ -73,13 +73,23 @@ canWrite(fid) while (dumpSyncPtr->ds_bytes > 0) { if (dumpSyncPtr->ds_readerStatus == DS_WAITING) { dumpSyncPtr->ds_readerStatus = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&dumpSyncPtr->ds_readerStatus_cond) == 0); +#else code = LWP_SignalProcess(&dumpSyncPtr->ds_readerStatus); if (code) LogError(code, "canWrite: Signal delivery failed\n"); +#endif } dumpSyncPtr->ds_writerStatus = DS_WAITING; ReleaseWriteLock(&dumpSyncPtr->ds_lock); +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_mutex_lock(&dumpSyncPtr->ds_writerStatus_mutex) == 0); + assert(pthread_cond_wait(&dumpSyncPtr->ds_writerStatus_cond, &dumpSyncPtr->ds_writerStatus_mutex) == 0); + assert(pthread_mutex_unlock(&dumpSyncPtr->ds_writerStatus_mutex) == 0); +#else LWP_WaitProcess(&dumpSyncPtr->ds_writerStatus); +#endif ObtainWriteLock(&dumpSyncPtr->ds_lock); } return (1); @@ -103,9 +113,13 @@ haveWritten(nbytes) dumpSyncPtr->ds_bytes += nbytes; if (dumpSyncPtr->ds_readerStatus == DS_WAITING) { dumpSyncPtr->ds_readerStatus = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&dumpSyncPtr->ds_readerStatus_cond) == 0); +#else code = LWP_SignalProcess(&dumpSyncPtr->ds_readerStatus); if (code) LogError(code, "haveWritten: Signal delivery failed\n"); +#endif } ReleaseWriteLock(&dumpSyncPtr->ds_lock); } @@ -127,7 +141,13 @@ doneWriting(error) LogDebug(4, "doneWriting: waiting for Reader\n"); dumpSyncPtr->ds_writerStatus = DS_WAITING; ReleaseWriteLock(&dumpSyncPtr->ds_lock); +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_mutex_lock(&dumpSyncPtr->ds_writerStatus_mutex) == 0); + assert(pthread_cond_wait(&dumpSyncPtr->ds_writerStatus_cond, &dumpSyncPtr->ds_writerStatus_mutex) == 0); + assert(pthread_mutex_unlock(&dumpSyncPtr->ds_writerStatus_mutex) == 0); +#else LWP_WaitProcess(&dumpSyncPtr->ds_writerStatus); +#endif ObtainWriteLock(&dumpSyncPtr->ds_lock); } @@ -139,9 +159,13 @@ doneWriting(error) else dumpSyncPtr->ds_writerStatus = DS_DONE; dumpSyncPtr->ds_readerStatus = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&dumpSyncPtr->ds_readerStatus_cond) == 0); +#else code = LWP_NoYieldSignal(&dumpSyncPtr->ds_readerStatus); if (code) LogError(code, "doneWriting: Signal delivery failed\n"); +#endif ReleaseWriteLock(&dumpSyncPtr->ds_lock); } diff --git a/src/budb/dbs_dump.c b/src/budb/dbs_dump.c index d9efc99..0dcd34d 100644 --- a/src/budb/dbs_dump.c +++ b/src/budb/dbs_dump.c @@ -115,7 +115,14 @@ DumpDB(call, firstcall, maxLength, charListPtr, done) charListT *charListPtr; afs_int32 *done; { +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + pthread_t dumperPid, watcherPid; + pthread_attr_t dumperPid_tattr; + pthread_attr_t watcherPid_tattr; + +#else PROCESS dumperPid, watcherPid; +#endif int readSize; afs_int32 code = 0; @@ -155,20 +162,45 @@ DumpDB(call, firstcall, maxLength, charListPtr, done) if (code) ERROR(errno); +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + /* Initialize the condition variables and the mutexes we use + * to signal and synchronize the reader and writer threads. + */ + assert(pthread_cond_init(&dumpSyncPtr->ds_readerStatus_cond, (const pthread_condattr_t *)0) == 0); + assert(pthread_cond_init(&dumpSyncPtr->ds_writerStatus_cond, (const pthread_condattr_t *)0) == 0); + assert(pthread_mutex_init(&dumpSyncPtr->ds_readerStatus_mutex, (const pthread_mutexattr_t *)0) == 0); + assert(pthread_mutex_init(&dumpSyncPtr->ds_writerStatus_mutex, (const pthread_mutexattr_t *)0) == 0); + + /* Initialize the thread attributes and launch the thread */ + + assert(pthread_attr_init(&dumperPid_tattr) == 0); + assert(pthread_attr_setdetachstate(&dumperPid_tattr, PTHREAD_CREATE_DETACHED) == 0); + assert(pthread_create(&dumperPid, &dumperPid_tattr, (void *)setupDbDump, NULL) == 0); + +#else code = LWP_CreateProcess(setupDbDump, 16384, 1, (void *)dumpSyncPtr->pipeFid[1], "Database Dumper", &dumperPid); if (code) goto error_exit; +#endif dumpSyncPtr->dumperPid = dumperPid; dumpSyncPtr->timeToLive = time(0) + DUMP_TTL_INC; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + /* Initialize the thread attributes and launch the thread */ + + assert(pthread_attr_init(&watcherPid_tattr) == 0); + assert(pthread_attr_setdetachstate(&watcherPid_tattr, PTHREAD_CREATE_DETACHED) == 0); + assert(pthread_create(&watcherPid, &watcherPid_tattr, (void *)dumpWatcher, NULL) == 0); +#else /* now create the watcher thread */ code = LWP_CreateProcess(dumpWatcher, 16384, 1, 0, "Database Dump Watchdog", &watcherPid); +#endif } else if (firstcall) ERROR(BUDB_LOCKED); @@ -185,14 +217,24 @@ DumpDB(call, firstcall, maxLength, charListPtr, done) if (dumpSyncPtr->ds_writerStatus == DS_WAITING) { LogDebug(6, "wakup writer\n"); dumpSyncPtr->ds_writerStatus = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&dumpSyncPtr->ds_writerStatus_cond) == 0); +#else code = LWP_SignalProcess(&dumpSyncPtr->ds_writerStatus); if (code) LogError(code, "BUDB_DumpDB: signal delivery failed\n"); +#endif } LogDebug(6, "wait for writer\n"); dumpSyncPtr->ds_readerStatus = DS_WAITING; ReleaseWriteLock(&dumpSyncPtr->ds_lock); +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_mutex_lock(&dumpSyncPtr->ds_readerStatus_mutex) == 0); + assert(pthread_cond_wait(&dumpSyncPtr->ds_readerStatus_cond, &dumpSyncPtr->ds_readerStatus_mutex) == 0); + assert(pthread_mutex_unlock(&dumpSyncPtr->ds_readerStatus_mutex) == 0); +#else LWP_WaitProcess(&dumpSyncPtr->ds_readerStatus); +#endif ObtainWriteLock(&dumpSyncPtr->ds_lock); } @@ -217,9 +259,13 @@ DumpDB(call, firstcall, maxLength, charListPtr, done) dumpSyncPtr->ds_bytes -= readSize; if (dumpSyncPtr->ds_writerStatus == DS_WAITING) { dumpSyncPtr->ds_writerStatus = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&dumpSyncPtr->ds_writerStatus_cond) == 0); +#else code = LWP_SignalProcess(&dumpSyncPtr->ds_writerStatus); if (code) LogError(code, "BUDB_DumpDB: signal delivery failed\n"); +#endif } error_exit: @@ -313,10 +359,13 @@ dumpWatcher(void *unused) close(dumpSyncPtr->pipeFid[0]); close(dumpSyncPtr->pipeFid[1]); - +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cancel(dumpSyncPtr->dumperPid) == 0); +#else code = LWP_DestroyProcess(dumpSyncPtr->dumperPid); if (code) LogError(code, "dumpWatcher: failed to kill dump thread\n"); +#endif if (dumpSyncPtr->ut) { code = ubik_AbortTrans(dumpSyncPtr->ut); @@ -329,7 +378,11 @@ dumpWatcher(void *unused) } /*i */ ReleaseWriteLock(&dumpSyncPtr->ds_lock); +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + sleep(5); +#else IOMGR_Sleep(5); +#endif } /*w */ exit: diff --git a/src/budb/globals.h b/src/budb/globals.h index fbca64b..4260e78 100644 --- a/src/budb/globals.h +++ b/src/budb/globals.h @@ -61,10 +61,18 @@ struct dumpSyncS { struct Lock ds_lock; /* for this struct. */ afs_int32 statusFlags; /* 0, or 1 for dump in progress */ int pipeFid[2]; /* pipe between threads */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + pthread_mutex_t ds_writerStatus_mutex; + pthread_mutex_t ds_readerStatus_mutex; + pthread_cond_t ds_writerStatus_cond; + pthread_cond_t ds_readerStatus_cond; + pthread_t dumperPid; +#else + PROCESS dumperPid; /* pid of dumper lwp */ +#endif char ds_writerStatus; char ds_readerStatus; - PROCESS dumperPid; /* pid of dumper lwp */ struct ubik_trans *ut; /* dump db transaction */ afs_int32 ds_bytes; /* no. of bytes buffered */ time_t timeToLive; /* time. After this, kill the dump */ diff --git a/src/budb/ol_verify.c b/src/budb/ol_verify.c index 741630e..0951ea8 100644 --- a/src/budb/ol_verify.c +++ b/src/budb/ol_verify.c @@ -1094,9 +1094,10 @@ verifyMapBits() /* check each entry */ for (entryIndex = 0; entryIndex < blockMap[blockIndex]->nEntries; entryIndex++) { /*f */ +#ifndef AFS_PTHREAD_ENV if ((entryIndex % 1024) == 0) IOMGR_Poll(); - +#endif bits = blockMap[blockIndex]->entries[entryIndex]; for (i = 0; i < NMAPCs; i++) diff --git a/src/budb/procs.c b/src/budb/procs.c index 2ad1be0..00ab4c8 100644 --- a/src/budb/procs.c +++ b/src/budb/procs.c @@ -110,7 +110,11 @@ AwaitInitialization() start = time(0); else if (time(0) - start > 5) return UNOQUORUM; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + sleep(1); +#else IOMGR_Sleep(1); +#endif } return 0; } @@ -200,7 +204,11 @@ InitRPC(ut, lock, this_op) Log("Waiting for quorum election\n"); if (wait < 15.0) wait *= 1.1; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + sleep((int)wait); +#else IOMGR_Sleep((int)wait); +#endif } } if (code) @@ -1469,7 +1477,11 @@ CreateDump(call, dump) } /* dump id is in use - wait a while */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + sleep(1); +#else IOMGR_Sleep(1); +#endif } /*w */ } else { /* dump id supplied (e.g. for database restore) */ diff --git a/src/budb/server.c b/src/budb/server.c index 4aae269..bd52d96 100644 --- a/src/budb/server.c +++ b/src/budb/server.c @@ -70,6 +70,10 @@ char dbDir[AFSDIR_PATH_MAX], cellConfDir[AFSDIR_PATH_MAX]; int debugging = 0; int rxBind = 0; +int lwps = 3; + +#define MINLWP 3 +#define MAXLWP 16 #define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */ afs_uint32 SHostAddrs[ADDRSPERSITE]; @@ -167,6 +171,12 @@ initializeArgHandler() cmd_AddParm(cptr, "-auditlog", CMD_SINGLE, CMD_OPTIONAL, "audit log path"); + cmd_AddParm(cptr, "-p", CMD_SINGLE, CMD_OPTIONAL, + "number of processes"); + + cmd_AddParm(cptr, "-rxbind", CMD_FLAG, CMD_OPTIONAL, + "bind the Rx socket (primary interface only)"); + } int @@ -248,6 +258,26 @@ argHandler(struct cmd_syndesc *as, void *arock) printf("Warning: auditlog %s not writable, ignored.\n", fileName); } + /* user provided the number of threads */ + if (as->parms[8].items != 0) { + lwps = atoi(as->parms[8].items->data); + if (lwps > MAXLWP) { + printf ("Warning: '-p %d' is too big; using %d instead\n", + lwps, MAXLWP); + lwps = MAXLWP; + } + if (lwps < MINLWP) { + printf ("Warning: '-p %d' is too small; using %d instead\n", + lwps, MINLWP); + lwps = MINLWP; + } + } + + /* user provided rxbind option */ + if (as->parms[9].items != 0) { + rxBind = 1; + } + return 0; } @@ -562,7 +592,7 @@ main(argc, argv) BUDB_EXIT(3); } rx_SetMinProcs(tservice, 1); - rx_SetMaxProcs(tservice, 3); + rx_SetMaxProcs(tservice, lwps); rx_SetStackSize(tservice, 10000); /* allow super users to manage RX statistics */ diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index 0161f1f..2dec1ef 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -42,7 +42,7 @@ case $AFS_SYSNAME in LEX="lex" CSTATIC="-non_shared" DBG="-g3" - MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-pthread -lpthread -lmach -lexc -lc" TXLIBS="-lcurses" XCFLAGS="-D_NO_PROTO -DOSF" @@ -53,7 +53,7 @@ case $AFS_SYSNAME in LEX="flex -l" DBG="-g3" CSTATIC="-non_shared" - MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-pthread -lpthread -lmach -lexc -lc" TXLIBS="-lcurses" XCFLAGS="-D_NO_PROTO -DOSF" @@ -65,7 +65,7 @@ case $AFS_SYSNAME in DBG="-g3" CSTATIC="-non_shared" LWP_OPTMZ="-O2" - MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-pthread -lpthread -lmach -lexc -lc" TXLIBS="-lcurses" XCFLAGS="-D_NO_PROTO -DOSF" @@ -75,7 +75,7 @@ case $AFS_SYSNAME in alpha_linux_22) KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -91,7 +91,7 @@ case $AFS_SYSNAME in CCOBJ="${CC} -fPIC" KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -107,7 +107,7 @@ case $AFS_SYSNAME in CCOBJ="${CC} -fPIC" KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -159,7 +159,7 @@ case $AFS_SYSNAME in LEX="/opt/langtools/bin/lex" LWP_OPTMZ="-O" MT_CC="/opt/ansic/bin/cc -Ae" - MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-L/opt/dce/lib -ldce" MV="/bin/mv" OPTMZ="-O" @@ -188,7 +188,7 @@ case $AFS_SYSNAME in LEX="/opt/langtools/bin/lex" LWP_OPTMZ="-O" MT_CC="$CC" - MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread" MV="/bin/mv" OPTMZ="-O" @@ -220,7 +220,7 @@ case $AFS_SYSNAME in LEX="/opt/langtools/bin/lex" LWP_OPTMZ="" MT_CC="$CC" - MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread" MV="/bin/mv" OPTMZ="-O" @@ -244,7 +244,7 @@ case $AFS_SYSNAME in *fbsd_*) LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-pthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-pipe -fPIC" @@ -257,7 +257,7 @@ case $AFS_SYSNAME in *nbsd2*|*nbsd3*|*nbsd4*) LEX="flex -l" - MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -D_REENTRANT ' + MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -D_REENTRANT ' MT_LIBS="-lpthread" # XXX -pthread soon PAM_OPTMZ=-O2 PAM_CFLAGS="-pipe -fPIC" @@ -284,7 +284,7 @@ case $AFS_SYSNAME in ia64_linux24|ia64_linux26) KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -299,7 +299,7 @@ case $AFS_SYSNAME in CCOBJ="${CC} -fPIC" KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -313,7 +313,7 @@ case $AFS_SYSNAME in ppc64_linux24) KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -327,7 +327,7 @@ case $AFS_SYSNAME in ppc64_linux26) KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -345,7 +345,7 @@ case $AFS_SYSNAME in MT_CC="gcc -pipe" KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -363,7 +363,7 @@ case $AFS_SYSNAME in MT_CC="gcc -pipe" KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" DBG=-g KERN_DBG=-g @@ -384,7 +384,7 @@ case $AFS_SYSNAME in MT_CC="gcc -pipe" KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" DBG=-g KERN_DBG=-g @@ -406,7 +406,7 @@ case $AFS_SYSNAME in MT_CC="gcc -pipe" KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" DBG=-g KERN_DBG=-g @@ -426,7 +426,7 @@ case $AFS_SYSNAME in KRB5CFLAGS="-I/usr/include/kerberosV" KRB5LIBS="-lkrb5 -lcrypto" LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-pthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-pipe -fpic" @@ -441,7 +441,7 @@ case $AFS_SYSNAME in parisc_linux24) KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -496,7 +496,7 @@ case $AFS_SYSNAME in ppc_darwin_70) AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration" LEX="lex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}' KROOT= KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers' LWP_OPTMZ="-O2" @@ -511,7 +511,7 @@ case $AFS_SYSNAME in *_darwin_80) AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation" LEX="lex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}' KROOT= KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers' KERN_OPTMZ="-Os" @@ -528,7 +528,7 @@ case $AFS_SYSNAME in *_darwin_90) AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation" LEX="lex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}' KROOT= KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers' LD="cc" @@ -546,7 +546,7 @@ case $AFS_SYSNAME in ppc_linux*) KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -563,7 +563,7 @@ case $AFS_SYSNAME in LEX="lex" LIBSYS_AIX_EXP="afsl.exp" MT_CC="xlc_r" - MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthreads" SHLIB_SUFFIX="o" TXLIBS="-lcurses" @@ -579,7 +579,7 @@ case $AFS_SYSNAME in LEX="lex" LIBSYS_AIX_EXP="afsl.exp" MT_CC="xlc_r" - MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthreads" SHLIB_SUFFIX="o" TXLIBS="-lcurses" @@ -594,7 +594,7 @@ case $AFS_SYSNAME in LEX="lex" LIBSYS_AIX_EXP="afsl.exp" MT_CC="xlc_r" - MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthreads" SHLIB_SUFFIX="o" TXLIBS="-lcurses" @@ -609,7 +609,7 @@ case $AFS_SYSNAME in LEX="lex" LIBSYS_AIX_EXP="afsl.exp" MT_CC="xlc_r" - MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthreads" SHLIB_SUFFIX="o" TXLIBS="-lcurses" @@ -626,7 +626,7 @@ case $AFS_SYSNAME in KERN_OPTMZ=-O2 LEX="flex -l" MT_CC="$CC" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -646,7 +646,7 @@ case $AFS_SYSNAME in KERN_OPTMZ=-O2 LEX="flex -l" MT_CC="$CC" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -665,7 +665,7 @@ case $AFS_SYSNAME in KERN_OPTMZ=-O2 LEX="flex -l" MT_CC="$CC" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -683,7 +683,7 @@ case $AFS_SYSNAME in AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a" FSINCLUDES="-I/usr/include/sys/fs" LEX="lex" - MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread" TXLIBS="-lcurses" XCFLAGS64="-64 -mips3" @@ -698,7 +698,7 @@ case $AFS_SYSNAME in AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a" FSINCLUDES="-I/usr/include/sys/fs" LEX="lex" - MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread" TXLIBS="-lcurses" XCFLAGS64="-D_BSD_COMPAT -64 -mips3" @@ -712,7 +712,7 @@ case $AFS_SYSNAME in AFSD_LIBS="/usr/lib32/libdwarf.a /usr/lib32/libelf.a" FSINCLUDES="-I/usr/include/sys/fs" LEX="lex" - MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread" TXLIBS="-lcurses" XCFLAGS64="-D_BSD_COMPAT -64 -mips3" @@ -730,7 +730,7 @@ case $AFS_SYSNAME in LD="/usr/bin/ld" LEX="lex" MT_CC="/usr/bin/cc" - MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread" TXLIBS="-lcurses" XCFLAGS64="-64 -mips3" @@ -743,7 +743,7 @@ case $AFS_SYSNAME in sparc*_linux*) KERN_OPTMZ=-O2 LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' MT_LIBS="-lpthread" PAM_OPTMZ=-O2 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC" @@ -776,7 +776,7 @@ case $AFS_SYSNAME in CCOBJ="/opt/SUNWspro/bin/cc" LEX="lex" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" SHLIB_CFLAGS="-KPIC" TXLIBS="-lcurses" @@ -794,7 +794,7 @@ case $AFS_SYSNAME in CCOBJ="/opt/SUNWspro/bin/cc" LEX="lex" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -816,7 +816,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -838,7 +838,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -860,7 +860,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -882,7 +882,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -904,7 +904,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -926,7 +926,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -947,7 +947,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -968,7 +968,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -989,7 +989,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" @@ -1010,7 +1010,7 @@ case $AFS_SYSNAME in LEX="lex" LD="/usr/ccs/bin/ld" MT_CC="/opt/SUNWspro/bin/cc" - MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}' MT_LIBS="-lpthread -lsocket" PAM_CFLAGS="-KPIC" PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" diff --git a/src/libafsrpc/Makefile.in b/src/libafsrpc/Makefile.in index c74f4cf..e1724bb 100644 --- a/src/libafsrpc/Makefile.in +++ b/src/libafsrpc/Makefile.in @@ -112,7 +112,8 @@ DESOBJS =\ CRYPT_OBJ = crypt.o LWPOBJS = \ - fasttime.o + fasttime.o \ + lock.o LIBOBJS = \ ${RXOBJS} \ @@ -351,6 +352,9 @@ base64.o: ${UTIL}/base64.c fasttime.o: ${LWP}/fasttime.c ${CCRULE} ${LWP}/fasttime.c +lock.o: ${LWP}/lock.c + ${CCRULE} ${LWP}/lock.c + syscall.o: ${SYS}/syscall.s case "$(SYS_NAME)" in \ sun4x_5* | sunx86_5*) \ diff --git a/src/ptserver/Makefile.in b/src/ptserver/Makefile.in index 4f9935e..7350280 100644 --- a/src/ptserver/Makefile.in +++ b/src/ptserver/Makefile.in @@ -177,18 +177,35 @@ install: \ ${DESTDIR}${includedir}/afs/ptserver.h ${DEST}/root.server/usr/afs/bin/ptserver: ptserver - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install ptserver for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DEST}/bin/pts ${DEST}/root.server/usr/afs/bin/pts: pts - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install pts for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DEST}/root.server/usr/afs/bin/pt_util: pt_util - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install pt_util for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DEST}/lib/afs/libprot.a: libprot.a ${INSTALL} $? $@ ${DEST}/etc/prdb_check: db_verify + if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install db_verify for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${INSTALL} -f $? $@ ${DEST}/include/afs/prclient.h: ptclient.h @@ -228,19 +245,39 @@ clean: include ../config/Makefile.version ${DESTDIR}${afssrvlibexecdir}/ptserver: ptserver - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install ptserver for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DESTDIR}${afssrvbindir}/pts: pts - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install pts for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DESTDIR}${bindir}/pts: pts - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install pts for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DESTDIR}${afssrvsbindir}/pt_util: pt_util - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install pt_util for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DESTDIR}${afssrvsbindir}/prdb_check: db_verify - ${INSTALL} -f $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install db_verify for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DESTDIR}${libdir}/afs/libprot.a: libprot.a ${INSTALL} $? $@ diff --git a/src/ptserver/ptprocs.c b/src/ptserver/ptprocs.c index a79201a..030d2ab 100644 --- a/src/ptserver/ptprocs.c +++ b/src/ptserver/ptprocs.c @@ -647,8 +647,12 @@ nameToID(call, aname, aid) AUD_END); ViceLog(125, ("PTS_NameToID: code %d aname %s aid %d", code, aname->namelist_val[i], aid->idlist_val[i])); - if (count++ > 50) - IOMGR_Poll(), count = 0; + if (count++ > 50) { +#ifndef AFS_PTHREAD_ENV + IOMGR_Poll(); +#endif + count = 0; + } } aid->idlist_len = aname->namelist_len; @@ -725,8 +729,12 @@ idToName(call, aid, aname) AUD_STR, aname->namelist_val[i], AUD_END); ViceLog(125, ("PTS_idToName: code %d aid %d aname %s", code, aid->idlist_val[i], aname->namelist_val[i])); - if (count++ > 50) - IOMGR_Poll(), count = 0; + if (count++ > 50) { +#ifndef AFS_PTHREAD_ENV + IOMGR_Poll(); +#endif + count = 0; + } } aname->namelist_len = aid->idlist_len; @@ -821,8 +829,10 @@ Delete(call, aid, cid) if (code) ABORT_WITH(tt, code); tentry.count--; /* maintain count */ +#ifndef AFS_PTHREAD_ENV if ((i & 3) == 0) IOMGR_Poll(); +#endif } tentry.next = centry.next; /* thread out this block */ code = FreeBlock(tt, nptr); /* free continuation block */ @@ -836,7 +846,9 @@ Delete(call, aid, cid) code = ubik_EndTrans(tt); if (code) return code; +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); /* just to keep the connection alive */ +#endif code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt); if (code) return code; @@ -877,8 +889,10 @@ Delete(call, aid, cid) if (code) ABORT_WITH(tt, code); tentryg->countsg--; /* maintain count */ +#ifndef AFS_PTHREAD_ENV if ((i & 3) == 0) IOMGR_Poll(); +#endif } tentryg->nextsg = centry.next; /* thread out this block */ code = FreeBlock(tt, nptr); /* free continuation block */ @@ -892,7 +906,9 @@ Delete(call, aid, cid) code = ubik_EndTrans(tt); if (code) return code; +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); /* just to keep the connection alive */ +#endif code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt); if (code) @@ -933,8 +949,10 @@ Delete(call, aid, cid) if (code) ABORT_WITH(tt, code); count++; +#ifndef AFS_PTHREAD_ENV if ((count & 3) == 0) IOMGR_Poll(); +#endif } if (count < 50) continue; @@ -946,7 +964,9 @@ Delete(call, aid, cid) code = ubik_EndTrans(tt); if (code) return code; +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); /* just to keep the connection alive */ +#endif code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt); if (code) return code; @@ -1662,7 +1682,9 @@ listEntries(call, flag, startindex, bulkentries, nextstartindex, cid) goto done; if (++pollcount > 50) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollcount = 0; } diff --git a/src/ptserver/pts.c b/src/ptserver/pts.c index bd86731..ed508b3 100644 --- a/src/ptserver/pts.c +++ b/src/ptserver/pts.c @@ -108,7 +108,11 @@ pts_Sleep(struct cmd_syndesc *as, void *arock) return 1; } delay = atoi(as->parms[0].items->data); +#ifdef AFS_PTHREAD_ENV + sleep(delay); +#else IOMGR_Sleep(delay); +#endif return 0; } diff --git a/src/ptserver/ptserver.c b/src/ptserver/ptserver.c index 4650e81..bda4e05 100644 --- a/src/ptserver/ptserver.c +++ b/src/ptserver/ptserver.c @@ -522,6 +522,10 @@ main(int argc, char **argv) } if (ccode == 1) { host = SHostAddrs[0]; + /* the following call is idempotent so if/when it gets called + * again by the ubik init stuff, it doesn't really matter + * -- klm + */ rx_InitHost(host, htons(AFSCONF_PROTPORT)); } } diff --git a/src/ptserver/ptutils.c b/src/ptserver/ptutils.c index 3c2b83b..8f17b69 100644 --- a/src/ptserver/ptutils.c +++ b/src/ptserver/ptutils.c @@ -1300,8 +1300,12 @@ GetList(struct ubik_trans *at, struct prentry *tentry, prlist *alist, afs_int32 return code; #endif } - if (count++ > 50) - IOMGR_Poll(), count = 0; + if (count++ > 50) { +#ifndef AFS_PTHREAD_ENV + IOMGR_Poll(); +#endif + count = 0; + } } if (add) { /* this is for a CPS, so tack on appropriate stuff */ @@ -1316,8 +1320,10 @@ GetList(struct ubik_trans *at, struct prentry *tentry, prlist *alist, afs_int32 return code; } } +#ifndef AFS_PTHREAD_ENV if (alist->prlist_len > 100) IOMGR_Poll(); +#endif qsort(alist->prlist_val, alist->prlist_len, sizeof(afs_int32), IDCmp); return PRSUCCESS; } @@ -1376,8 +1382,12 @@ GetList2(struct ubik_trans *at, struct prentry *tentry, struct prentry *tentry2, #endif } nptr = centry.next; - if (count++ > 50) - IOMGR_Poll(), count = 0; + if (count++ > 50) { +#ifndef AFS_PTHREAD_ENV + IOMGR_Poll(); +#endif + count = 0; + } } for (i = 0; i < PRSIZE; i++) { @@ -1407,8 +1417,12 @@ GetList2(struct ubik_trans *at, struct prentry *tentry, struct prentry *tentry2, break; } nptr = centry.next; - if (count++ > 50) - IOMGR_Poll(), count = 0; + if (count++ > 50) { +#ifndef AFS_PTHREAD_ENV + IOMGR_Poll(); +#endif + count = 0; + } } } if (add) { /* this is for a CPS, so tack on appropriate stuff */ @@ -1423,8 +1437,10 @@ GetList2(struct ubik_trans *at, struct prentry *tentry, struct prentry *tentry2, return code; } } +#ifndef AFS_PTHREAD_ENV if (alist->prlist_len > 100) IOMGR_Poll(); +#endif qsort(alist->prlist_val, alist->prlist_len, sizeof(afs_int32), IDCmp); return PRSUCCESS; } @@ -1529,8 +1545,12 @@ GetListSG2(struct ubik_trans *at, afs_int32 gid, prlist *alist, afs_int32 *sizeP return code; } nptr = centry.next; - if (count++ > 50) - IOMGR_Poll(), count = 0; + if (count++ > 50) { +#ifndef AFS_PTHREAD_ENV + IOMGR_Poll(); +#endif + count = 0; + } } #if DEBUG_SG_MAP fprintf(stderr, "] for gid %d, done [flag=%s]\n", gid, @@ -1589,12 +1609,18 @@ GetSGList(struct ubik_trans *at, struct prentry *tentry, prlist *alist) return code; } nptr = centry.next; - if (count++ > 50) - IOMGR_Poll(), count = 0; + if (count++ > 50) { +#ifndef AFS_PTHREAD_ENV + IOMGR_Poll(); +#endif + count = 0; + } } +#ifndef AFS_PTHREAD_ENV if (alist->prlist_len > 100) IOMGR_Poll(); +#endif qsort((char *)alist->prlist_val, (int)alist->prlist_len, sizeof(afs_int32), IDCmp); return PRSUCCESS; @@ -1623,11 +1649,17 @@ GetOwnedChain(struct ubik_trans *ut, afs_int32 *next, prlist *alist) } if (code) return code; - if (count++ > 50) - IOMGR_Poll(), count = 0; + if (count++ > 50) { +#ifndef AFS_PTHREAD_ENV + IOMGR_Poll(); +#endif + count = 0; + } } +#ifndef AFS_PTHREAD_ENV if (alist->prlist_len > 100) IOMGR_Poll(); +#endif qsort(alist->prlist_val, alist->prlist_len, sizeof(afs_int32), IDCmp); return PRSUCCESS; } diff --git a/src/ptserver/utils.c b/src/ptserver/utils.c index a127e3c..d67c141 100644 --- a/src/ptserver/utils.c +++ b/src/ptserver/utils.c @@ -901,7 +901,9 @@ IsAMemberOfSG(struct ubik_trans *at, afs_int32 aid, afs_int32 gid, afs_int32 dep if (gid == AUTHUSERID && aid != ANONYMOUSID) return 1; if (gid < 0) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif if (IsAMemberOfSG(at, aid, gid, depth - 1)) return 1; } @@ -924,7 +926,9 @@ IsAMemberOfSG(struct ubik_trans *at, afs_int32 aid, afs_int32 gid, afs_int32 dep if (gid == AUTHUSERID && aid != ANONYMOUSID) return 1; if (gid < 0) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif if (IsAMemberOfSG(at, aid, gid, depth - 1)) return 1; } diff --git a/src/tbudb/Makefile.in b/src/tbudb/Makefile.in new file mode 100644 index 0000000..555cbd1 --- /dev/null +++ b/src/tbudb/Makefile.in @@ -0,0 +1,243 @@ +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html +# */ + +srcdir=@srcdir@/../budb +include @TOP_OBJDIR@/src/config/Makefile.config + +CCRULE=${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c $< + +RX=../rx +UTIL=../util + +RXOBJS= rx_pthread.o rxkad_errs.o + +UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \ + volparse.o flipbase64.o softsig.o hostparse.o snprintf.o pthread_glock.o + + +INCLS=\ + ${TOP_INCDIR}/lock.h \ + ${TOP_INCDIR}/ubik.h \ + ${TOP_INCDIR}/lwp.h \ + ${TOP_INCDIR}/des.h \ + ${TOP_INCDIR}/rx/rx.h \ + ${TOP_INCDIR}/rx/xdr.h \ + ${TOP_INCDIR}/rx/rxkad.h \ + ${TOP_INCDIR}/afs/auth.h \ + ${TOP_INCDIR}/afs/cellconfig.h \ + ${TOP_INCDIR}/afs/com_err.h \ + ${TOP_INCDIR}/afs/bubasics.h \ + budb.h budb_client.h ${srcdir}/database.h + +# library ordering defined by top level makefile +LIBS=${RXOBJS} ${UTILOBJS} \ + ${TOP_LIBDIR}/libbubasics.a \ + ${TOP_LIBDIR}/libubik_pthread.a \ + ${TOP_LIBDIR}/libafsauthent.a \ + ${TOP_LIBDIR}/libafsrpc.a \ + ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libafsutil.a \ + ${LDFLAGS} ${MT_LIBS} + +COMMON_OBJS = database.o db_alloc.o db_dump.o db_hash.o struct_ops.o ol_verify.o + +SERVER_OBJS = ${COMMON_OBJS} budb.ss.o budb.xdr.o dbs_dump.o db_lock.o db_text.o \ + procs.o server.o budb_errs.o + +all: ${TOP_LIBDIR}/libbudb.a ${TOP_INCDIR}/afs/budb.h ${TOP_INCDIR}/afs/budb_errs.h ${TOP_INCDIR}/afs/budb_client.h budb_server + +# +# budb_errs.o actually depends on neither budb_client.h nor budb_errs.h +# but generating either of them will rebuild budb_errs.c +# +budb_errs.o: budb_errs.c budb_client.h budb_errs.h + +budb_errs.c budb_client.h: ${srcdir}/budb_errs.et ${srcdir}/budb_client.p.h + $(RM) -f budb_client.h budb_errs.c; ${COMPILE_ET} -p ${srcdir} budb_errs -h budb_client + +budb_errs.h: ${srcdir}/budb_errs.et + ${COMPILE_ET} -p ${srcdir} budb_errs + +# +# Build targets +# + +rx_pthread.o: ${RX}/rx_pthread.c + ${CCRULE} + +rxkad_errs.o: ../rxkad/rxkad_errs.c + ${CCRULE} + +# get the pthreaded util stuff compiled here. we do this instead of +# using the non-pthreaded libutil.a. There probably should be a +# pthreaded version of this library, as we are doing with ubik itself, but... +# + +assert.o: ${UTIL}/assert.c + ${CCRULE} + +uuid.o: ${UTIL}/uuid.c + ${CCRULE} + +serverLog.o: ${UTIL}/serverLog.c + ${CCRULE} + +fileutil.o: ${UTIL}/fileutil.c + ${CCRULE} + +volparse.o: ${UTIL}/volparse.c + ${CCRULE} + +flipbase64.o: ${UTIL}/flipbase64.c + ${CCRULE} + +netutils.o: ${UTIL}/netutils.c + ${CCRULE} + +dirpath.o: ${UTIL}/dirpath.c + ${CCRULE} + +softsig.o: ${UTIL}/softsig.c + ${CCRULE} + +hostparse.o: ${UTIL}/hostparse.c + ${CCRULE} + +snprintf.o: ${UTIL}/snprintf.c + ${CCRULE} + +pthread_glock.o: ${UTIL}/pthread_glock.c + ${CCRULE} + + +database.o: ${srcdir}/database.c budb_errs.h ${srcdir}/globals.h ${INCLS} + ${CCRULE} + +db_alloc.o: ${srcdir}/db_alloc.c budb_errs.h ${INCLS} + ${CCRULE} + +db_dump.o: ${srcdir}/db_dump.c budb_errs.h ${INCLS} + ${CCRULE} + +dbs_dump.o: ${srcdir}/dbs_dump.c budb_errs.h ${INCLS} + ${CCRULE} + +db_lock.o: ${srcdir}/db_lock.c budb_errs.h ${INCLS} + ${CCRULE} + +db_text.o: ${srcdir}/db_text.c budb_errs.h ${INCLS} + ${CCRULE} + +db_hash.o: ${srcdir}/db_hash.c budb_errs.h ${INCLS} + ${CCRULE} + +ol_verify.o: ${srcdir}/ol_verify.c budb_errs.h ${INCLS} + ${CCRULE} + +procs.o: ${srcdir}/procs.c budb_errs.h ${srcdir}/globals.h ${INCLS} + ${CCRULE} + +struct_ops.o: ${srcdir}/struct_ops.c budb_errs.h + ${CCRULE} + +server.o: ${srcdir}/server.c budb_errs.h ${INCLS} AFS_component_version_number.c + ${CCRULE} + + +budb_server: $(SERVER_OBJS) ${LIBS} + ${MT_CC} ${CFLAGS} ${MT_CFLAGS} -o budb_server $(SERVER_OBJS) ${LIBS} ${XLIBS} + +budb.cs.c: ${srcdir}/budb.rg + ${RXGEN} -u -C -o $@ ${srcdir}/budb.rg + +budb.ss.c: ${srcdir}/budb.rg + ${RXGEN} -S -o $@ ${srcdir}/budb.rg + +budb.xdr.c: ${srcdir}/budb.rg + ${RXGEN} -c -o $@ ${srcdir}/budb.rg + +budb.h: ${srcdir}/budb.rg + ${RXGEN} -u -h -o $@ ${srcdir}/budb.rg + +budb.cs.c: budb.h +budb.xdr.c: budb.h +budb.ss.c: budb.h + +libbudb.a: budb_errs.o budb.cs.o budb.xdr.o struct_ops.o AFS_component_version_number.o + -$(RM) -f $@ + $(AR) crv $@ budb_errs.o budb.cs.o budb.xdr.o struct_ops.o AFS_component_version_number.o + $(RANLIB) $@ + +# +# Install targets +# +install: \ + ${DESTDIR}${libdir}/afs/libbudb.a \ + ${DESTDIR}${includedir}/afs/budb.h \ + ${DESTDIR}${includedir}/afs/budb_errs.h \ + ${DESTDIR}${includedir}/afs/budb_client.h \ + ${DESTDIR}${afssrvlibexecdir}/buserver + +${DEST}/lib/afs/libbudb.a: libbudb.a + ${INSTALL} $? $@ + +${DEST}/include/afs/budb.h: budb.h + ${INSTALL} $? $@ + +${DEST}/include/afs/budb_errs.h: budb_errs.h + ${INSTALL} $? $@ + +${DEST}/include/afs/budb_client.h: budb_client.h + ${INSTALL} $? $@ + +${DEST}/root.server/usr/afs/bin/buserver: budb_server + ${INSTALL} -f $? $@ + +# +# Misc targets +# +clean: + $(RM) -f *.o *~ budb_errs.[ch] budb.h budb_client.h *.a *.xdr.c \ + *.ss.c *.cs.c core budb_server AFS_component_version_number.c + +include ../config/Makefile.version +${DESTDIR}${libdir}/afs/libbudb.a: libbudb.a + ${INSTALL} $? $@ + +${TOP_LIBDIR}/libbudb.a: libbudb.a + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/budb.h: budb.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/budb.h: budb.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/budb_errs.h: budb_errs.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/budb_errs.h: budb_errs.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/budb_client.h: budb_client.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/budb_client.h: budb_client.h + ${INSTALL} $? $@ + +${DESTDIR}${afssrvlibexecdir}/buserver: budb_server + ${INSTALL} -f $? $@ + +dest: \ + ${DEST}/lib/afs/libbudb.a \ + ${DEST}/include/afs/budb.h \ + ${DEST}/include/afs/budb_errs.h \ + ${DEST}/include/afs/budb_client.h \ + ${DEST}/root.server/usr/afs/bin/buserver + diff --git a/src/tptserver/Makefile.in b/src/tptserver/Makefile.in new file mode 100644 index 0000000..6556cbd --- /dev/null +++ b/src/tptserver/Makefile.in @@ -0,0 +1,416 @@ +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html + +srcdir=@srcdir@/../ptserver +include @TOP_OBJDIR@/src/config/Makefile.config + + +CCRULE=${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c $< + +RX=../rx +UTIL=../util + +RXOBJS= rx_pthread.o rxkad_errs.o + +UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \ + volparse.o flipbase64.o softsig.o hostparse.o snprintf.o pthread_glock.o + +INCLS=${TOP_INCDIR}/ubik.h \ + ${TOP_INCDIR}/lock.h \ + ${TOP_INCDIR}/lwp.h \ + ${TOP_INCDIR}/rx/rx.h \ + ${TOP_INCDIR}/rx/xdr.h \ + ${TOP_INCDIR}/afs/keys.h \ + ${TOP_INCDIR}/afs/cellconfig.h \ + ${srcdir}/ptserver.h \ + ${srcdir}/ptclient.h \ + ${srcdir}/ptuser.h \ + ptint.h \ + pterror.h \ + ${srcdir}/map.h \ + ${srcdir}/ptprototypes.h + +LINCLS=${TOP_INCDIR}/ubik.h \ + ${TOP_INCDIR}/lock.h \ + ${TOP_INCDIR}/rx/rx.h \ + ${TOP_INCDIR}/rx/xdr.h \ + ${TOP_INCDIR}/rx/rxkad.h \ + ${TOP_INCDIR}/afs/auth.h \ + ${TOP_INCDIR}/afs/cellconfig.h \ + ${srcdir}/ptclient.h \ + ${srcdir}/ptuser.h \ + ptint.h \ + pterror.h + +LIBS=${RXOBJS} ${UTILOBJS}\ + ${TOP_LIBDIR}/libubik_pthread.a \ + ${TOP_LIBDIR}/libafsauthent.a \ + ${TOP_LIBDIR}/librxstat.a \ + ${TOP_LIBDIR}/libafsrpc.a \ + ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libsys.a \ + ${TOP_LIBDIR}/libafsutil.a \ + ${LDFLAGS} ${MT_LIBS} + + +all: ptserver pts pt_util db_verify ${TOP_LIBDIR}/libprot.a \ + depinstall readgroup readpwd testpt + +depinstall: \ + ptint.cs.c ptint.xdr.c \ + ${TOP_INCDIR}/afs/prclient.h \ + ${TOP_INCDIR}/afs/prerror.h \ + ${TOP_INCDIR}/afs/print.h \ + ${TOP_INCDIR}/afs/prserver.h \ + ${TOP_INCDIR}/afs/ptclient.h \ + ${TOP_INCDIR}/afs/ptuser.h \ + ${TOP_INCDIR}/afs/pterror.h \ + ${TOP_INCDIR}/afs/ptint.h \ + ${TOP_INCDIR}/afs/ptserver.h + +# +# Build targets +# + +rx_pthread.o: ${RX}/rx_pthread.c + ${CCRULE} + +rxkad_errs.o: ../rxkad/rxkad_errs.c + ${CCRULE} + +# +# get the pthreaded util stuff compiled here. we do this instead of +# using the non-pthreaded libutil.a. There probably should be a +# pthreaded version of this library, as we are doing with ubik itself, but... +# + +assert.o: ${UTIL}/assert.c + ${CCRULE} + +uuid.o: ${UTIL}/uuid.c + ${CCRULE} + +serverLog.o: ${UTIL}/serverLog.c + ${CCRULE} + +fileutil.o: ${UTIL}/fileutil.c + ${CCRULE} + +volparse.o: ${UTIL}/volparse.c + ${CCRULE} + +flipbase64.o: ${UTIL}/flipbase64.c + ${CCRULE} + +netutils.o: ${UTIL}/netutils.c + ${CCRULE} + +dirpath.o: ${UTIL}/dirpath.c + ${CCRULE} + +softsig.o: ${UTIL}/softsig.c + ${CCRULE} + +hostparse.o: ${UTIL}/hostparse.c + ${CCRULE} + +snprintf.o: ${UTIL}/snprintf.c + ${CCRULE} + +pthread_glock.o: ${UTIL}/pthread_glock.c + ${CCRULE} + + +#ptserver.o: ${srcdir}/ptserver.c ${INCLS} AFS_component_version_number.c +# ${CCRULE} + +ptserver.o: ${srcdir}/ptserver.c + ${CCRULE} + +ptutils.o: ${srcdir}/ptutils.c + ${CCRULE} + +ptprocs.o: ${srcdir}/ptprocs.c + ${CCRULE} + +utils.o: ${srcdir}/utils.c + ${CCRULE} + +map.o: ${srcdir}/map.c + ${CCRULE} + +ptint.ss.o: ptint.ss.c + ${CCRULE} + +ptint.cs.o: ptint.cs.c + ${CCRULE} + +ptint.xdr.o: ptint.xdr.c + ${CCRULE} + +ptint.cs.c: ${srcdir}/ptint.xg + ${RXGEN} -x -C -u -o $@ ${srcdir}/ptint.xg + +ptint.ss.c: ${srcdir}/ptint.xg + ${RXGEN} -x -S -o $@ ${srcdir}/ptint.xg + +ptint.xdr.c: ${srcdir}/ptint.xg + ${RXGEN} -x -c -o $@ ${srcdir}/ptint.xg + +ptint.h: ${srcdir}/ptint.xg + ${RXGEN} -x -h -u -o $@ ${srcdir}/ptint.xg + +ptint.cs.c: ptint.h +ptint.ss.c: ptint.h +ptint.xdr.c: ptint.h + +Kptint.cs.c: ${srcdir}/ptint.xg Kptint.h + ${RXGEN} -x -k -C -o Kptint.cs.c ${srcdir}/ptint.xg + +Kptint.xdr.c: ${srcdir}/ptint.xg + ${RXGEN} -x -k -c -o Kptint.xdr.c ${srcdir}/ptint.xg + +Kptint.h: ${srcdir}/ptint.xg + ${RXGEN} -x -k -h -o Kptint.h ${srcdir}/ptint.xg + +display.o: ${srcdir}/display.c + ${CCRULE} + +ptserver: ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o utils.o $(LIBS) ${TOP_LIBDIR}/libaudit.a map.o + ${MT_CC} ${CFLAGS} ${MT_CFLAGS} -o ptserver ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o utils.o map.o $(LIBS) ${XLIBS} ${TOP_LIBDIR}/libaudit.a + +db_verify.o: ${srcdir}/db_verify.c + ${CCRULE} + +db_verify: db_verify.o pterror.o display.o $(LIBS) + $(CC) ${CFLAGS} -o db_verify db_verify.o display.o pterror.o $(LIBS) ${XLIBS} + +ptclient: ptclient.o display.o libprot.a $(LIBS) + $(CC) ${CFLAGS} -o ptclient ptclient.o display.o libprot.a $(LIBS) ${XLIBS} + +ptclient.o: ${srcdir}/ptclient.c + ${CCRULE} + +ptuser.o: ${srcdir}/ptuser.c + ${CCRULE} + +pterror.h pterror.c: ${srcdir}/pterror.et + $(RM) -f pterror.h pterror.c + ${COMPILE_ET} -p ${srcdir} pterror + +libprot.a: ptuser.o pterror.o ptint.cs.o ptint.xdr.o AFS_component_version_number.o + $(RM) -f $@ + $(AR) crv $@ ptuser.o pterror.o ptint.cs.o ptint.xdr.o AFS_component_version_number.o + $(RANLIB) $@ + +pts: pts.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS) + $(CC) ${CFLAGS} -o pts pts.o ${TOP_LIBDIR}/libcmd.a libprot.a ${LIBS} ${XLIBS} + +pts.o: ${srcdir}/pts.c + ${CCRULE} + +readgroup: readgroup.o libprot.a $(LIBS) + $(CC) ${CFLAGS} -o readgroup readgroup.o libprot.a ${LIBS} ${XLIBS} + +readgroup.o: ${srcdir}/readgroup.c + ${CCRULE} + +readpwd: readpwd.o libprot.a $(LIBS) + $(CC) ${CFLAGS} -o readpwd readpwd.o libprot.a ${LIBS} ${XLIBS} + +readpwd.o: ${srcdir}/readpwd.c + ${CCRULE} + +testpt: testpt.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS) + case "$(SYS_NAME)" in \ + *_darwin_12 ) \ + $(CC) ${CFLAGS} -o testpt testpt.o ${TOP_LIBDIR}/libcmd.a libprot.a $(LIBS) ;; \ + * ) \ + $(CC) ${CFLAGS} -o testpt testpt.o -lm ${TOP_LIBDIR}/libcmd.a libprot.a $(LIBS) ${XLIBS} ;; \ + esac + +testpt.o: ${srcdir}/testpt.c + ${CCRULE} + +pt_util: pt_util.o ptutils.o ubik.o utils.o map.o libprot.a $(LIBS) + $(CC) ${CFLAGS} -o pt_util pt_util.o ptutils.o ubik.o utils.o map.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS) ${XLIBS} + +pt_util.o: ${srcdir}/pt_util.c + ${CCRULE} + +ubik.o: ${srcdir}/ubik.c + ${CCRULE} + +prerror.h: pterror.h + ${INSTALL} $? $@ + echo '#define ERROR_TABLE_BASE_pr ERROR_TABLE_BASE_PT' >> $@ + +# +# Installation targets +# +install: \ + ${DESTDIR}${afssrvlibexecdir}/ptserver \ + ${DESTDIR}${afssrvbindir}/pts \ + ${DESTDIR}${bindir}/pts \ + ${DESTDIR}${afssrvsbindir}/pt_util \ + ${DESTDIR}${afssrvsbindir}/prdb_check \ + ${DESTDIR}${libdir}/afs/libprot.a \ + ${DESTDIR}${includedir}/afs/prclient.h \ + ${DESTDIR}${includedir}/afs/prerror.h \ + ${DESTDIR}${includedir}/afs/print.h \ + ${DESTDIR}${includedir}/afs/prserver.h \ + ${DESTDIR}${includedir}/afs/ptclient.h \ + ${DESTDIR}${includedir}/afs/ptuser.h \ + ${DESTDIR}${includedir}/afs/pterror.h \ + ${DESTDIR}${includedir}/afs/ptint.h \ + ${DESTDIR}${includedir}/afs/ptserver.h + +${DEST}/root.server/usr/afs/bin/ptserver: ptserver + ${INSTALL} $? $@ + +${DEST}/bin/pts ${DEST}/root.server/usr/afs/bin/pts: pts + ${INSTALL} $? $@ + +${DEST}/root.server/usr/afs/bin/pt_util: pt_util + ${INSTALL} $? $@ + +${DEST}/lib/afs/libprot.a: libprot.a + ${INSTALL} $? $@ + +${DEST}/etc/prdb_check: db_verify + ${INSTALL} -f $? $@ + +${DEST}/include/afs/prclient.h: ${srcdir}/ptclient.h + ${INSTALL} $? $@ + +${DEST}/include/afs/prerror.h: pterror.h + ${INSTALL} $? $@ + +${DEST}/include/afs/print.h: ptint.h + ${INSTALL} $? $@ + +${DEST}/include/afs/prserver.h: ${srcdir}/ptserver.h + ${INSTALL} $? $@ + +${DEST}/include/afs/ptserver.h: ${srcdir}/ptserver.h + ${INSTALL} $? $@ + +${DEST}/include/afs/ptint.h: ptint.h + ${INSTALL} $? $@ + +${DEST}/include/afs/pterror.h: pterror.h + ${INSTALL} $? $@ + +${DEST}/include/afs/ptclient.h: ${srcdir}/ptclient.h + ${INSTALL} $? $@ + +${DEST}/include/afs/ptuser.h: ${srcdir}/ptuser.h + ${INSTALL} $? $@ + +# +# Misc. targets +# +clean: + $(RM) -f *.a *.o ptserver ptint.cs.c ptint.ss.c ptclient ptint.xdr.c ptint.h \ + libprot.a pts readgroup readpwd db_verify testpt pt_util pterror.h pterror.c \ + core AFS_component_version_number.c Kptint.cs.c Kptint.h Kptint.xdr.c + +include ../config/Makefile.version +${DESTDIR}${afssrvlibexecdir}/ptserver: ptserver + ${INSTALL} $? $@ + +${DESTDIR}${afssrvbindir}/pts: pts + ${INSTALL} $? $@ + +${DESTDIR}${bindir}/pts: pts + ${INSTALL} $? $@ + +${DESTDIR}${afssrvsbindir}/pt_util: pt_util + ${INSTALL} $? $@ + +${DESTDIR}${afssrvsbindir}/prdb_check: db_verify + ${INSTALL} -f $? $@ + +${DESTDIR}${libdir}/afs/libprot.a: libprot.a + ${INSTALL} $? $@ + +${TOP_LIBDIR}/libprot.a: libprot.a + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/prclient.h: ${srcdir}/ptclient.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/prclient.h: ${srcdir}/ptclient.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/prerror.h: pterror.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/prerror.h: pterror.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/print.h: ptint.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/print.h: ptint.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/prserver.h: ${srcdir}/ptserver.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/prserver.h: ${srcdir}/ptserver.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/ptclient.h: ${srcdir}/ptclient.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/ptuser.h: ${srcdir}/ptuser.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/ptclient.h: ${srcdir}/ptclient.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/ptuser.h: ${srcdir}/ptuser.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/pterror.h: pterror.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/pterror.h: pterror.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/ptint.h: ptint.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/ptint.h: ptint.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/ptserver.h: ${srcdir}/ptserver.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/ptserver.h: ${srcdir}/ptserver.h + ${INSTALL} $? $@ + + +dest: \ + ${DEST}/root.server/usr/afs/bin/ptserver \ + ${DEST}/root.server/usr/afs/bin/pts \ + ${DEST}/bin/pts \ + ${DEST}/root.server/usr/afs/bin/pt_util \ + ${DEST}/etc/prdb_check \ + ${DEST}/lib/afs/libprot.a \ + ${DEST}/include/afs/prclient.h \ + ${DEST}/include/afs/prerror.h \ + ${DEST}/include/afs/print.h \ + ${DEST}/include/afs/prserver.h \ + ${DEST}/include/afs/ptclient.h \ + ${DEST}/include/afs/ptuser.h \ + ${DEST}/include/afs/pterror.h \ + ${DEST}/include/afs/ptint.h \ + ${DEST}/include/afs/ptserver.h + diff --git a/src/tubik/Makefile.in b/src/tubik/Makefile.in new file mode 100644 index 0000000..7b6b01e --- /dev/null +++ b/src/tubik/Makefile.in @@ -0,0 +1,292 @@ +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html + +srcdir=@srcdir@/../ubik +include @TOP_OBJDIR@/src/config/Makefile.config + +CCRULE=${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c $< + +RX=../rx +UTIL=../util + +LIBOBJS=disk.o remote.o beacon.o recovery.o ubik.o vote.o lock.o phys.o \ + ubik_int.cs.o ubik_int.ss.o ubik_int.xdr.o ubikcmd.o \ + ubikclient.o uerrors.o uinit.o + +INCLS=${TOP_INCDIR}/lwp.h ${TOP_INCDIR}/lock.h \ + ${TOP_INCDIR}/rx/rx.h ${TOP_INCDIR}/rx/xdr.h \ + ${TOP_INCDIR}/lock.h ubik.h ubik_int.h utst_int.h + +RXOBJS = rx_pthread.o + +UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \ + volparse.o flipbase64.o softsig.o hostparse.o snprintf.o pthread_glock.o + +LIBS=${RXOBJS} ${UTILOBJS} ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/liblwp.a \ + ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libsys.a ${XLIBS} \ + ${LDFLAGS} ${MT_LIBS} + +all: depinstall ${TOP_LIBDIR}/libubik_pthread.a udebug utst_server utst_client + +depinstall: \ + ubik_int.cs.c ubik_int.xdr.c \ + ${TOP_INCDIR}/ubik.h \ + ${TOP_INCDIR}/ubik_int.h + +# +# get the pthreaded rx stuff compiled here +# + +rx_pthread.o: ${RX}/rx_pthread.c + ${CCRULE} -DDPF_FSLOG + +# +# get the pthreaded util stuff compiled here. we do this instead of +# using the non-pthreaded libutil.a. There probably should be a +# pthreaded version of this library, as we are doing with ubik itself, but... +# + +assert.o: ${UTIL}/assert.c + ${CCRULE} + +uuid.o: ${UTIL}/uuid.c + ${CCRULE} + +serverLog.o: ${UTIL}/serverLog.c + ${CCRULE} + +fileutil.o: ${UTIL}/fileutil.c + ${CCRULE} + +volparse.o: ${UTIL}/volparse.c + ${CCRULE} + +flipbase64.o: ${UTIL}/flipbase64.c + ${CCRULE} + +netutils.o: ${UTIL}/netutils.c + ${CCRULE} + +dirpath.o: ${UTIL}/dirpath.c + ${CCRULE} + +softsig.o: ${UTIL}/softsig.c + ${CCRULE} + +hostparse.o: ${UTIL}/hostparse.c + ${CCRULE} + +snprintf.o: ${UTIL}/snprintf.c + ${CCRULE} + +pthread_glock.o: ${UTIL}/pthread_glock.c + ${CCRULE} + + +# +# insert comments here +# + +utst_server: utst_server.o utst_int.ss.o utst_int.xdr.o libubik_pthread.a ${RXOBJS} ${UTILOBJS} + ${CC} ${CFLAGS} -o utst_server utst_server.o utst_int.ss.o utst_int.xdr.o libubik_pthread.a $(LIBS) + +utst_client: utst_client.o utst_int.cs.o utst_int.xdr.o libubik_pthread.a ${RXOBJS} ${UTILOBJS} + ${CC} ${CFLAGS} -o utst_client utst_client.o utst_int.cs.o utst_int.xdr.o libubik_pthread.a $(LIBS) + +udebug: udebug.o libubik_pthread.a ${RXOBJS} ${UTILOBJS} + ${CC} ${CFLAGS} -o udebug udebug.o libubik_pthread.a $(LIBS) + +ubik_int.cs.c: ${srcdir}/ubik_int.xg + ${RXGEN} -x -C -o $@ ${srcdir}/ubik_int.xg + +ubik_int.ss.c: ${srcdir}/ubik_int.xg + ${RXGEN} -x -S -o $@ ${srcdir}/ubik_int.xg + +ubik_int.xdr.c: ${srcdir}/ubik_int.xg + ${RXGEN} -x -c -o $@ ${srcdir}/ubik_int.xg + +ubik_int.h: ${srcdir}/ubik_int.xg + ${RXGEN} -x -h -o $@ ${srcdir}/ubik_int.xg + +ubik_int.cs.c: ubik_int.h +ubik_int.ss.c: ubik_int.h +ubik_int.xdr.c: ubik_int.h + +Kubik_int.cs.c: ${srcdir}/ubik_int.xg Kubik_int.h + ${RXGEN} -x -k -C -o Kubik_int.cs.c ${srcdir}/ubik_int.xg + +Kubik_int.xdr.c: ${srcdir}/ubik_int.xg + ${RXGEN} -x -k -c -o Kubik_int.xdr.c ${srcdir}/ubik_int.xg + +Kubik_int.h: ${srcdir}/ubik_int.xg + ${RXGEN} -x -k -h -o Kubik_int.h ${srcdir}/ubik_int.xg + +#utst_int.ss.o: utst_int.ss.c utst_int.xdr.c +# ${CCRULE} + +#utst_int.cs.o: utst_int.cs.c utst_int.xdr.c +# ${CCRULE} + +#utst_int.xdr.o: utst_int.xdr.c utst_int.h +# ${CCRULE} + +utst_int.cs.c: ${srcdir}/utst_int.xg + ${RXGEN} -C -o $@ ${srcdir}/utst_int.xg + +utst_int.ss.c: ${srcdir}/utst_int.xg + ${RXGEN} -S -o $@ ${srcdir}/utst_int.xg + +utst_int.xdr.c: ${srcdir}/utst_int.xg + ${RXGEN} -c -o $@ ${srcdir}/utst_int.xg + +utst_int.h: ${srcdir}/utst_int.xg + ${RXGEN} -h -o $@ ${srcdir}/utst_int.xg + +utst_int.cs.c: utst_int.h +utst_int.ss.c: utst_int.h +utst_int.xdr.c: utst_int.h + +utst_server.o: ${srcdir}/utst_server.c ${INCLS} + ${CCRULE} + +utst_client.o: ${srcdir}/utst_client.c ${INCLS} + ${CCRULE} + +udebug.o: ${srcdir}/udebug.c ${INCLS} AFS_component_version_number.c + ${CCRULE} + +# ${CC} ${CFLAGS} -I. -I${TOP_INCDIR} -I${TOP_INCDIR}/afs -c ${srcdir}/udebug.c + +uerrors.o: uerrors.c + ${CCRULE} + +uerrors.c ubik.h: ${srcdir}/uerrors.et ${srcdir}/ubik.p.h + $(RM) -f ubik.h uerrors.c + ${COMPILE_ET} -p ${srcdir} uerrors -h ubik + +libubik_pthread.a: ${LIBOBJS} AFS_component_version_number.o + -$(RM) -f $@ + $(AR) crc $@ ${LIBOBJS} AFS_component_version_number.o + $(RANLIB) $@ + +disk.o: ${srcdir}/disk.c ${INCLS} + ${CCRULE} + +uinit.o: ${srcdir}/uinit.c ${INCLS} + ${CCRULE} + +remote.o: ${srcdir}/remote.c ${INCLS} + ${CCRULE} + +beacon.o: ${srcdir}/beacon.c ${INCLS} + ${CCRULE} + +lock.o: ${srcdir}/lock.c ${INCLS} + ${CCRULE} + +recovery.o: ${srcdir}/recovery.c ${INCLS} + ${CCRULE} + +ubik.o: ${srcdir}/ubik.c ${INCLS} + ${CCRULE} + +phys.o: ${srcdir}/phys.c ${INCLS} + ${CCRULE} + +vote.o: ${srcdir}/vote.c ${INCLS} + ${CCRULE} + +ubikcmd.o: ${srcdir}/ubikcmd.c ${INCLS} + ${CCRULE} + +ubikclient.o: ${srcdir}/ubikclient.c ${INCLS} + ${CCRULE} + +ubik_int.ss.o: ubik_int.ss.c ${INCLS} + ${CCRULE} + +ubik_int.cs.o: ubik_int.cs.c ${INCLS} + ${CCRULE} + +ubik_int.xdr.o: ubik_int.xdr.c ${INCLS} + ${CCRULE} + +utst_int.ss.o: utst_int.ss.c ${INCLS} utst_int.h + ${CCRULE} + +utst_int.cs.o: utst_int.cs.c ${INCLS} utst_int.h + ${CCRULE} + +utst_int.xdr.o: utst_int.xdr.c ${INCLS} utst_int.h + ${CCRULE} + +# +# Installation targets +# +test: all + +install: \ + ${DESTDIR}${libdir}/libubik_pthread.a \ + ${DESTDIR}${includedir}/ubik.h \ + ${DESTDIR}${includedir}/ubik_int.h \ + ${DESTDIR}${bindir}/udebug \ + ${DESTDIR}${afssrvbindir}/udebug + +${DEST}/bin/udebug ${DEST}/root.server/usr/afs/bin/udebug: udebug + ${INSTALL} $? $@ + +${DEST}/lib/libubik_pthread.a: libubik_pthread.a + ${INSTALL} $? $@ + +${DEST}/include/ubik.h: ubik.h + ${INSTALL} $? $@ + +${DEST}/include/ubik_int.h: ubik_int.h + ${INSTALL} $? $@ + +# +# Misc. targets +# +clean: + $(RM) -f *.o utst_server utst_client udebug *.a *.cs.c *.ss.c *.xdr.c + $(RM) -f utst_int.h ubik_int.h uerrors.c ubik.h core AFS_component_version_number.c Kubik_int.h + +include ../config/Makefile.version + + +${DESTDIR}${libdir}/libubik_pthread.a: libubik_pthread.a + ${INSTALL} $? $@ + +${TOP_LIBDIR}/libubik_pthread.a: libubik_pthread.a + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/ubik.h: ubik.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/ubik.h: ubik.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/ubik_int.h: ubik_int.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/ubik_int.h: ubik_int.h + ${INSTALL} $? $@ + +${DESTDIR}${bindir}/udebug: udebug + ${INSTALL} $? $@ + +${DESTDIR}${afssrvbindir}/udebug: udebug + ${INSTALL} $? $@ + +dest: \ + ${DEST}/lib/libubik_pthread.a \ + ${DEST}/include/ubik.h \ + ${DEST}/include/ubik_int.h \ + ${DEST}/bin/udebug \ + ${DEST}/root.server/usr/afs/bin/udebug + diff --git a/src/tvlserver/Makefile.in b/src/tvlserver/Makefile.in new file mode 100644 index 0000000..17418cc --- /dev/null +++ b/src/tvlserver/Makefile.in @@ -0,0 +1,285 @@ +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html + +srcdir=@srcdir@/../vlserver +include @TOP_OBJDIR@/src/config/Makefile.config + +CCRULE=${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c $< + +RX=../rx +UTIL=../util + +RXOBJS= rx_pthread.o rxkad_errs.o + +UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \ + volparse.o flipbase64.o softsig.o hostparse.o snprintf.o \ + pthread_glock.o get_krbrlm.o + +INCLS=${TOP_INCDIR}/ubik.h \ + ${TOP_INCDIR}/lwp.h \ + ${TOP_INCDIR}/lock.h \ + ${TOP_INCDIR}/rx/rx.h \ + ${TOP_INCDIR}/rx/xdr.h \ + ${TOP_INCDIR}/afs/keys.h \ + ${TOP_INCDIR}/afs/cellconfig.h \ + vlserver.h ${srcdir}/vlclient.h vldbint.h + +LIBS=${RXOBJS} ${UTILOBJS} \ + ${TOP_LIBDIR}/libubik_pthread.a \ + ${TOP_LIBDIR}/libafsauthent.a \ + ${TOP_LIBDIR}/librxstat.a \ + ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libsys.a \ + ${TOP_LIBDIR}/libafsrpc.a \ + ${LDFLAGS} ${MT_LIBS} + +OBJS=vldbint.xdr.o vldbint.cs.o vl_errors.o + + +all: \ + vlserver vlclient cnvldb vlserver cnvldb vldb_check \ + Kvldbint.cs.c Kvldbint.xdr.c vldbint.h \ + ${TOP_LIBDIR}/libvldb.a depinstall + +depinstall: \ + Kvldbint.cs.c Kvldbint.xdr.c vldbint.h \ + ${TOP_INCDIR}/afs/vl_opcodes.h \ + ${TOP_INCDIR}/afs/vlserver.h \ + ${TOP_INCDIR}/afs/vldbint.h \ + ${TOP_INCDIR}/afs/cnvldb.h + +rx_pthread.o: ${RX}/rx_pthread.c + ${CCRULE} + +rxkad_errs.o: ../rxkad/rxkad_errs.c + ${CCRULE} + +# +# get the pthreaded util stuff compiled here. we do this instead of +# using the non-pthreaded libutil.a. There probably should be a +# pthreaded version of this library, as we are doing with ubik itself, but... +# + +assert.o: ${UTIL}/assert.c + ${CCRULE} + +uuid.o: ${UTIL}/uuid.c + ${CCRULE} + +serverLog.o: ${UTIL}/serverLog.c + ${CCRULE} + +fileutil.o: ${UTIL}/fileutil.c + ${CCRULE} + +volparse.o: ${UTIL}/volparse.c + ${CCRULE} + +flipbase64.o: ${UTIL}/flipbase64.c + ${CCRULE} + +netutils.o: ${UTIL}/netutils.c + ${CCRULE} + +dirpath.o: ${UTIL}/dirpath.c + ${CCRULE} + +softsig.o: ${UTIL}/softsig.c + ${CCRULE} + +hostparse.o: ${UTIL}/hostparse.c + ${CCRULE} + +snprintf.o: ${UTIL}/snprintf.c + ${CCRULE} + +pthread_glock.o: ${UTIL}/pthread_glock.c + ${CCRULE} + +get_krbrlm.o: ${UTIL}/get_krbrlm.c + ${CCRULE} + +# +# Other stuff +# + + +vldb_check: vldb_check.o ${LIBS} + $(CC) ${CFLAGS} -o vldb_check vldb_check.o ${LIBS} ${XLIBS} + +vldb_check.o: ${srcdir}/vldb_check.c AFS_component_version_number.o + ${CCRULE} + +cnvldb: cnvldb.o ${LIBS} + $(CC) ${CFLAGS} -o cnvldb cnvldb.o ${LIBS} ${XLIBS} + +cnvldb.o: ${srcdir}/cnvldb.c ${srcdir}/cnvldb.h AFS_component_version_number.o + ${CCRULE} + +sascnvldb: sascnvldb.o ${LIBS} + $(CC) ${CFLAGS} -o sascnvldb sascnvldb.o ${LIBS} ${XLIBS} + +sascnvldb.o: ${srcdir}/sascnvldb.c ${srcdir}/cnvldb.h AFS_component_version_number.o + ${CCRULE} + +vlserver: vlserver.o vlutils.o vlprocs.o vldbint.ss.o vldbint.xdr.o $(LIBS) + $(CC) ${CFLAGS} -o vlserver vlserver.o vlutils.o vlprocs.o vldbint.ss.o \ + vldbint.xdr.o $(LIBS) ${XLIBS} ${TOP_LIBDIR}/libaudit.a + +vlserver.o: ${srcdir}/vlserver.c ${INCLS} AFS_component_version_number.o + ${CCRULE} + +vlutils.o: ${srcdir}/vlutils.c ${INCLS} + ${CCRULE} + +vlprocs.o: ${srcdir}/vlprocs.c ${INCLS} + ${CCRULE} + +vldbint.ss.o: vldbint.ss.c vldbint.xdr.c + ${CCRULE} + +vldbint.cs.o: vldbint.cs.c vldbint.xdr.c + ${CCRULE} + +vldbint.xdr.o: vldbint.xdr.c vldbint.h + ${CCRULE} + +vldbint.cs.c: ${srcdir}/vldbint.xg + ${RXGEN} -u -x -C -o $@ ${srcdir}/vldbint.xg + +vldbint.ss.c: ${srcdir}/vldbint.xg + ${RXGEN} -x -S -o $@ ${srcdir}/vldbint.xg + +vldbint.xdr.c: ${srcdir}/vldbint.xg + ${RXGEN} -x -c -o $@ ${srcdir}/vldbint.xg + +vldbint.h: ${srcdir}/vldbint.xg + ${RXGEN} -u -x -h -o $@ ${srcdir}/vldbint.xg + +vldbint.cs.c: vldbint.h +vldbint.ss.c: vldbint.h +vldbint.xdr.c: vldbint.h + +Kvldbint.cs.c: ${srcdir}/vldbint.xg + ${RXGEN} -x -k -C -o $@ ${srcdir}/vldbint.xg + +Kvldbint.xdr.c: ${srcdir}/vldbint.xg + ${RXGEN} -x -k -c -o $@ ${srcdir}/vldbint.xg + +libvldb.a: $(OBJS) AFS_component_version_number.o + $(RM) -f $@ + $(AR) crv $@ $(OBJS) AFS_component_version_number.o + $(RANLIB) $@ + +vlclient: vlclient.o libvldb.a $(LIBS) + $(CC) ${CFLAGS} -o vlclient vlclient.o libvldb.a $(LIBS) ${XLIBS} ${TOP_LIBDIR}/libcmd.a + +vlclient.o: ${srcdir}/vlclient.c ${INCLS} AFS_component_version_number.o + ${CCRULE} + + +vl_errors.o: vl_errors.c + ${CCRULE} + +vlserver.h vl_errors.c: ${srcdir}/vl_errors.et ${srcdir}/vlserver.p.h + $(RM) -f vlserver.h vl_errors.c; ${COMPILE_ET} -p ${srcdir} vl_errors -h vlserver + +system: install + +${DEST}/root.server/usr/afs/bin/vlserver: vlserver + ${INSTALL} $? $@ + +${DEST}/etc/vldb_convert: cnvldb + ${INSTALL} -f $? $@ + +${TOP_LIBDIR}/libvldb.a: libvldb.a + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/vl_opcodes.h: ${srcdir}/vl_opcodes.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/vlserver.h: vlserver.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/vldbint.h: vldbint.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/cnvldb.h: ${srcdir}/cnvldb.h + ${INSTALL} $? $@ + +install: \ + ${DESTDIR}${afssrvlibexecdir}/vlserver \ + ${DESTDIR}${afssrvsbindir}/vldb_convert \ + ${DESTDIR}${libdir}/afs/libvldb.a \ + ${DESTDIR}${includedir}/afs/vl_opcodes.h \ + ${DESTDIR}${includedir}/afs/vlserver.h \ + ${DESTDIR}${includedir}/afs/vldbint.h \ + ${DESTDIR}${includedir}/afs/cnvldb.h \ + ${DESTDIR}${afssrvsbindir}/vldb_check + +${DESTDIR}${afssrvlibexecdir}/vlserver: vlserver + ${INSTALL} $? $@ + +${DESTDIR}${afssrvsbindir}/vldb_convert: cnvldb + ${INSTALL} -f $? $@ + +${DESTDIR}${libdir}/afs/libvldb.a: libvldb.a + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/vl_opcodes.h: ${srcdir}/vl_opcodes.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/vlserver.h: vlserver.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/vldbint.h: vldbint.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/cnvldb.h: ${srcdir}/cnvldb.h + ${INSTALL} $? $@ + +${DESTDIR}${afssrvsbindir}/vldb_check: vldb_check + ${INSTALL} $? $@ + +dest: \ + ${DEST}/root.server/usr/afs/bin/vlserver \ + ${DEST}/etc/vldb_convert \ + ${DEST}/lib/afs/libvldb.a \ + ${DEST}/include/afs/vl_opcodes.h \ + ${DEST}/include/afs/vlserver.h \ + ${DEST}/include/afs/vldbint.h \ + ${DEST}/include/afs/cnvldb.h \ + ${DEST}/etc/vldb_check + +${DEST}/lib/afs/libvldb.a: libvldb.a + ${INSTALL} $? $@ + +${DEST}/include/afs/vl_opcodes.h: ${srcdir}/vl_opcodes.h + ${INSTALL} $? $@ + +${DEST}/include/afs/vlserver.h: vlserver.h + ${INSTALL} $? $@ + +${DEST}/include/afs/vldbint.h: vldbint.h + ${INSTALL} $? $@ + +${DEST}/include/afs/cnvldb.h: ${srcdir}/cnvldb.h + ${INSTALL} $? $@ + +${DEST}/etc/vldb_check: vldb_check + ${INSTALL} $? $@ + +# +# Misc targets +# +include ../config/Makefile.version + +clean: + $(RM) -f *.o *.a *.otl *.xdr.c *.cs.c *.ss.c core \ + vlserver vlclient cnvldb vldbint.h vlserver.h vldb_check \ + vl_errors.c AFS_component_version_number.c diff --git a/src/ubik/beacon.c b/src/ubik/beacon.c index bcbc362..937d54d 100644 --- a/src/ubik/beacon.c +++ b/src/ubik/beacon.c @@ -330,7 +330,11 @@ ubeacon_Interact(void *dummy) temp = POLLTIME; tt.tv_sec = temp; tt.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + code = select(0, 0, 0, 0, &tt); +#else code = IOMGR_Select(0, 0, 0, 0, &tt); +#endif } else code = 0; @@ -446,7 +450,13 @@ ubeacon_Interact(void *dummy) ubik_dprint("Ubik: I am the sync site\n"); ubik_amSyncSite = 1; syncSiteUntil = oldestYesVote + SMALLTIME; - LWP_NoYieldSignal(&ubik_amSyncSite); +#ifndef AFS_PTHREAD_ENV +#ifndef UBIK_PTHREAD_ENV + /* I did not find a corresponding LWP_WaitProcess(&ubik_amSyncSite) -- + this may be a spurious signal call -- sjenkins */ + LWP_NoYieldSignal(&ubik_amSyncSite); +#endif +#endif } else { if (ubik_amSyncSite) ubik_dprint("Ubik: I am no longer the sync site\n"); diff --git a/src/ubik/disk.c b/src/ubik/disk.c index e29f865..fecfcd8 100644 --- a/src/ubik/disk.c +++ b/src/ubik/disk.c @@ -798,8 +798,11 @@ udisk_commit(struct ubik_trans *atrans) } dbase->version.counter++; /* bump commit count */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&dbase->version_cond) == 0); +#else LWP_NoYieldSignal(&dbase->version); - +#endif code = udisk_LogEnd(dbase, &dbase->version); if (code) { dbase->version.counter--; @@ -915,6 +918,10 @@ udisk_end(struct ubik_trans *atrans) free(atrans); /* Wakeup any writers waiting in BeginTrans() */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&dbase->flags_cond) == 0); +#else LWP_NoYieldSignal(&dbase->flags); +#endif return 0; } diff --git a/src/ubik/phys.c b/src/ubik/phys.c index 69153a7..403afb5 100644 --- a/src/ubik/phys.c +++ b/src/ubik/phys.c @@ -23,7 +23,14 @@ RCSID #include #endif #include + +/* #if defined (AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) */ +#if 0 /* temporary hack - klm */ +/* nothing */ +#else #include +#endif + #include #include #include diff --git a/src/ubik/recovery.c b/src/ubik/recovery.c index fc8a2bf..6b346d1 100644 --- a/src/ubik/recovery.c +++ b/src/ubik/recovery.c @@ -72,7 +72,10 @@ int urecovery_ResetState(void) { urecovery_state = 0; +#if !defined(AFS_PTHREAD_ENV) || !defined(UBIK_PTHREAD_ENV) + /* No corresponding LWP_WaitProcess found anywhere for this -- klm */ LWP_NoYieldSignal(&urecovery_state); +#endif return 0; } @@ -83,8 +86,11 @@ urecovery_ResetState(void) int urecovery_LostServer(void) { +#if !defined(AFS_PTHREAD_ENV) || !defined(UBIK_PTHREAD_ENV) + /* No corresponding LWP_WaitProcess found anywhere for this -- klm */ LWP_NoYieldSignal(&urecovery_state); return 0; +#endif } /* return true iff we have a current database (called by both sync @@ -363,7 +369,11 @@ InitializeDB(register struct ubik_dbase *adbase) adbase->version.counter = 0; (*adbase->setlabel) (adbase, 0, &adbase->version); } +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&adbase->version_cond) == 0); +#else LWP_NoYieldSignal(&adbase->version); +#endif } return 0; } @@ -443,7 +453,11 @@ urecovery_Interact(void *dummy) /* Run through this loop every 4 seconds */ tv.tv_sec = 4; tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif ubik_dprint("recovery running in state %x\n", urecovery_state); @@ -678,7 +692,11 @@ urecovery_Interact(void *dummy) urecovery_state |= UBIK_RECHAVEDB; } udisk_Invalidate(ubik_dbase, 0); /* data has changed */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&ubik_dbase->version_cond) == 0); +#else LWP_NoYieldSignal(&ubik_dbase->version); +#endif DBRELE(ubik_dbase); } #if defined(UBIK_PAUSE) @@ -702,7 +720,11 @@ urecovery_Interact(void *dummy) code = (*ubik_dbase->setlabel) (ubik_dbase, 0, &ubik_dbase->version); udisk_Invalidate(ubik_dbase, 0); /* data may have changed */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&ubik_dbase->version_cond) == 0); +#else LWP_NoYieldSignal(&ubik_dbase->version); +#endif DBRELE(ubik_dbase); } @@ -731,7 +753,11 @@ urecovery_Interact(void *dummy) while ((ubik_dbase->flags & DBWRITING) && (safety < 500)) { DBRELE(ubik_dbase); /* sleep for a little while */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif tv.tv_usec += 10000; safety++; DBHOLD(ubik_dbase); diff --git a/src/ubik/remote.c b/src/ubik/remote.c index c81cfb2..1ec2199 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -566,7 +566,7 @@ SDISK_SendFile(rxcall, file, length, avers) memcpy(&ubik_dbase->version, &tversion, sizeof(struct ubik_version)); while (length > 0) { tlen = (length > sizeof(tbuffer) ? sizeof(tbuffer) : length); -#if !defined(OLD_URECOVERY) && defined(AFS_PTHREAD_ENV) +#if !defined(OLD_URECOVERY) && !defined(AFS_PTHREAD_ENV) if (pass % 4 == 0) IOMGR_Poll(); #endif @@ -626,7 +626,11 @@ SDISK_SendFile(rxcall, file, length, avers) #endif memcpy(&ubik_dbase->version, avers, sizeof(struct ubik_version)); udisk_Invalidate(dbase, file); /* new dbase, flush disk buffers */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_cond_broadcast(&dbase->version_cond) == 0); +#else LWP_NoYieldSignal(&dbase->version); +#endif DBRELE(dbase); failed: if (code) { diff --git a/src/ubik/ubik.c b/src/ubik/ubik.c index 155b2e7..843abb7 100644 --- a/src/ubik/ubik.c +++ b/src/ubik/ubik.c @@ -32,6 +32,8 @@ RCSID #include "ubik.h" #include "ubik_int.h" +#include /* temporary hack by klm */ + #define ERROR_EXIT(code) {error=(code); goto error_exit;} /* This system is organized in a hierarchical set of related modules. Modules @@ -187,7 +189,17 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort, { register struct ubik_dbase *tdb; register afs_int32 code; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + pthread_t rxServerThread; /* pthread variables */ + pthread_t ubeacon_InteractThread; + pthread_t urecovery_InteractThread; + pthread_attr_t rxServer_tattr; + pthread_attr_t ubeacon_Interact_tattr; + pthread_attr_t urecovery_Interact_tattr; +#else PROCESS junk; +#endif + afs_int32 secIndex; struct rx_securityClass *secClass; @@ -220,6 +232,13 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort, ubik_dbase = tdb; /* for now, only one db per server; can fix later when we have names for the other dbases */ /* initialize RX */ + + /* the following call is idempotent so when/if it got called earlier, + * by whatever called us, it doesn't really matter -- klm */ + code = rx_Init(myPort); + if (code < 0) + return code; + ubik_callPortal = myPort; /* try to get an additional security object */ ubik_sc[0] = rxnull_NewServerSecurityObject(); @@ -235,9 +254,18 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort, } /* for backwards compat this should keep working as it does now and not host bind */ +#if 0 + /* This really needs to be up above, where I have put it. It works + * here when we're non-pthreaded, but the code above, when using + * pthreads may (and almost certainly does) end up calling on a + * pthread resource which gets initialized by rx_Init. The end + * result is that an assert fails and the program dies. -- klm + */ code = rx_Init(myPort); if (code < 0) return code; +#endif + tservice = rx_NewService(0, VOTE_SERVICE_ID, "VOTE", ubik_sc, 3, VOTE_ExecuteRequest); @@ -262,8 +290,17 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort, * UpdateInterfaceAddr RPC that occurs in ubeacon_InitServerList. This avoids * the "steplock" problem in ubik initialization. Defect 11037. */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) +/* do assert stuff */ + assert(pthread_attr_init(&rxServer_tattr) == 0); + assert(pthread_attr_setdetachstate(&rxServer_tattr, PTHREAD_CREATE_DETACHED) == 0); +/* assert(pthread_attr_setstacksize(&rxServer_tattr, rx_stackSize) == 0); */ + + assert(pthread_create(&rxServerThread, &rxServer_tattr, (void *)rx_ServerProc, NULL) == 0); +#else LWP_CreateProcess(rx_ServerProc, rx_stackSize, RX_PROCESS_PRIORITY, - (void *)0, "rx_ServerProc", &junk); + (void *)0, "rx_ServerProc", &junk); +#endif /* do basic initialization */ code = uvote_Init(); @@ -280,15 +317,41 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort, return code; /* now start up async processes */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) +/* do assert stuff */ + assert(pthread_attr_init(&ubeacon_Interact_tattr) == 0); + assert(pthread_attr_setdetachstate(&ubeacon_Interact_tattr, PTHREAD_CREATE_DETACHED) == 0); +/* assert(pthread_attr_setstacksize(&ubeacon_Interact_tattr, 16384) == 0); */ + /* need another attr set here for priority??? - klm */ + + assert(pthread_create(&ubeacon_InteractThread, &ubeacon_Interact_tattr, + (void *)ubeacon_Interact, NULL) == 0); +#else code = LWP_CreateProcess(ubeacon_Interact, 16384 /*8192 */ , LWP_MAX_PRIORITY - 1, (void *)0, "beacon", &junk); if (code) return code; +#endif + +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) +/* do assert stuff */ + assert(pthread_attr_init(&urecovery_Interact_tattr) == 0); + assert(pthread_attr_setdetachstate(&urecovery_Interact_tattr, PTHREAD_CREATE_DETACHED) == 0); +/* assert(pthread_attr_setstacksize(&urecovery_Interact_tattr, 16384) == 0); */ + /* need another attr set here for priority??? - klm */ + + assert(pthread_create(&urecovery_InteractThread, &urecovery_Interact_tattr, + (void *)urecovery_Interact, NULL) == 0); + + return 0; /* is this correct? - klm */ +#else code = LWP_CreateProcess(urecovery_Interact, 16384 /*8192 */ , LWP_MAX_PRIORITY - 1, (void *)0, "recovery", &junk); return code; +#endif + } int @@ -364,7 +427,11 @@ BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode, #endif return UNOQUORUM; /* a white lie */ } +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + sleep(2); +#else IOMGR_Sleep(2); +#endif DBHOLD(dbase); } #endif /* UBIK_PAUSE */ @@ -382,7 +449,13 @@ BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode, /* if we're writing already, wait */ while (dbase->flags & DBWRITING) { DBRELE(dbase); +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_mutex_lock(&dbase->flags_mutex) == 0); + assert(pthread_cond_wait(&dbase->flags_cond, &dbase->flags_mutex) == 0); + assert(pthread_mutex_unlock(&dbase->flags_mutex) == 0); +#else LWP_WaitProcess(&dbase->flags); +#endif DBHOLD(dbase); } if (!ubeacon_AmSyncSite()) { @@ -571,7 +644,11 @@ ubik_EndTrans(register struct ubik_trans *transPtr) code = 1; tv.tv_sec = 1; /* try again after a while (ha ha) */ tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); /* poll, should we wait on something? */ +#endif break; } } @@ -875,7 +952,13 @@ ubik_WaitVersion(register struct ubik_dbase *adatabase, /* wait until version # changes, and then return */ if (vcmp(*aversion, adatabase->version) != 0) return 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + assert(pthread_mutex_lock(&adatabase->version_mutex) == 0); + assert(pthread_cond_wait(&adatabase->version_cond,&adatabase->version_mutex) == 0); + assert(pthread_mutex_unlock(&adatabase->version_mutex) == 0); +#else LWP_WaitProcess(&adatabase->version); /* same vers, just wait */ +#endif } } diff --git a/src/ubik/ubik.p.h b/src/ubik/ubik.p.h index a6febe1..905819b 100644 --- a/src/ubik/ubik.p.h +++ b/src/ubik/ubik.p.h @@ -73,6 +73,8 @@ #ifdef AFS_PTHREAD_ENV #include #include +#else +#include #endif /* per-client structure for ubik */ @@ -170,6 +172,12 @@ struct ubik_dbase { int (*getnfiles) (struct ubik_dbase * adbase); /* find out number of files */ short readers; /* number of current read transactions */ struct ubik_version cachedVersion; /* version of caller's cached data */ +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + pthread_cond_t version_cond; /* condition variable to manage changes to version */ + pthread_cond_t flags_cond; /* condition variable to manage changes to flags */ + pthread_mutex_t version_mutex; + pthread_mutex_t flags_mutex; +#endif }; /* procedures for automatically authenticating ubik connections */ diff --git a/src/ubik/utst_client.c b/src/ubik/utst_client.c index 9387a35..6a0c86b 100644 --- a/src/ubik/utst_client.c +++ b/src/ubik/utst_client.c @@ -149,7 +149,11 @@ main(argc, argv) tv.tv_sec = 1; tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif printf("Repeating the SAMPLE operations again...\n"); } } else if (!strcmp(argv[i], "-mget")) { @@ -172,7 +176,11 @@ main(argc, argv) tv.tv_sec = 1; tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif } } } diff --git a/src/ubik/utst_server.c b/src/ubik/utst_server.c index eab0cef..a157abb 100644 --- a/src/ubik/utst_server.c +++ b/src/ubik/utst_server.c @@ -62,7 +62,11 @@ SAMPLE_Inc(rxconn) if (sleepTime) { tv.tv_sec = sleepTime; tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif } /* read the original value */ code = ubik_Read(tt, &temp, sizeof(afs_int32)); @@ -118,7 +122,11 @@ SAMPLE_Get(rxconn, gnumber) if (sleepTime) { tv.tv_sec = sleepTime; tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif } /* read the value */ code = ubik_Read(tt, &temp, sizeof(afs_int32)); @@ -161,7 +169,11 @@ SAMPLE_QGet(rxconn, gnumber) if (sleepTime) { tv.tv_sec = sleepTime; tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif } /* read the value */ code = ubik_Read(tt, &temp, sizeof(afs_int32)); @@ -201,7 +213,11 @@ SAMPLE_Trun(rxconn) if (sleepTime) { tv.tv_sec = sleepTime; tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif } /* shrink the file */ code = ubik_Truncate(tt, 0); @@ -242,7 +258,11 @@ SAMPLE_Test(rxconn) if (sleepTime) { tv.tv_sec = sleepTime; tv.tv_usec = 0; +#if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) + select(0, 0, 0, 0, &tv); +#else IOMGR_Select(0, 0, 0, 0, &tv); +#endif } /* read the original value */ code = ubik_Read(tt, &temp, sizeof(afs_int32)); diff --git a/src/util/Makefile.in b/src/util/Makefile.in index ccf3446..12eb951 100644 --- a/src/util/Makefile.in +++ b/src/util/Makefile.in @@ -14,7 +14,7 @@ objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \ hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \ dirpath.o fileutil.o netutils.o flipbase64.o fstab.o \ afs_atomlist.o afs_lhash.o snprintf.o strlcat.o strlcpy.o strnlen.o \ - daemon.o rxkstats.o ${REGEX_OBJ} + pthread_glock.o daemon.o rxkstats.o ${REGEX_OBJ} includes = \ ${TOP_INCDIR}/afs/dirpath.h \ @@ -62,6 +62,9 @@ util.a: ${objects} AFS_component_version_number.o $(AR) crv util.a ${objects} AFS_component_version_number.o $(RANLIB) util.a +pthread_glock.o: ${srcdir}/pthread_glock.c ${includes} + ${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c ${srcdir}/pthread_glock.c + assert.o: ${srcdir}/assert.c ${includes} ${CCOBJ} ${CFLAGS} -c ${srcdir}/assert.c diff --git a/src/util/pthread_glock.c b/src/util/pthread_glock.c index e6e6f78..5506082 100644 --- a/src/util/pthread_glock.c +++ b/src/util/pthread_glock.c @@ -44,6 +44,11 @@ pthread_recursive_mutex_lock(pthread_recursive_mutex_t * mut) { int rc = 0; +/* + * FSLog("Entered pthread_recursive_mutex_lock, thread id is %d\n", + * pthread_self()); + */ + (glock_init || pthread_once(&glock_init_once, glock_init_func)); if (mut->locked) { @@ -67,6 +72,12 @@ pthread_recursive_mutex_unlock(pthread_recursive_mutex_t * mut) { int rc = 0; +/* + * FSLog("Entered pthread_recursive_mutex_unlock, thread id is %d\n", + * pthread_self()); + * + */ + (glock_init || pthread_once(&glock_init_once, glock_init_func)); if ((mut->locked) && (pthread_equal(mut->owner, pthread_self()))) { diff --git a/src/util/pthread_glock.h b/src/util/pthread_glock.h index 1c9beea..a419684 100644 --- a/src/util/pthread_glock.h +++ b/src/util/pthread_glock.h @@ -42,6 +42,8 @@ extern int pthread_recursive_mutex_unlock(pthread_recursive_mutex_p); #else +#include + #define LOCK_GLOBAL_MUTEX #define UNLOCK_GLOBAL_MUTEX diff --git a/src/util/rxkstats.c b/src/util/rxkstats.c index fd181b1..2d6304c 100644 --- a/src/util/rxkstats.c +++ b/src/util/rxkstats.c @@ -4,6 +4,8 @@ #include #include -#ifndef AFS_PTHREAD_ENV +#ifndef AFS_PTHREAD_ENV struct rxkad_stats rxkad_stats = { { 0 } }; +#else +rxkad_stats_t rxkad_stats = { { 0 } }; #endif diff --git a/src/vlserver/Makefile.in b/src/vlserver/Makefile.in index d4d45a8..9e1475b 100644 --- a/src/vlserver/Makefile.in +++ b/src/vlserver/Makefile.in @@ -110,10 +110,18 @@ vlserver.h vl_errors.c: vl_errors.et vlserver.p.h system: install ${DEST}/root.server/usr/afs/bin/vlserver: vlserver - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install vlserver for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DEST}/etc/vldb_convert: cnvldb - ${INSTALL} -f $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install cnvldb for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${TOP_LIBDIR}/libvldb.a: libvldb.a ${INSTALL} $? $@ @@ -141,10 +149,18 @@ install: \ ${DESTDIR}${afssrvsbindir}/vldb_check ${DESTDIR}${afssrvlibexecdir}/vlserver: vlserver - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install vlserver for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DESTDIR}${afssrvsbindir}/vldb_convert: cnvldb - ${INSTALL} -f $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install cnvldb for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi ${DESTDIR}${libdir}/afs/libvldb.a: libvldb.a ${INSTALL} $? $@ @@ -162,7 +178,11 @@ ${DESTDIR}${includedir}/afs/cnvldb.h: cnvldb.h ${INSTALL} $? $@ ${DESTDIR}${afssrvsbindir}/vldb_check: vldb_check - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install vldb_check for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi dest: \ ${DEST}/root.server/usr/afs/bin/vlserver \ @@ -190,7 +210,11 @@ ${DEST}/include/afs/cnvldb.h: cnvldb.h ${INSTALL} $? $@ ${DEST}/etc/vldb_check: vldb_check - ${INSTALL} $? $@ + @if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \ + echo "Don't install vldb_check for ${SYS_NAME}" ; \ + else \ + ${INSTALL} $? $@ ; \ + fi # # Misc targets diff --git a/src/vlserver/vlprocs.c b/src/vlserver/vlprocs.c index 5e0f125..a2fc38b 100644 --- a/src/vlserver/vlprocs.c +++ b/src/vlserver/vlprocs.c @@ -1135,7 +1135,9 @@ SVL_ListAttributes(rxcall, attributes, nentries, vldbentries) while (nextblockindex = NextEntry(trans, nextblockindex, &tentry, &count)) { if (++pollcount > 50) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollcount = 0; } match = 0; @@ -1273,7 +1275,9 @@ SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries) while (nextblockindex = NextEntry(trans, nextblockindex, &tentry, &count)) { if (++pollcount > 50) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollcount = 0; } @@ -1455,7 +1459,9 @@ SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries, blockindex = startindex; while (blockindex = NextEntry(trans, blockindex, &tentry, &count)) { if (++pollcount > 50) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollcount = 0; } @@ -1677,7 +1683,9 @@ SVL_LinkedList(rxcall, attributes, nentries, vldbentries) match = 0; if (++pollcount > 50) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollcount = 0; } @@ -1803,7 +1811,9 @@ SVL_LinkedListN(rxcall, attributes, nentries, vldbentries) match = 0; if (++pollcount > 50) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollcount = 0; } @@ -3190,7 +3200,9 @@ ChangeIPAddr(ipaddr1, ipaddr2, atrans) for (blockindex = NextEntry(atrans, 0, &tentry, &count); blockindex; blockindex = NextEntry(atrans, blockindex, &tentry, &count)) { if (++pollcount > 50) { +#ifndef AFS_PTHREAD_ENV IOMGR_Poll(); +#endif pollcount = 0; } for (j = 0; j < NMAXNSERVERS; j++) { diff --git a/src/vlserver/vlserver.c b/src/vlserver/vlserver.c index 2be4314..f8d66e3 100644 --- a/src/vlserver/vlserver.c +++ b/src/vlserver/vlserver.c @@ -74,7 +74,11 @@ afs_uint32 SHostAddrs[ADDRSPERSITE]; static void CheckSignal_Signal() { +#if defined(AFS_PTHREAD_ENV) + CheckSignal(0); +#else IOMGR_SoftSig(CheckSignal, 0); +#endif } static void * -- 1.9.4