From: danw Date: Mon, 20 Jan 1997 18:24:10 +0000 (+0000) Subject: Solaris/POSIX changes X-Git-Tag: MOIRA4_INITIAL~3 X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/e2666aac2373e4c19037766b88fecf97b9f81825 Solaris/POSIX changes --- diff --git a/incremental/Imakefile b/incremental/Imakefile index 9fd2732b..f026a728 100644 --- a/incremental/Imakefile +++ b/incremental/Imakefile @@ -4,13 +4,14 @@ AFSDIR = /mit/afsuser AFSLIBS=$(AFSDIR)/lib/afs/libprot.a $(AFSDIR)/lib/afs/libauth.a \ $(AFSDIR)/lib/libubik.a $(AFSDIR)/lib/afs/util.a \ $(AFSDIR)/lib/librxkad.a $(AFSDIR)/lib/afs/libsys.a \ - $(AFSDIR)/lib/librx.a $(AFSDIR)/lib/liblwp.a + $(AFSDIR)/lib/librx.a $(AFSDIR)/lib/liblwp.a \ + $(AFSDIR)/lib/afs/libaudit.a -lbsd SRCS = afs.c ksrvtgt.c CODE = $(SRCS) DEBUG = -O -CFLAGS = -I../include -I$(AFSDIR)/include -I/usr/athena/include $(DEBUG) -LIBS = -L../lib -L/usr/athena/lib -lmoira -lzephyr -lmrgdb -lcom_err -lhesiod -lkrb -ldes +CFLAGS = -I../include -I../lib -I$(AFSDIR)/include -I/usr/athena/include $(DEBUG) +LIBS = -L../lib -L../gdb -L/usr/athena/lib -lmoira -lzephyr -lmrgdb -lcom_err -lhesiod -lkrb -ldes SRCDIR = $(SRCTOP)/incremental program(afs.incr,afs.o,,${AFSLIBS} ${LIBS},${PROGDIR}) diff --git a/incremental/afs.c b/incremental/afs.c index fcdcd78a..f55bf199 100644 --- a/incremental/afs.c +++ b/incremental/afs.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -44,7 +45,7 @@ int add_user_lists(); int add_list_members(); int check_user(); int edit_group(); -int pr_try(); +long pr_try(); int check_afs(); /* libprot.a routines */ @@ -78,7 +79,7 @@ int argc; for (i = getdtablesize() - 1; i > 2; i--) close(i); - whoami = ((whoami = rindex(argv[0], '/')) ? whoami++ : argv[0]); + whoami = ((whoami = strrchr(argv[0], '/')) ? whoami+1 : argv[0]); table = argv[1]; beforec = atoi(argv[2]); @@ -86,7 +87,7 @@ int argc; afterc = atoi(argv[3]); after = &argv[4 + beforec]; - setlinebuf(stdout); + setvbuf(stdout, NULL, _IOLBF, BUFSIZ); strcpy(tbl_buf, table); strcat(tbl_buf, " ("); @@ -113,7 +114,7 @@ int argc; do_user(before, beforec, after, afterc); } else if (!strcmp(table, "list")) { do_list(before, beforec, after, afterc); - } else if (!strcmp(table, "members")) { + } else if (!strcmp(table, "imembers")) { do_member(before, beforec, after, afterc); } else if (!strcmp(table, "filesys")) { do_filesys(before, beforec, after, afterc); @@ -603,7 +604,7 @@ long pr_try(fn, a1, a2, a3, a4, a5, a6, a7, a8) char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; { static int initd=0; - volatile register long code; + register long code; register int tries = 0; #ifdef DEBUG char fname[64]; @@ -685,12 +686,8 @@ moira_connect() long code; if (!mr_connections++) { -#ifdef DEBUG - code = mr_connect("moira"); -#else gethostname(hostname, sizeof(hostname)); code = mr_connect(hostname); -#endif if (!code) code = mr_auth("afs.incr"); return code; } diff --git a/incremental/afs_create.pl b/incremental/afs_create.pl index 59e0cfed..09d9c7a3 100644 --- a/incremental/afs_create.pl +++ b/incremental/afs_create.pl @@ -131,8 +131,8 @@ sub athena_proc } if ($type =~ /ACTIVITY|APROJ|PROJECT/) { - chown($gid,0,$path) || - die "Unable to set volume ownership\n"; + system("/moira/bin/uchown $path $gid"); + die "Unable to set volume ownership\n" if ($?); } elsif ($type =~ /HOMEDIR|UROP/) { chown($uid,0,$path) || die "Unable to set volume ownership\n"; diff --git a/incremental/afs_quota.pl b/incremental/afs_quota.pl index 893343e6..3a25816d 100644 --- a/incremental/afs_quota.pl +++ b/incremental/afs_quota.pl @@ -1,8 +1,7 @@ #!/afs/athena/contrib/perl/perl # Usage: afs_quota path quota -$incdir = "/mit/moiradev/src/incremental"; -require "$incdir/afs_utils.pl"; +require "/moira/bin/afs_utils.pl"; die "Usage: $0 path quota\n" unless (@ARGV==2); diff --git a/incremental/afs_utils.pl b/incremental/afs_utils.pl index 06cbecb0..bdd5a2d2 100644 --- a/incremental/afs_utils.pl +++ b/incremental/afs_utils.pl @@ -1,5 +1,9 @@ # $Header$ +# kludge kludge kludge +sub __STDC__ {0;} +require "fcntl.ph"; + $afsbin="/moira/bin"; $vos="$afsbin/vos"; $pts="$afsbin/pts"; @@ -9,9 +13,6 @@ $zwrite="/usr/athena/bin/zwrite"; $afs_data="/moira/afs/afs_data"; $afs_save="$afs_data.tmp"; -$LOCK_EX=2; -$LOCK_UN=8; - %vtypes_ATHENA_MIT_EDU = ("ACTIVITY", "activity", "APROJ", "aproj", @@ -42,11 +43,17 @@ $LOCK_UN=8; # 8. Close the data file. +$flock_t="ssllllllll"; + sub afs_lock { open(SRV,"+<$afs_data") || die "Unable to open $afs_data\n"; select((select(SRV), $|=1)[$[]); - flock(SRV, $LOCK_EX) || die "Unable to lock $afs_data\n"; + $flkarr[0]=&F_WRLCK; + $flkarr[1]=$flkarr[2]=$flkarr[3]=$flkarr[4]=$flkarr[5]=$flkarr[6]=0; + $flkarr[7]=$flkarr[8]=$flkarr[9]=0; + $flk=pack($flock_t,@flkarr); + fcntl(SRV, &F_SETLKW, $flk) || die "Unable to lock $afs_data:$!\n"; die "Temporary status file: $afs_save exists... aborting\n" if (-f $afs_save); open(SRV2, ">$afs_save"); diff --git a/incremental/ksrvtgt.c b/incremental/ksrvtgt.c index 4c611a9f..bae09a47 100644 --- a/incremental/ksrvtgt.c +++ b/incremental/ksrvtgt.c @@ -41,8 +41,8 @@ main(argc,argv) int i, lifetime = 1; char srvtab[MAXPATHLEN + 1]; - bzero(realm, sizeof(realm)); - bzero(srvtab, sizeof(srvtab)); + memset(realm, 0, sizeof(realm)); + memset(srvtab, 0, sizeof(srvtab)); if (argc < 3) usage(argv);