| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: vfork.2,v 1.24 2003/08/07 16:44:11 agc Exp $ | | 1 | .\" $NetBSD: vfork.2,v 1.25 2014/07/18 15:56:44 dholland Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 1980, 1991, 1993 | | 3 | .\" Copyright (c) 1980, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | | 4 | .\" The Regents of the University of California. All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. Neither the name of the University nor the names of its contributors | | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
| @@ -63,32 +63,32 @@ or an exit (either by a call to | | | @@ -63,32 +63,32 @@ or an exit (either by a call to |
63 | .Xr _exit 2 | | 63 | .Xr _exit 2 |
64 | or abnormally). | | 64 | or abnormally). |
65 | The parent process is suspended while the child is using its resources. | | 65 | The parent process is suspended while the child is using its resources. |
66 | .Pp | | 66 | .Pp |
67 | The | | 67 | The |
68 | .Nm | | 68 | .Nm |
69 | system call returns 0 in the child's context and (later) the pid | | 69 | system call returns 0 in the child's context and (later) the pid |
70 | of the child in the parent's context. | | 70 | of the child in the parent's context. |
71 | .Pp | | 71 | .Pp |
72 | The | | 72 | The |
73 | .Nm | | 73 | .Nm |
74 | system call can normally be used just like | | 74 | system call can normally be used just like |
75 | .Xr fork 2 . | | 75 | .Xr fork 2 . |
76 | It does not work, however, to return while running in the childs context | | 76 | It does not work, however, to return while running in the child's context |
77 | from the procedure that called | | 77 | from the procedure that called |
78 | .Fn vfork | | 78 | .Fn vfork |
79 | since the eventual return from | | 79 | since the eventual return from |
80 | .Fn vfork | | 80 | .Fn vfork |
81 | would then return to a no longer existent stack frame. | | 81 | would then return to a no longer existing stack frame. |
82 | Be careful, also, to call | | 82 | Be careful, also, to call |
83 | .Xr _exit 2 | | 83 | .Xr _exit 2 |
84 | rather than | | 84 | rather than |
85 | .Xr exit 3 | | 85 | .Xr exit 3 |
86 | if you can't | | 86 | if you can't |
87 | .Xr execve 2 , | | 87 | .Xr execve 2 , |
88 | since | | 88 | since |
89 | .Xr exit 3 | | 89 | .Xr exit 3 |
90 | will flush and close standard I/O channels, and thereby mess up the | | 90 | will flush and close standard I/O channels, and thereby mess up the |
91 | standard I/O data structures | | 91 | standard I/O data structures |
92 | in the parent process. | | 92 | in the parent process. |
93 | (Even with | | 93 | (Even with |
94 | .Xr fork 2 | | 94 | .Xr fork 2 |