Permalink
Browse files

This commit was manufactured by cvs2svn to create branch

'jaltman-ccapi'.

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/jaltman-ccapi@16820 dc483132-0cff-0310-8789-dd5450dbe970
  • Loading branch information...
(no author)
(no author) committed Oct 14, 2004
1 parent b3088f5 commit 4d36cb3b2343a8d4540390c0bd355d65f7c3aae4
Showing with 0 additions and 838 deletions.
  1. +0 −4 src/tests/threads/ChangeLog
  2. +0 −39 src/tests/threads/Makefile.in
  3. +0 −143 src/tests/threads/t_rcache.c
  4. +0 −652 src/util/db2/test/Makefile
@@ -1,4 +0,0 @@
-2004-08-03 Ken Raeburn <raeburn@mit.edu>
-
- * Makefile.in, t_rcache.c: New files.
-
@@ -1,39 +0,0 @@
-thisconfigdir=./..
-myfulldir=tests/threads
-mydir=threads
-BUILDTOP=$(REL)..$(S)..
-PROG_LIBPATH=-L$(TOPLIBD)
-PROG_RPATH=$(KRB5_LIBDIR)
-
-RUN_SETUP = @KRB5_RUN_ENV@
-
-SRCS=$(srcdir)/t_rcache.c
-
-all::
-
-N = 4
-run-t_rcache: t_rcache
- $(RUN_SETUP) ./t_rcache -n $(N)
-
-t_rcache: t_rcache.o $(KRB5_BASE_DEPLIBS)
- $(CC_LINK) -o t_rcache t_rcache.o $(KRB5_BASE_LIBS) -lpthread
-
-syms: syms.o
- $(CC_LINK) -o syms syms.o
-
-run-syms: syms
- $(RUN_SETUP) ./syms
-
-check-unix:: run-t_rcache
-
-install::
-
-clean::
- $(RM) t_rcache.o t_rcache
-
-# +++ Dependency line eater +++
-#
-# Makefile dependencies follow. This must be the last section in
-# the Makefile.in file
-#
-
@@ -1,143 +0,0 @@
-#include <stdio.h>
-#include <com_err.h>
-#include <krb5.h>
-#include "k5-int.h"
-#include <pthread.h>
-
-krb5_context ctx;
-krb5_rcache rcache;
-krb5_data piece = { .data = "hello", .length = 5 };
-time_t end_time;
-const char *prog;
-
-struct tinfo {
- time_t now;
- unsigned long my_ctime;
- unsigned int my_cusec;
- unsigned int total;
- int idx;
-};
-
-#undef INIT_ONCE
-
-static void try_one (struct tinfo *t)
-{
- krb5_donot_replay r;
- krb5_error_code err;
- char buf[100], buf2[100];
- krb5_rcache my_rcache;
-
- sprintf(buf, "host/all-in-one.mit.edu/%p@ATHENA.MIT.EDU", buf);
- r.server = buf;
- r.client = (t->my_cusec & 7) + "abcdefgh@ATHENA.MIT.EDU";
- if (t->now != t->my_ctime) {
- if (t->my_ctime != 0) {
- sprintf(buf2, "%3d: %ld %5d\n", t->idx, t->my_ctime, t->my_cusec);
- printf("%s", buf2);
- }
- t->my_ctime = t->now;
- t->my_cusec = 1;
- } else
- t->my_cusec++;
- r.ctime = t->my_ctime;
- r.cusec = t->my_cusec;
-#ifndef INIT_ONCE
- err = krb5_get_server_rcache(ctx, &piece, &my_rcache);
- if (err) {
- com_err(prog, err, "getting replay cache");
- exit(1);
- }
-#else
- my_rcache = rcache;
-#endif
- err = krb5_rc_store(ctx, my_rcache, &r);
- if (err) {
- com_err(prog, err, "storing in replay cache");
- exit(1);
- }
-#ifndef INIT_ONCE
- krb5_rc_close(ctx, my_rcache);
-#endif
-}
-
-static void *run_a_loop (void *x)
-{
- struct tinfo t = { 0 };
-/* int chr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"[(*(int*)x) % 27]; */
-
- t.now = time(0);
- t.idx = *(int *)x;
- while (t.now != time(0))
- ;
- t.now = time(0);
- while (t.now < end_time) {
- t.now = time(0);
- try_one(&t);
- t.total++;
-/* printf("%c", chr); */
- fflush(stdout);
- }
- printf("thread %p total %u\n", &t, t.total);
- *(int*)x = t.total;
- return 0;
-}
-
-int main (int argc, char *argv[])
-{
- int n;
- krb5_error_code err;
- int interval = 20 /* 5 * 60 */;
-
- prog = argv[0];
- unlink("/var/tmp/rc_hello_7882");
- unlink("/var/tmp/hello_7882");
- n = 2;
- err = krb5_init_context(&ctx);
- if (err) {
- com_err(prog, err, "initializing context");
- return 1;
- }
-#ifdef INIT_ONCE
- err = krb5_get_server_rcache(ctx, &piece, &rcache);
- if (err) {
- com_err(prog, err, "getting replay cache");
- return 1;
- }
-#endif
- end_time = time(0) + interval;
-#undef DIRECT
-#ifdef DIRECT
- {
- int zero = 0;
- run_a_loop(&zero);
- }
-#else
- {
- int i, *ip;
-
- ip = malloc(sizeof(int) * n);
- if (ip == 0 && n > 0) {
- perror("malloc");
- exit(1);
- }
- for (i = 0; i < n; i++)
- ip[i] = i;
-
- for (i = 0; i < n; i++) {
- pthread_t new_thread;
- int perr;
- perr = pthread_create(&new_thread, 0, run_a_loop, &ip[i]);
- if (perr) {
- errno = perr;
- perror("pthread_create");
- exit(1);
- }
- }
- while (time(0) < end_time + 1)
- sleep(1);
- for (i = 0; i < n; i++)
- printf("thread %d total %5d\n", i, ip[i]);
- }
-#endif
- return 0;
-}
Oops, something went wrong.

0 comments on commit 4d36cb3

Please sign in to comment.