[Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.187.2.2,2.187.2.3

Thomas Wouters twouters@users.sourceforge.net
Wed, 11 Jul 2001 15:27:40 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv15531/Modules

Modified Files:
      Tag: release21-maint
	posixmodule.c 
Log Message:

Re-do the broken-nice() patch to break less platforms. Hopefully none :P
Also note that it isn't just Linux nice() that is broken: at least FreeBSD
and BSDI also have this problem. os.nice() should probably just be emulated
using getpriority()/setpriority(), if they are available, but that isn't
worth putting in 2.1.1.



Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.187.2.2
retrieving revision 2.187.2.3
diff -C2 -r2.187.2.2 -r2.187.2.3
*** posixmodule.c	2001/07/11 14:01:08	2.187.2.2
--- posixmodule.c	2001/07/11 22:27:38	2.187.2.3
***************
*** 1068,1071 ****
--- 1068,1077 ----
  
  #ifdef HAVE_NICE
+ #if defined(HAVE_BROKEN_NICE) && defined(HAVE_SYS_RESOURCE_H)
+ #if defined(HAVE_GETPRIORITY) && !defined(PRIO_PROCESS)
+ #include <sys/resource.h>
+ #endif
+ #endif
+ 
  static char posix_nice__doc__[] =
  "nice(inc) -> new_priority\n\
***************
*** 1082,1087 ****
  	/* There are two flavours of 'nice': one that returns the new
  	   priority (as required by almost all standards out there) and the
! 	   Linux one, which returns '0' on success and advices the use of
! 	   getpriority() to get the new priority.
  	   
  	   If we are of the nice family that returns the new priority, we
--- 1088,1093 ----
  	/* There are two flavours of 'nice': one that returns the new
  	   priority (as required by almost all standards out there) and the
! 	   Linux/FreeBSD/BSDI one, which returns '0' on success and advices
! 	   the use of getpriority() to get the new priority.
  	   
  	   If we are of the nice family that returns the new priority, we
***************
*** 1092,1096 ****
  	errno = 0;
  	value = nice(increment);
! #ifdef HAVE_GETPRIORITY
  	if (value == 0)
  		value = getpriority(PRIO_PROCESS, 0);
--- 1098,1102 ----
  	errno = 0;
  	value = nice(increment);
! #if defined(HAVE_BROKEN_NICE) && defined(HAVE_GETPRIORITY)
  	if (value == 0)
  		value = getpriority(PRIO_PROCESS, 0);