Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1abdb6f7
Commit
1abdb6f7
authored
Apr 28, 2000
by
Ove Kaaven
Committed by
Alexandre Julliard
Apr 28, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Override fork().
parent
7827254c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
pthread.c
scheduler/pthread.c
+35
-4
No files found.
scheduler/pthread.c
View file @
1abdb6f7
...
...
@@ -33,17 +33,32 @@
# define PREFIX
#endif
#define PSTR(str) PREFIX #str
/* adapt as necessary (a construct like this is used in glibc sources) */
#define strong_alias(orig, alias) \
asm(".globl " P
REFIX #alias "\n\t.set " PREFIX #alias "," PREFIX #orig
)
asm(".globl " P
STR(alias) "\n\t.set " PSTR(alias) "," PSTR(orig)
)
/* strong_alias does not work on external symbols (.o format limitation?),
* so for those, we need to use the pogo stick */
#ifdef __i386__
#define jump_alias(orig, alias) \
asm(".globl " P
REFIX #alias "\n\t" PREFIX #alias ":\n\tjmp " PREFIX #orig
)
asm(".globl " P
STR(alias) "\n\t" PSTR(alias) ":\n\tjmp " PSTR(orig)
)
#endif
/* get necessary libc symbols */
#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)
#define LIBC_FORK __libc_fork
#define PTHREAD_FORK __fork
#define ALIAS_FORK
#else
#define LIBC_FORK __fork
#define PTHREAD_FORK fork
#endif
extern
pid_t
LIBC_FORK
(
void
);
#define LIBC_SIGACTION __sigaction
/* NOTE: This is a truly extremely incredibly ugly hack!
* But it does seem to work... */
...
...
@@ -102,6 +117,21 @@ int __pthread_atfork(void (*prepare)(void),
}
strong_alias
(
__pthread_atfork
,
pthread_atfork
);
pid_t
PTHREAD_FORK
(
void
)
{
pid_t
pid
;
/* call prepare handlers */
pid
=
LIBC_FORK
();
if
(
pid
==
0
)
{
/* call child handlers */
}
else
{
/* call parent handlers */
}
return
pid
;
}
#ifdef ALIAS_FORK
strong_alias
(
PTHREAD_FORK
,
fork
);
#endif
/***** MUTEXES *****/
...
...
@@ -354,6 +384,7 @@ int pthread_equal(pthread_t thread1, pthread_t thread2)
void
pthread_exit
(
void
*
retval
)
{
/* FIXME: pthread cleanup */
ExitThread
((
DWORD
)
retval
);
}
...
...
@@ -367,11 +398,11 @@ int pthread_setcanceltype(int type, int *oldtype)
/* pthreads tries to override these, point them back to libc */
#ifdef jump_alias
jump_alias
(
__sigaction
,
sigaction
);
jump_alias
(
LIBC_SIGACTION
,
sigaction
);
#else
int
sigaction
(
int
signum
,
const
struct
sigaction
*
act
,
struct
sigaction
*
oldact
)
{
return
__sigaction
(
signum
,
act
,
oldact
);
return
LIBC_SIGACTION
(
signum
,
act
,
oldact
);
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment