[Python-Dev] Missing POSIX functions: the list

Fred L. Drake, Jr. fdrake@acm.org
Thu, 9 Dec 1999 17:30:52 -0500 (EST)


Andrew M. Kuchling writes:
 > After poking around in the O'Reilly POSIX book, here's a list of POSIX

  Ok, here's my comments on the remainder of these.

 > Worth adding?
 > =============
 > opendir(), readdir(), closedir() -- 
 > 	   most of their functionality is available through
 > 	   os.listdir(), but it might be useful to have a direct
 > 	   interface.  Downside is that this would require a new
 > 	   extension type for the C DIR struct.  My (lazy) inclination
 > 	   is to not bother.

  [rewinddir() and seekdir() should be considered as well, where
supported.]

  There's more tedium than anything in implementing a new C type.  I'm 
a little concerned that there might not be any real value here, but
it's hard to be sure about that.  Is there any real reason not to use
os.listdir().

 > Worth adding:
 > =============
...
 > fpathconf(fd, name) -- Get configuration limit for a file
 > 	    -- would need constants from unistd.h

  This is mostly a matter of setting up the constants; not hard, just
more distracting than I want to deal with right now.

 > getlogin() -- returns user's login name
 > 	 -- could do something similar with pwd.getpwuid( os.getuid() )[0], but
 > 	 getlogin() apparently looks in utmp

  Per Guido's comments, I'm not sure how valuable it is.  It may make
sense strictly for completeness, but I've never heard of utmp being
considered reliable in any way.  Maybe I'm too new at all this.

 > getgroups(gidsetsize, grouplist) -- Gets supplementary group IDs

  This should be easy enough.

 > pathconf(path, name) -- Gets config variables for a path
 > 	    -- would need constants from unistd.h

  (Same as for fpathconf().)

 > sysconf(int name) -- Gets system configuration information
 > 	    -- would need constants from unistd.h
 > 
 > Not worth adding:
 > =================

  Aside from the ones I've already added, I agree.  ;)


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives