Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!haven!adm!news From: Postmaster%BRFAPESP.BITNET@uicvm.uic.edu (PMDF Mail Server) Newsgroups: comp.unix.internals Subject: Undeliverable mail Message-ID: <24375@adm.BRL.MIL> Date: 3 Sep 90 22:22:19 GMT Sender: news@adm.BRL.MIL Lines: 62 Your message could not be delivered to: Multiple recipients of list UNIX-WIZ Your message has been enqueued and undeliverable for 12 days. No further attempts will be made to deliver your messsage. Your entire message follows: /* * This is being run on a Sun SS1 under 4.0.3. * Theoretically, according to the Design & Implementation of 4.3BSD Unix, * this should print out the ascii version of each process's current * directory...instead, it chokes on u->u_cwd->cw_dir, which is in the * u struct in sys/user.h .. any help, suggestions, etc would be greatly * appreciated. */ /* * cc -o cwd cwd.c -lkvm */ #include #include #include #include #include #include #include #include #include main (argc, argv) { *argv); exit (1); } (void) printf("Name\t\tDir\n"); kvm_setproc (kd); while ((proc = kvm_nextproc (kd))) if (proc->p_stat != SZOMB && proc->p_uid) { if (!(user = kvm_getu(kd, proc))) continue; (void) printf("%s\n", (getpwuid(proc->p_uid))->pw_name); /* Curtains & Slow Music */ (void) printf("%s\n", user->u_cwd->cw_dir); /* It dies, but the user structure's fine (printing user->u_comm works); I stepped thru it with gdb & discovered that the pointer user->u_cwd is off in never-never-land; is it a valid entry in the user structure? */ } }