Staging
v0.5.1
https://github.com/python/cpython
Revision 3baaa1375ba03cf2d7fa3af884d6a99294c2587a authored by Guido van Rossum on 22 March 1999, 21:44:51 UTC, committed by Guido van Rossum on 22 March 1999, 21:44:51 UTC
- Use HAVE_GETHOSTBYNAME_R_6_ARG instead of testing for Linux and
glibc2.

- If gethostbyname takes 3 args, undefine HAVE_GETHOSTBYNAME_R --
don't know what code should be used.

- New symbol USE_GETHOSTBYNAME_LOCK defined iff the lock should be used.

- Modify the gethostbyaddr() code to also hold on to the lock until
after it is safe to release, overlapping with the Python lock.

(Note: I think that it could in theory be possible that Python code
executed while gethostbyname_lock is held could attempt to reacquire
the lock -- e.g. in a signal handler or destructor.  I will simply say
"don't do that then.")
1 parent 955becc
Raw File
Tip revision: 3baaa1375ba03cf2d7fa3af884d6a99294c2587a authored by Guido van Rossum on 22 March 1999, 21:44:51 UTC
Clean up pass for the previous patches.
Tip revision: 3baaa13
mwerksglue.c
/*
** Glue code for MetroWerks CodeWarrior, which misses
** unix-like routines for file-access.
*/

#ifdef __MWERKS__
#include <Types.h>
#include <Files.h>
#include <Strings.h>

#include <stdio.h>
#include <errno.h>

int
fileno(fp)
	FILE *fp;
{
	if (fp==stdin) return 0;
	else if (fp==stdout) return 1;
	else if (fp==stderr) return 2;
	else return 3;
}

int
isatty(fd)
	int fd;
{
	return (fd >= 0 && fd <= 2);
}

int
unlink(old)
	char *old;
{
	OSErr err;
	
	if ((err=FSDelete(c2pstr(old), 0)) == noErr)
		return 0;
	errno= err;
	return -1;
}

#endif /* __MWERKS__ */
back to top