summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile11
-rw-r--r--utils/fakeauth.c14
-rw-r--r--utils/rpctrace.c12
3 files changed, 25 insertions, 12 deletions
diff --git a/utils/Makefile b/utils/Makefile
index 3bb8b17c..00f6142f 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -31,7 +31,8 @@ SRCS = shd.c ps.c settrans.c syncfs.c showtrans.c addauth.c rmauth.c \
rpctrace.c mount.c gcore.c fakeauth.c fakeroot.sh
OBJS = $(filter-out %.sh,$(SRCS:.c=.o))
-HURDLIBS = ps ihash store fshelp threads ports ftpconn shouldbeinlibc
+HURDLIBS = ps ihash store fshelp ports ftpconn shouldbeinlibc
+LDLIBS += -lpthread
login-LDLIBS = -lutil $(LIBCRYPT)
addauth-LDLIBS = $(LIBCRYPT)
setauth-LDLIBS = $(LIBCRYPT)
@@ -52,9 +53,7 @@ ps w: psout.o ../libps/libps.a ../libihash/libihash.a
storeinfo storecat storeread: ../libstore/libstore.a
ftpcp ftpdir: ../libftpconn/libftpconn.a
-# We must include libthreads because of a bug in the way shared libraries
-# work: all libraries that *any* routine in libfshelp uses must be defined.
-settrans: ../libfshelp/libfshelp.a ../libports/libports.a ../libthreads/libthreads.a
+settrans: ../libfshelp/libfshelp.a ../libports/libports.a
ps w ids settrans syncfs showtrans fsysopts storeinfo login vmstat portinfo \
devprobe vminfo addauth rmauth setauth unsu ftpcp ftpdir storeread \
storecat msgport mount: \
@@ -62,12 +61,10 @@ ps w ids settrans syncfs showtrans fsysopts storeinfo login vmstat portinfo \
$(filter-out $(special-targets), $(targets)): %: %.o
-rpctrace: ../libthreads/libthreads.a \
- ../libports/libports.a ../libihash/libihash.a
+rpctrace: ../libports/libports.a ../libihash/libihash.a
rpctrace-CPPFLAGS = -DDATADIR=\"${datadir}\"
fakeauth: authServer.o auth_requestUser.o interruptServer.o \
- ../libthreads/libthreads.a \
../libports/libports.a ../libihash/libihash.a \
../libshouldbeinlibc/libshouldbeinlibc.a
auth-MIGSFLAGS = -imacros $(srcdir)/../auth/authmutations.h
diff --git a/utils/fakeauth.c b/utils/fakeauth.c
index 49fa7f1c..154bf8e4 100644
--- a/utils/fakeauth.c
+++ b/utils/fakeauth.c
@@ -310,8 +310,8 @@ auth_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
}
-static any_t
-handle_auth_requests (any_t ignored)
+static void *
+handle_auth_requests (void *ignored)
{
while (1)
ports_manage_port_operations_multithread (auth_bucket, auth_demuxer,
@@ -326,6 +326,7 @@ main (int argc, char **argv)
struct authhandle *firstauth;
auth_t authport;
pid_t child;
+ pthread_t thread;
int status;
int argi;
@@ -375,7 +376,14 @@ believe it has restricted them to different identities or no identity at all.\
real_auth_port = getauth ();
/* Start handling auth requests on our fake handles. */
- cthread_detach (cthread_fork (&handle_auth_requests, (any_t)0));
+ err = pthread_create (&thread, NULL, &handle_auth_requests, NULL);
+ if (!err)
+ pthread_detach (thread);
+ else
+ {
+ errno = err;
+ perror ("pthread_create");
+ }
/* Now we start faking ourselves out. This will immediately
reauthenticate all our descriptors through our proxy auth port.
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index 9e6825d0..deb83405 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1437,7 +1437,7 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
}
/* This function runs in the tracing thread and drives all the tracing. */
-static any_t
+static void *
trace_thread_function (void *arg)
{
struct port_bucket *const bucket = arg;
@@ -1716,6 +1716,7 @@ main (int argc, char **argv, char **envp)
bool nostdinc = FALSE;
const char *outfile = 0;
char **cmd_argv = 0;
+ pthread_t thread;
error_t err;
/* Parse our options... */
@@ -1809,7 +1810,14 @@ main (int argc, char **argv, char **envp)
them, and interpose on the ports they carry. The access to the
`traced_info' and ihash data structures is all single-threaded,
happening only in this new thread. */
- cthread_detach (cthread_fork (trace_thread_function, traced_bucket));
+ err = pthread_create (&thread, NULL, trace_thread_function, traced_bucket);
+ if (!err)
+ pthread_detach (thread);
+ else
+ {
+ errno = err;
+ perror ("pthread_create");
+ }
/* Run the program on the command line and wait for it to die.
The other thread does all the tracing and interposing. */