Commit Graph

146 Commits

Author SHA1 Message Date
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Guido van Rossum 64529cd7ce Crude way to fix a problem on AIX: #undef STAT before defining it. 2000-06-30 22:45:12 +00:00
Fred Drake 699f352fb2 Trent Mick <trentm@activestate.com>:
This patch fixes the posix module for large file support mainly on
Win64, although some general cleanup is done as well.

The changes are:

- abstract stat->STAT, fstat->FSTAT, and struct stat->STRUCT_STAT
This is because stat() etc. are not the correct functions to use on
Win64 (nor maybe on other platforms?, if not then it is now trivial to
select the appropriate one). On Win64 the appropriate system functions
are _stati64(), etc.

- add _pystat_fromstructstat(), it builds the return tuple for the
fstat system call. This functionality was being duplicated. As well
the construction of the tuple was modified to ensure no overflow of
the time_t elements (sizeof(time_t) > sizeof(long) on Win64).

- add overflow protection for the return values of posix_spawnv and
posix_spawnve

- use the proper 64-bit capable lseek() on Win64

- use intptr_t instead of long where appropriate from Win32/64 blocks
(sizeof(void*) > sizeof(long) on Win64)

This closes SourceForge patch #100513.
2000-06-29 21:12:41 +00:00
Fred Drake 8cef4cf737 Thomas Wouters <thomas@xs4all.net>:
This patch adds the openpty() and forkpty() library calls to posixmodule.c,
when they are available on the target
system. (glibc-2.1-based Linux systems, FreeBSD and BSDI at least, probably
the other BSD-based systems as well.)

Lib/pty.py is also rewritten to use openpty when available, but falls
back to the old SGI method or the "manual" BSD open-a-pty
code. Openpty() is necessary to use the Unix98 ptys under Linux 2.2,
or when using non-standard tty names under (at least) BSDI, which is
why I needed it, myself ;-) forkpty() is included for symmetry.
2000-06-28 16:40:38 +00:00
Andrew M. Kuchling 54c8dc2144 Patch from Trent Mick:
Fix a small bug in posixmodule.c where a char* is being
	dereferenced where it should not be.
2000-06-06 20:52:17 +00:00
Fred Drake 137507ea03 Michael Hudson <mwh21@cam.ac.uk>:
Removed PyErr_BadArgument() calls and replaced them with more useful
error messages.
2000-06-01 02:02:46 +00:00
Guido van Rossum 19dde103a8 Mark Hammond to the rescue:
Checkin 2.131 of posixmodule.c changed os.stat on Windows, so that
"/bin/" type notation (trailing backslash) would work on Windows to
be consistent with Unix.

However, the patch broke the simple case of: os.stat("\\")

This did work in 1.5.2, and obviously should!

This patch addresses this, and restores the correct behaviour.
2000-05-03 02:44:55 +00:00
Barry Warsaw 3cef856dd9 posix_utime(): Allow the second argument to be None, which invokes the
utime(path, NULL) call, setting the atime and mtime of the file to the
current time.  The previous signature utime(path, (atime, mtime)) is
of course still allowed.
2000-05-01 16:17:24 +00:00
Guido van Rossum 50422b403c Michael Hudson:
This patch changes posixmodule.c:execv to

a) check for zero length args (does this to execve, too), raising
   ValueError.

b) raises more rational exceptions for various flavours of duff arguments.
   I *hate*
      TypeError: "illegal argument type for built-in operation"
   It has to be one of the most frustrating error messages ever.
2000-04-26 20:34:28 +00:00
Guido van Rossum ace88aebbb Patch by Brian Hooper, somewhat augmented by GvR, to strip a trailing
backslash from the pathname argument to stat() on Windows -- while on
Unix, stat("/bin/") succeeds and does the same thing as stat("/bin"),
on Windows, stat("\\windows\\") fails while stat("\\windows") succeeds.
This modified version of the patch recognizes both / and \.

(This is odd behavior of the MS C library, since
os.listdir("\\windows\\") succeeds!)
2000-04-21 18:54:45 +00:00
Barry Warsaw 3155db3b79 setup_confname_table(): Close memory leak caused by not decref'ing the
inserted dictionary values.  Also, simplified the logic a bit.
2000-04-13 15:20:40 +00:00
Guido van Rossum ef40e77ac5 Sigh. On Windows, (mode_t)i fails. Assume that there's a prototype
in scope on systems where mode_t isn't the same size as int...
2000-03-31 01:26:23 +00:00
Guido van Rossum 49679b40b9 Oops, the previous patch contained a bug in chmod. Fixed now. 2000-03-31 00:48:21 +00:00
Guido van Rossum ffd15f5255 Two robustness patches:
(1) In opendir(), don't call the lock-release macros; we're
manipulating list objects and that shouldn't be done in unlocked
state.

(2) Don't use posix_strint() for chmod() -- the mode_t arg might be a
64 bit int (reported by Nick Maclaren).
2000-03-31 00:47:28 +00:00
Greg Ward b48bc17d10 Second attempt to fix the ctermid_r/tmpnam_r warnings: define USE_CTERMID_R
and USE_TMPNAM_R at the top of the file and refer to them later; this
catches a second reference to 'tmpnam_r' that I didn't spot first time around.
2000-03-01 21:51:56 +00:00
Greg Ward 9217fcbb38 Fix compiler warning: only use "_r" form of 'ctermid()' and 'tmpnam()' when
building a threaded Python.
2000-03-01 18:59:47 +00:00
Guido van Rossum 4985e40939 Delete references to _SC_AIO_LIST_MAX; it appears that that symbol was
just a typo in some Linux header; the real symbol is
_SC_AIO_LISTIO_MAX.
2000-02-25 17:51:00 +00:00
Guido van Rossum b3d3956e01 The initialization of posix_putenv_garbage should only be done when it
is defined...
2000-01-31 18:41:26 +00:00
Fred Drake e1a79b9b42 setup_confname_table(): Use size_t instead of int for an index when
building the dicts used to inform the user about the defined
        constants when using the *conf*() APIs.

Thanks to Mark Hammond <mhammond@skippinet.com.au>.
1999-12-30 18:05:43 +00:00
Fred Drake bec628d4bc Rip out the code to check the ordering of the tables used to map
strings to integers for the *conf*() functions.

Added code to sort the tables at module initialization.  Three
dictionaries, confstr_names, sysconf_names, and pathconf_names, are
added to the module as well.  These map known configuration setting
names to the numeric value which is used to represent the setting in
the system call.  This code is always called.

Updated related comments.
1999-12-15 18:31:10 +00:00
Fred Drake d86ed29f44 Added table entries for Irix 6.5 names for confstr()/sysconf()/
pathconf() names, from Sjoerd.

Added code to verify that these tables are properly ordered, only
included and used when CHECK_CONFNAME_TABLES is defined.  This is only
needed to test the tables, so I haven't enabled this by default.
1999-12-15 15:34:33 +00:00
Fred Drake 12c6e2d497 Added support for getlogin(); does *not* use getlogin_r() where
available since the interface is poorly defined on at least one major
platform (Solaris).

Moved table of constant names for fpathconf() & pathconf() into the
conditional that defines the conv_path_confname() helper; Mark Hammond
reported that defining the table when none of the constants were
defined causes the compiler to complain (won't allow 0-length array,
imagine that!).

In posix_fpathconf(), use conv_path_confname() as the O& conversion
function, instead of the conv_confname() helper, which has the wrong
signature (posix_pathconf() already used the right thing).
1999-12-14 21:25:03 +00:00
Fred Drake 71f00fb6df Removed debugging prints. 1999-12-13 16:55:24 +00:00
Fred Drake c968092d5c Added bindings for getgroups(), fpathconf(), pathconf(), confstr(),
and sysconf().

*Lots* of tables to define names used by *conf*(); explanation to go
in message to python-dev list.
1999-12-13 16:37:25 +00:00
Fred Drake 5ab8eaf0bb Added support for abort(), ctermid(), tmpfile(), tempnam(), tmpnam(),
and TMP_MAX.

Converted all functions that used PyArg_Parse() or PyArg_NoArgs() to
use PyArg_ParseTuple() and specified all function names using the
:name syntax in the format strings, to allow better error messages
when TypeError is raised for parameter type mismatches.
1999-12-09 21:13:07 +00:00
Guido van Rossum d5753e15e2 John DuBois tells us that SCO OpenServer 5.0 and later requires _SVID3
before it reveals the needed definitions in sys/statvfs.h.
1999-10-19 13:29:23 +00:00
Fred Drake 762e206706 posix_putenv(): Constrain memory leakage when setting the same
environment variable repeatedly.  I posted this to the list
        some time ago, but only now got around to asking g--d- what he
        thought about it.
1999-08-26 17:23:54 +00:00
Guido van Rossum 6a619f44c5 It turns out that modifying the environment strings is not safe.
Treat them as read-only, and make a copy as appropriately.  This was
first reported by Bill Janssend and later by Craig Rowland and Ron
Sedlmeyer.  This fix is mine.
1999-08-03 19:41:10 +00:00
Guido van Rossum 9068da4b6d Milton L. Hankin reports that on Windows it is possible to have two
different values in the environ dict with the same key (although he
couldn't explain exactly how this came to be).  Since getenv() uses
the first one, Python should do too. (Some doubts about case
sensitivity, but for now this at least seems the right thing to do
regardless of platform.)
1999-07-02 02:54:02 +00:00
Barry Warsaw f63b8cc07c posix_listdir(): When an error occurs, call
posix_error_with_filename() instead of posix_error(), passing in the
name argument, so you get information on which directory was being
listed.
1999-05-27 23:13:21 +00:00
Guido van Rossum 8c67e4e8c9 Add extern decl for fsync() for SunOS 4.x. 1999-04-07 15:49:41 +00:00
Guido van Rossum 3366d1c7e6 # Typo in docstring (Retrun -> Return). 1999-02-23 18:34:43 +00:00
Guido van Rossum 61eeb044d7 The docstring for ttyname(..) claims a second "mode" argument. The
actual code does not allow such an argument.  (Finn Bock.)
1999-02-22 15:29:15 +00:00
Guido van Rossum 7d385294a4 The symbols P_* (for spawn*(), MS specific) should not have a leading
underscore after all, for consistency with the O_* symnbols.
1999-02-16 19:38:04 +00:00
Guido van Rossum b8c3cbdd50 Fixed totally bogus conversion factors used in the Win32 version of
os.times().
1999-02-16 14:37:28 +00:00
Barry Warsaw ca74da4e2c Got rid of the file-global PosixError. This was redundant since it
was just an alias for PyExc_OSError and the way we were doing it was
causing a (small) memory leak anyway.  Just use PyExc_OSError
everywhere.
1999-02-09 19:31:45 +00:00
Guido van Rossum 0c9608cf1b Portability fix for [f]statvfs() return tuple: no longer return the
f_fsid field, since it's not a scalar on all systems supporting this
call (in particular, it's a tuple of two longs on AIX).  Since it's
not particularly useful, just nuke it.  Adapted the doc strings too.
1999-02-03 16:32:37 +00:00
Fred Drake 7e3535cbbd Added documentation to the docstrings for the W*() functions that take
a process exit status as a parameter.
1999-02-02 16:37:11 +00:00
Guido van Rossum 246bc17a8b Add _P_WAIT etc. for NT. 1999-02-01 23:54:31 +00:00
Fred Drake a6dff3e772 spawnv, spawnve docstrings: added mode parameter; this is required! 1999-02-01 22:24:40 +00:00
Guido van Rossum e6a3aa6066 Oops, the patch for NeXT always replaced waitpid() with wait4() --
this doesn't exist everywhere, so go back to using #ifdef NeXT.
1999-02-01 16:15:30 +00:00
Guido van Rossum 54ecc3d24f Patches by William Lewis for Nextstep descendants. 1999-01-27 17:53:11 +00:00
Guido van Rossum a106568eed Add spawnv and spawnve functions for Win32 platforms. 1999-01-25 23:20:23 +00:00
Guido van Rossum d371ff17a1 Only do ttyname() when HAVE_TTYNAME is defined.
Also define F_OK etc. when not already defined, when doing access().
1999-01-25 16:12:23 +00:00
Guido van Rossum 5d00b6d459 Need extern decl. for fdatasync() in case it exists but isn't declared
anywhere (or, more likely, the declaration requires a magical
combination of _POSIX defines).
1999-01-08 21:28:05 +00:00
Guido van Rossum 21142a09f3 Added fsync() and fdatasync(). Patches by Scott Cotton. Requires
HAVE_* macros set by configure script.
1999-01-08 21:05:37 +00:00
Guido van Rossum 015f22a0fa Change the access() code to return 1 if granted, 0 if not granted.
Patch (again) by Sean Reifschneider.
1999-01-06 22:52:38 +00:00
Guido van Rossum 94f6f72c05 Changes for long file support by Steve Clift.
Also added access() and ttyname() by Sean Reifschneider.
1999-01-06 18:42:14 +00:00
Guido van Rossum 3886bb6997 Add DL_EXPORT() to all modules that could possibly be used
on BeOS or Windows.
1998-12-04 18:50:17 +00:00