⚲
Project
General
Profile
Sign in
Home
Projects
Help
Search
:
DragonFlyBSD
All Projects
DragonFlyBSD
Overview
Activity
Roadmap
Issues
Documents
Files
Repository
Download (604 Bytes)
Bug #2320
» forklock.c
c.turner1
, 02/29/2012 03:33 AM
#include
<stdio.h>
#include
<stdlib.h>
#include
<sys/types.h>
#include
<sys/mman.h>
int
main
(
int
argc
,
char
*
argv
[])
{
void
*
ptr
;
pid_t
pid
;
size_t
amt
;
int
wstat
;
amt
=
(
size_t
)
(
1
*
sizeof
(
char
));
ptr
=
malloc
(
amt
);
printf
(
"pre-lock: %p
\n
"
,
ptr
);
mlock
(
ptr
,
amt
);
if
((
pid
=
fork
())
==
0
)
{
sleep
(
1
);
printf
(
"child: %p
\n
"
,
ptr
);
return
0
;
}
else
{
printf
(
"parent: %p
\n
"
,
ptr
);
waitpid
(
pid
,
&
wstat
);
}
return
0
;
}
« Previous
1
2
Next »
(1-1/2)
Loading...