aboutsummaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'hurd')
-rw-r--r--hurd/.cvsignore4
-rw-r--r--hurd/Makefile117
-rw-r--r--hurd/Notes37
-rw-r--r--hurd/STATUS72
-rw-r--r--hurd/alloc-fd.c127
-rw-r--r--hurd/catch-exc.c78
-rw-r--r--hurd/ctty-input.c77
-rw-r--r--hurd/ctty-output.c82
-rw-r--r--hurd/dtable.c277
-rw-r--r--hurd/fchroot.c43
-rw-r--r--hurd/fd-close.c46
-rw-r--r--hurd/fd-read.c49
-rw-r--r--hurd/fd-write.c42
-rw-r--r--hurd/fopenport.c131
-rw-r--r--hurd/getdport.c54
-rw-r--r--hurd/getuids.c63
-rw-r--r--hurd/getumask.c25
-rw-r--r--hurd/hurd-raise.c48
-rw-r--r--hurd/hurd.h292
-rw-r--r--hurd/hurd/fd.h222
-rw-r--r--hurd/hurd/id.h55
-rw-r--r--hurd/hurd/ioctl.h71
-rw-r--r--hurd/hurd/port.h152
-rw-r--r--hurd/hurd/resource.h50
-rw-r--r--hurd/hurd/signal.h391
-rw-r--r--hurd/hurd/threadvar.h107
-rw-r--r--hurd/hurd/userlink.h105
-rw-r--r--hurd/hurdauth.c130
-rw-r--r--hurd/hurdexec.c259
-rw-r--r--hurd/hurdfault.c143
-rw-r--r--hurd/hurdfault.h49
-rw-r--r--hurd/hurdid.c91
-rw-r--r--hurd/hurdinit.c193
-rw-r--r--hurd/hurdinline.c11
-rw-r--r--hurd/hurdintr.awk25
-rw-r--r--hurd/hurdioctl.c264
-rw-r--r--hurd/hurdkill.c84
-rw-r--r--hurd/hurdlookup.c381
-rw-r--r--hurd/hurdmalloc.c411
-rw-r--r--hurd/hurdmalloc.h17
-rw-r--r--hurd/hurdmsg.c451
-rw-r--r--hurd/hurdpid.c71
-rw-r--r--hurd/hurdports.c52
-rw-r--r--hurd/hurdprio.c87
-rw-r--r--hurd/hurdrlimit.c50
-rw-r--r--hurd/hurdsig.c1080
-rw-r--r--hurd/hurdsock.c115
-rw-r--r--hurd/intern-fd.c50
-rw-r--r--hurd/intr-rpc.awk45
-rw-r--r--hurd/intr-rpc.defs27
-rw-r--r--hurd/invoke-trans.c37
-rw-r--r--hurd/msgportdemux.c66
-rw-r--r--hurd/msgstub.c26
-rw-r--r--hurd/new-fd.c39
-rw-r--r--hurd/openport.c29
-rw-r--r--hurd/pid2task.c32
-rw-r--r--hurd/port2fd.c75
-rw-r--r--hurd/ports-get.c46
-rw-r--r--hurd/ports-set.c57
-rw-r--r--hurd/preempt-sig.c68
-rw-r--r--hurd/privports.c60
-rw-r--r--hurd/setauth.c124
-rw-r--r--hurd/setuids.c59
-rw-r--r--hurd/siginfo.c27
-rw-r--r--hurd/task2pid.c30
-rw-r--r--hurd/vpprintf.c60
66 files changed, 7738 insertions, 0 deletions
diff --git a/hurd/.cvsignore b/hurd/.cvsignore
new file mode 100644
index 0000000000..1f69fd919a
--- /dev/null
+++ b/hurd/.cvsignore
@@ -0,0 +1,4 @@
+*.gz *.Z *.tar *.tgz
+=*
+TODO COPYING* AUTHORS copyr-* copying.*
+glibc-*
diff --git a/hurd/Makefile b/hurd/Makefile
new file mode 100644
index 0000000000..7a5a1ba995
--- /dev/null
+++ b/hurd/Makefile
@@ -0,0 +1,117 @@
+# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License
+# as published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB. If
+# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+# Cambridge, MA 02139, USA.
+
+subdir := hurd
+
+all:
+
+# Some things below (but before including Rules) use configuration variables.
+include ../Makeconfig
+
+
+headers = hurd.h $(interface-headers) \
+ $(addprefix hurd/,fd.h id.h port.h signal.h userlink.h \
+ resource.h threadvar.h)
+
+distribute := hurdfault.h intr-rpc.awk intr-rpc.defs STATUS
+
+# The RPC interfaces go in a separate library.
+interface-library := libhurduser.a
+user-interfaces := $(addprefix hurd/,\
+ auth process startup \
+ msg msg_reply msg_request \
+ exec core interrupt \
+ fs fsys io term socket ifsock)
+server-interfaces := hurd/msg
+
+routines = hurdinit hurdid hurdlookup hurdpid hurdrlimit hurdprio hurdexec \
+ setauth \
+ pid2task task2pid \
+ getuids setuids getumask fchroot \
+ hurdsock hurdauth invoke-trans \
+ privports \
+ msgportdemux \
+ fopenport \
+ vpprintf \
+ ports-get ports-set hurdports hurdmsg \
+ $(sig) $(dtable) hurdinline
+sig = hurdsig hurdfault faultexc siginfo hurd-raise preempt-sig \
+ trampoline longjmp-ts catch-exc exc2signal hurdkill
+dtable = dtable port2fd new-fd alloc-fd intern-fd \
+ getdport openport \
+ fd-close fd-read fd-write hurdioctl ctty-input ctty-output
+
+# XXX this is a temporary hack; see hurdmalloc.h
+routines += hurdmalloc
+distribute += hurdmalloc.h
+
+# Get the proper definition of `hurd-srcdir'.
+include ../sysdeps/mach/hurd/Makefile
+
+# Use and install the Hurd header files directly out of the Hurd source.
+
+# Find the MiG defs files in the Hurd source.
+vpath %.defs $(hurd-srcdir)
+
+# Install all .h and .defs files we find in the Hurd's hurd/ directory.
+hurd-headers := $(patsubst $(hurd-srcdir)/%,%,\
+ $(wildcard $(addprefix $(hurd-srcdir)/hurd/,\
+ *.defs *.h)))
+
+
+# Don't distribute the Hurd headers; they are in the Hurd distribution.
+dont_distribute = $(hurd-headers)
+
+# DO NOT try to remake these in any way!!!
+$(addprefix $(hurd-srcdir)/,$(hurd-headers)) : ;
+install-others += $(addprefix $(includedir)/,$(hurd-headers))
+$(includedir)/hurd/%: $(hurd-srcdir)/hurd/%; $(do-install)
+
+include ../mach/Machrules
+include ../Rules
+
+# intr-rpc.defs defines the INTR_INTERFACE macro to make the generated RPC
+# stubs send-interruptible, and to prefix them with `hurd_intr_rpc_'.
+user-MIGFLAGS += -imacros intr-rpc.defs
+
+# Run each generated user stub through intr-rpc.awk, which will detect
+# stubs __hurd_intr_rpc_% and generate the user-callable function for the
+# stub: this is a wrapper which calls __hurd_intr_rpc_% inside
+# HURD_EINTR_RPC.
+define transform-user-stub
+gawk -v call=$${call} -f $(word 2,$^) \
+ $(objpfx)tmp_$${call}.c > $(objpfx)tmpi_$${call}.c; \
+rm -f $(objpfx)tmp_$${call}.c;
+endef
+transform-user-stub-output = tmpi
+
+$(foreach if,$(user-interfaces),$($(if)-calls:%=$(objpfx)RPC_%.o))): \
+ hurd/signal.h
+
+$(user-interfaces:%=$(objpfx)%.ustamp): intr-rpc.awk
+
+$(objpfx)fault%.c $(objpfx)fault%.h: $(mach-srcdir)/mach/%.defs
+ $(MIG) $(MIGFLAGS) -prefix _hurdsig_fault_ \
+ -server $(@:.h=.c) -sheader $(@:.c=.h) \
+ -user /dev/null -header /dev/null \
+ $<
+generated += faultexc.c faultexc.h
+
+# We need this static dependency to get faultexc.h generated the first time.
+$(objpfx)hurdfault.o $(objpfx)hurdfault.d: \
+ $(objpfx)faultexc.h $(objpfx)faultexc.c
diff --git a/hurd/Notes b/hurd/Notes
new file mode 100644
index 0000000000..9052f29096
--- /dev/null
+++ b/hurd/Notes
@@ -0,0 +1,37 @@
+The library pays attention to some envariables:
+
+CORESERVER -- Name of core server naming point; falls back to /servers/core
+COREFILE -- Name of file to write core dump in; falls back to core
+GNUTARGET -- Passed to core server to specify flavor of core dump format
+
+New functions:
+
+int openport (io_t port);
+FILE *fopenport (mach_port_t, const char *mode);
+file_t getdport (int fd);
+
+task_t pid2task (pid_t);
+pid_t task2pid (task_t);
+
+int fchroot (int fd);
+mode_t getumask (void);
+
+int getuids (int n, uid_t *uidset);
+
+error_t hurd_path_lookup (file_t root, file_t cwd,
+ const char *path, int flags, mode_t mode,
+ file_t *port);
+error_t hurd_path_split (file_t root, file_t cwd,
+ const char *path,
+ file_t *dir, char **name);
+file_t path_lookup (const char *path, int flags, mode_t mode);
+file_t path_split (const char *path, char **name);
+
+process_t getproc (void);
+int setproc (process_t);
+file_t getcrdir (void);
+int setcrdir (file_t);
+file_t getcwdir (void);
+int setcwdir (file_t);
+auth_t getauth (void);
+int setauth (auth_t); /* Reauthenticates all library ports. */
diff --git a/hurd/STATUS b/hurd/STATUS
new file mode 100644
index 0000000000..ceb0a865d0
--- /dev/null
+++ b/hurd/STATUS
@@ -0,0 +1,72 @@
+Status of Hurd support in libc. Last updated 22 Nov 1994.
+Roland McGrath <roland@gnu.ai.mit.edu>
+
+Everything not noted below is implemented, most of it tested. There are
+various very small things unfinished or thought to be perhaps wrong
+throughout the code, marked by comments containing `XXX'.
+
+
+* Signals and job control work, but are a very hairy area.
+ There are various ways the signal thread can block and fail
+ to respond when the program is losing badly.
+
+* We are not sure about possible races between setpgrp (A, pgrp) from
+ process B vs process A receiving proc_newids.
+
+* The rest of libc (stdio et al) is not safe for multithreaded programs.
+ mutex locks should be added to various things.
+
+* Recovery from faults in the signal thread is not implemented yet.
+
+* longjmp needs to clean up reply port, intr_port; needs thought about.
+
+* Cooperation with cthreads is not finished. If you link with cthreads,
+ libc internal code still does not use real condition variables.
+ sigsuspend currently does a busy wait where it should use a condition.
+ Signal state is per kernel thread; for unwired cthreads it should be per
+ cthread instead.
+
+* sigaltstack/sigstack do not really work: the signal stack needs thread
+ variables and cthread data set up, which is not done.
+
+* malloc is a kludge.
+
+* Nothing uses mapped io. Eventually stdio and read/write/seek should. I
+ have written a little code for this, but it is far from finished.
+
+* Resource limits do not really work; current implementation is patchy and
+ inconsistent.
+
+* libc implicitly uses some environment variables. This is a security
+ problem for setuid exec. Probably crt0 should remove the variables from
+ the environment if setuid.
+
+* The miscellaneous msg.defs calls are only partially implemented.
+
+* The default SIGINFO handler needs to be written.
+
+* File locking is not implemented; the RPC interface is not there yet.
+
+* The current getitimer/setitimer implementation is a kludge.
+
+* mmap cannot do MAP_NOEXTEND.
+
+* Unimplemented calls (from the 4.4 system call list):
+acct
+fstatfs
+getfh
+getfsstat
+getrusage
+madvise
+mincore
+mount
+msync
+profil
+recvmsg
+revoke
+sendmsg
+setpriority
+sstk
+statfs
+swapon
+unmount
diff --git a/hurd/alloc-fd.c b/hurd/alloc-fd.c
new file mode 100644
index 0000000000..02a1bdfd52
--- /dev/null
+++ b/hurd/alloc-fd.c
@@ -0,0 +1,127 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should h