caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] OS X: Trouble with threads + execv
@ 2004-07-07 22:42 Nathaniel Gray
  2004-07-08 15:09 ` Xavier Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: Nathaniel Gray @ 2004-07-07 22:42 UTC (permalink / raw)
  To: caml-list

Hello,

I'm seeing some confusing behavior on OS X (10.3.4) relating to 
pthreads and the execv family of calls.  It appears that when the 
scheduler thread (from otherlibs/systhreads/thread_posix.ml) is 
running, any call to execv will fail with "Operation not supported."  
The same applies to execvp, execve, and execvpe.

Here's a small test program:

--- begin testing.ml ---
open Unix
let args = [| "ocamlc.opt"; "-v" |];;
handle_unix_error (execv "/usr/local/bin/ocamlc.opt") args;;
--- End testing.ml ---

I build with:
ocamlopt -thread unix.cmxa threads.cmxa testing.ml -linkall

The result:
[n8gray@golux tmp]$ a.out
a.out: "execv" failed on "/usr/local/bin/ocamlc.opt": Operation not 
supported

If I build the program without linking to threads.cmxa then it works as 
expected.

Is this expected behavior?

Thanks,
-n8

--
 >>>-- Nathaniel Gray -- Caltech Computer Science ------>
 >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] OS X: Trouble with threads + execv
  2004-07-07 22:42 [Caml-list] OS X: Trouble with threads + execv Nathaniel Gray
@ 2004-07-08 15:09 ` Xavier Leroy
  2004-07-08 17:52   ` Nathaniel Gray
  0 siblings, 1 reply; 3+ messages in thread
From: Xavier Leroy @ 2004-07-08 15:09 UTC (permalink / raw)
  To: Nathaniel Gray; +Cc: caml-list

> I'm seeing some confusing behavior on OS X (10.3.4) relating to 
> pthreads and the execv family of calls.  It appears that when the 
> scheduler thread (from otherlibs/systhreads/thread_posix.ml) is 
> running, any call to execv will fail with "Operation not supported."  
> The same applies to execvp, execve, and execvpe.
>
> If I build the program without linking to threads.cmxa then it works as 
> expected.
> Is this expected behavior?

No.  According to POSIX, exec* has no reason to fail if other threads
are still running in the current process.  These other threads are
terminated.  With system threads, Caml's Unix.exec* functions just
call the corresponding system calls.

If you want to make sure, you could try to reproduce this behavior
with a small C program.

- Xavier Leroy

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] OS X: Trouble with threads + execv
  2004-07-08 15:09 ` Xavier Leroy
@ 2004-07-08 17:52   ` Nathaniel Gray
  0 siblings, 0 replies; 3+ messages in thread
From: Nathaniel Gray @ 2004-07-08 17:52 UTC (permalink / raw)
  To: caml-list

On Jul 8, 2004, at 8:09 AM, Xavier Leroy wrote:

>> I'm seeing some confusing behavior on OS X (10.3.4) relating to
>> pthreads and the execv family of calls.  It appears that when the
>> scheduler thread (from otherlibs/systhreads/thread_posix.ml) is
>> running, any call to execv will fail with "Operation not supported."
>> The same applies to execvp, execve, and execvpe.
>>
>> If I build the program without linking to threads.cmxa then it works 
>> as
>> expected.
>> Is this expected behavior?
>
> No.  According to POSIX, exec* has no reason to fail if other threads
> are still running in the current process.  These other threads are
> terminated.  With system threads, Caml's Unix.exec* functions just
> call the corresponding system calls.
>
> If you want to make sure, you could try to reproduce this behavior
> with a small C program.

Thanks.  I was able to reproduce it with a C program so I'll file a bug 
report with Apple.

Cheers,
-Nathan

--
 >>>-- Nathaniel Gray -- Caltech Computer Science ------>
 >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-08 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-07 22:42 [Caml-list] OS X: Trouble with threads + execv Nathaniel Gray
2004-07-08 15:09 ` Xavier Leroy
2004-07-08 17:52   ` Nathaniel Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).