This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jvdias
Recipients jvdias, r.david.murray
Date 2009-04-11.09:29:25
SpamBayes Score 0.0
Marked as misclassified No
Message-id <200904101332.21982.jason.vas.dias@gmail.com>
In-reply-to <1239319890.91.0.90979481852.issue5725@psf.upfronthosting.co.za>
Content
Thanks for responding !

I also think that the the Solaris Python should provide support for prctl .
Well, actually in modern Solaris what can be achieved with "prctl"
can be achieved my mmap()-ping and manipulating the procfs(4) mounted under /proc - 
but yes, what I meant was not that process-scope semaphore support
was required to solve the problem solved in the example code for this bug report -
actually, there are many other ways of doing that on either Linux or Solaris,
such as with rlimit(1) - but was only that, had process-scope semaphore support 
been available in Python , then the algorithm used by the example would have been 
a simple and robust one and suitable for use in Python code ;  but as the application 
the example code was originally part of required process-scope semaphores anyway , 
and for many other reasons, such as when a process is killed with -9, its semaphore
count is automatically adjusted by specifying the SEM_UNDO option, meaning another 
"slot" is available, this was the best among several methods investigated .  

Actually, the example code I submitted for this bug report also raises another, 
completely separate issue, which is that any parent using Python fork() MUST somehow do a 
fflush() of its standard output and error C stdio file descriptors before doing so ; otherwise
the child's first Python "print " statement is prefixed by what was in the parent's stdio buffer,
so that more than one initial "log" line can occasionally appear if Python "print" is used to
produce the log - but if the parent does 'print "\n"' immediately before calling "fork()" 
then both processes proceed with clean buffers and there are no doubled log lines . 
Can't Python provide a better print() implementation or a fflush() implementation
that will enable print()'s buffers to be flushed ? Perhaps something like PERL's IO::Handle::autoflush() ?

Maybe I should raise another "fflush() support required" bug ?

Thanks & Regards,
Jason 

On Thursday 09 April 2009 19:31:31 you wrote:
> 
> R. David Murray <rdmurray@bitdance.com> added the comment:
> 
> In issue5672 Martin said:
> 
>   If somebody would provide a patch that adds prctl to the posix module,
>   that would be fine with me - we have a long tradition of exposing all
>   available system calls if somebody wants them.
> 
> However, you are talking about a System V call, not a posix call, so
> it's not clear to me if the same rules apply.
> 
> I suggest bringing this up on python-ideas.
> 
> (BTW, sys is for python system stuff, not OS system stuff (which goes in
> the 'os' module).
> 
> ----------
> components: +Library (Lib) -Interpreter Core
> nosy: +r.david.murray
> priority:  -> low
> versions:  -Python 2.6, Python 3.0
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue5725>
> _______________________________________
>
History
Date User Action Args
2009-04-11 09:29:31jvdiassetrecipients: + jvdias, r.david.murray
2009-04-11 09:29:30jvdiaslinkissue5725 messages
2009-04-11 09:29:26jvdiascreate