Date: Thu, 2 Oct 1997 15:35:50 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: syssgm@dtir.qld.gov.au (Stephen McKay) Cc: tlambert@primenet.com, freebsd-hackers@FreeBSD.ORG, syssgm@dtir.qld.gov.au Subject: Re: Sysctl variables Message-ID: <199710021535.IAA13987@usr05.primenet.com> In-Reply-To: <199710020949.TAA08205@troll.dtir.qld.gov.au> from "Stephen McKay" at Oct 2, 97 07:49:47 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> >> I can use "ps -ef" or "ps axl" any time I like. This stuff I'll help with. > > > >I use "-gax". If the "no '-' convention is used to distinguish them, > >there will be a lot of losers... > > *giggle* Puzzled by the 'g' in your command I checked the source. > > case 'g': > break; /* no-op */ > > Did you add that one? :-) No. Berkeley did. -g Display all processes. Without this option, ps prints only "interesting" processes. Processes are deemed to be uninteresting if they are process group leaders. This normally eliminates top-level command interpreters and processes waiting for users to login on free termi- nals. > OK, it's a bummer if you already use the '-' prefix with BSD. That makes > the hybrid less attractive, and I suppose "ps" would check to see if it is > running as "s5ps" before using the SysV command syntax. I would still be > happy to see the DEC variant imported anyway. Us oldies still use ps and > tar without '-', and newbies probably try 'ps -ef' anyway. > >Palladioum, from Project Athena at MIT. The only real problem with it > >is that it soes not specify a general queue management subsystem upon > >which it is layered. Garrett Wollman and I happen to agree on printing > >models (from conversations of 3 or more years ago). > > It's not a port yet. Is the source easy to get? Web searching got me hits > on chemical engineering processes, rock music, and role playing games. :-( > Yes, I even tried it spelt "palladioum" and got a Greek hotel, and something > that sounded catchy but was actually very dull called "Gretchen goes to the > Internet". I suppose the Internet is still the future, not the present... Well, the 'o' was a typo. I "don't know" how easy the code from Project Athena is to get... let's see... can you tel me where to get X Windows? That's out of Athena, too. 8-) 8-). > The idea of a Linux ABI Universe that has some programs I want to use while > not having other programs I want to use is 1) a likely event, and 2) a pain. > If you are proposing the sort of either/or dual universe that Pyramid had, > then I am completely opposed. The current linux emulator does a good job > for me with minimal file system aberration. The FS aberration for Linux emulation currently impacts all system calls which take file name arguments: open, creat, link, unlink, chdir, mknod, chmod, chown, mount, unmount, access, chflags, stat, lstat, acct, revoke, symlink, readlink, chroot, truncate, ftruncate, mkfifo, mkdir, rmdir, utimes, quotactl, statfs pathconf, undelete, and lchown. This means that, even if the call is functionally identical to the FreeBSD call, a stub must exist for each of these calls supported by the emulated ABI, times the number of ABI's. A variant symlink approach that set the process local name that was used to process the non-relative path roots would mean a single change to namei(), instead of all these stubs. > >The lack of (effectively) "logical name tables" is what is screwing you. > > Are you suggesting something with a Plan 9 flavour where each process sees > a different file system name space? Interesting idea, but too radical to > wedge into FreeBSD and still call it FreeBSD. No, I'm suggesting that we do away with external access to envp, and hang the environment off the proc struct instead. Then the process group leader's environment is the group logical name table, and the init process' environmnet is the system logical name table. Hopefully, you replace the initial process exec at login with a session manager, but it's not mandatory (only very, very useful) to have one. It solves the "how do I set global environment variables" proble, the "how do I change my paren't environment" problem, the "how do I access environment variables from the kernel when envp may have changed" problem, the "where do I stick session management information, like 'SMBFS' and 'NetWare' credentials" problem, the "how do I share an environment between siblings with the same parent" problem, and a host of others. The only thing you loses is the ability to manipulate the environment directly by hacking on envp instead of using the environment manipulation functions like you were supposed to be doing in the first place. You can build an environment by iterating (not shown here) the current processes table, and building an envp. Ideally, you would use a vfork instead, and do the manipulation prior to the exec on an inherited copy of the parent's environment, but you can't fight City Hall (in this case, POSIX's definition of execve(2)). Plus, it's pretty trivial to implement, assuming a call to get at these tables exists, and these tables are maintained in the same form as they are maintained currently in libc; the replacement libc code looks like: -------------------------------------------------------------------------- /* * getenv -- * Returns ptr to value associated with name, if any, else NULL. */ char * getenv(name) const char *name; { static char ret[ LNM_GET_MAX]; struct lnm_get_arg get; /* * search all tables on lookup; cariables set in LNM_TYPE_PROCESS * overrides LNM_TYPE_GROUP overrides LNM_TYPE_SYSTEM */ get.name = name; /* name to get*/ get.buf = ret; /* store it here*/ get.bufsize = LNM_MAX_GET; /* max of this many*/ get.flags = LNM_FLAG_INHERIT; /* inherit values*/ get.table = LNM_TYPE_ANY; /* name table to use*/ if( syslnm( LNM_CMD_GET, (caddr_t)&get)) return( NULL); else return( ret); } int putenv(str) const char *str; { struct lnm_set_arg set; char *p, *equal; int rval; if ((p = strdup(str)) == NULL) return (-1); if ((equal = index(p, '=')) == NULL) { (void)free(p); return (-1); } *equal = '\0'; /* * set only in LNM_TYPE_PROCESS; use syslnm() instead of * putenv() to access other spaces; credentials are enforced */ set.name = name; /* name to set*/ set.buf = equal + 1; /* value to assign*/ set.flags = LNM_FLAG_REPLACE; /* replae if exists*/ set.table = LNM_TYPE_PROCESS; /* process name table*/ rval = syslnm( LNM_CMD_SET, (caddr_t)&set); (void)free(p); return (rval); } /* * setenv -- * Set the value of the environmental variable "name" to be * "value". If rewrite is set, replace any current value. */ setenv(name, value, rewrite) register const char *name; register const char *value; int rewrite; { struct lnm_set_arg set; /* * set only in LNM_TYPE_PROCESS; use syslnm() instead of * setenv() to access other spaces; credentials are enforced */ set.name = name; /* name to set*/ set.buf = value; /* value to assign*/ set.flags = ( rewrite ? LNM_FLAG_REPLACE : 0); /* conditionally replace*/ set.table = LNM_TYPE_PROCESS; /* process name table*/ return( syslnm( LNM_CMD_SET, (caddr_t)&set)); } /* * unsetenv(name) -- * Delete environmental variable "name". */ void unsetenv(name) const char *name; { struct lnm_del_arg del; /* * remove only in LNM_TYPE_PROCESS; use syslnm() instead of * unsetenv() to access other spaces; credentials are enforced */ del.name = name; /* name to delete*/ del.flags = 0; /* no flags*/ del.table = LNM_TYPE_PROCESS; /* delete from process*/ (void)syslnm( LNM_CMD_UNSET, (caddr_t)&del); } -------------------------------------------------------------------------- Other types of access, and ideally, any new code's access, is via the syslnm() call. Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710021535.IAA13987>