lkml.org 
[lkml]   [1999]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: vfork

Andries Brouwer writes:

> Linus writes:
>
> Just describe it the way it works.
>
> Yes, I did that further down the same page, describing the BSD vfork
> and the reasons for it. But the POSIX description is what programmers
> that wish to produce portable programs have to use. In a portable
> program vfork only has disadvantages - strictly speaking it cannot be
> used at all. Maybe I should add a separate LINUX DESCRIPTION.

These are Linux man pages, are they not?

> Reed H. Petty writes:
>
>> Considerations included performance,
>> conformance to published standards, existing implementations in Solaris,
>> HP-UX, Open/Free/NetBSD, etc, and porting of existing application code.
>>
>> IMHO, creating manual pages which argue that a syscall is evil, broken
>> as designed, etc, is NOT appopriate. We have better forums for such
>> discussions.
>
> You misread my intentions. I argue that Joe Programmer had better
> avoid vfork if he hopes to write portably.

1. man pages should not rant about kernel design choices
2. man pages should not encourage _or_ discourage portability

Man pages exist to document the system. That is their primary function.
It is also nice to document portability issues, but this is secondary.

Those that wish to write portable software may purchase a copy
of "Advanced Programming in the UNIX Environment" or POSIX itself.

>> If the vfork() syscall is evil then lets reopen the public discussion and
>> reach a decision to either accept it or pull it from the kernel entirely.
>> Otherwise, let the man pages document its semantics/behavior, along
>> with a warning that the porting issue cuts both ways.
>
> Hmm. Its cuts only one way: avoid vfork in a program that should
> be portable.

Being "portable" seems oddly like being "politically correct".

Being "portable" is relative. One may choose "all x86", "all BSD",
"all 64-bit Linux", "all big-endian 32-bit SysV" or even "all Win32".
To varying degree, most people don't give a damn. If you think you
are an exception... does your software support v6 UNIX?

> I will replace the word `broken' in the header.
> (And maybe replace the entire page - will have to see what you wrote.)
> But otherwise - are not all statements below factually correct?

No, but there are gaping holes in the documentation. I'd most like
to know what I can get from the raw system call, libc 5, recent glibc,
and older glibc. For example, are file descriptors handled well?

>> DESCRIPTION
>> vfork, just like fork(2), creates a child process of the calling
>> process. For details and return value and errors, see fork(2).
>>
>> Under Linux, fork() is implemented using copy-on-write pages, so
>> the only penalty incurred by fork() is the time and memory
>> required to duplicate the parent's page tables, and to create a
>> unique task structure for the child. However, in the bad old days

Do you _know_ this? Off the top of my head I'd say the original process
will suffer minor page faults after the exec.

>> BUGS
>> It is rather unfortunate that Linux revived this spectre from the
>> nated when proper system sharing mechanisms are implemented. Users
>> should not depend on the memory sharing semantics of vfork as it
>> will, in that case, be made synonymous to fork."
>>
>> Formally speaking, the POSIX description given above does not
>> allow one to use vfork() since a following exec might fail, and
>> then what happens is undefined.

Since the POSIX version is so useless, you can just consider vfork() to
be a Linux-specific call. On a modern Linux system, one may depend on
quite a few things.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.069 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site