diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-03-16 18:16:02 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-03-16 18:16:02 +0100 |
commit | 8ad7f49e5b5e9a254f73de53941a58fc6032a737 (patch) | |
tree | f6bcc710fc79e4cb2e31b11c6be1e67c14bf48a9 | |
parent | 4097daba7e43b3a1a3af77a715da1a2418d30392 (diff) | |
parent | cc9757407fa124998613329ce73c5bba98d5cf21 (diff) |
Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd
-rw-r--r-- | auth/Makefile | 2 | ||||
-rw-r--r-- | auth/auth.c | 10 | ||||
-rw-r--r-- | auth/auth.h | 28 | ||||
-rw-r--r-- | auth/auth_mig.h | 5 | ||||
-rw-r--r-- | auth/authmutations.h | 6 | ||||
-rw-r--r-- | auth/mig-decls.h | 42 | ||||
-rw-r--r-- | auth/mig-mutate.h | 24 | ||||
-rw-r--r-- | mach-defpager/default_pager.c | 75 | ||||
-rw-r--r-- | mach-defpager/file_io.h | 6 | ||||
-rw-r--r-- | mach-defpager/kalloc.c | 2 | ||||
-rw-r--r-- | mach-defpager/setup.c | 6 | ||||
-rw-r--r-- | utils/Makefile | 2 | ||||
-rw-r--r-- | utils/fakeauth.c | 10 |
13 files changed, 140 insertions, 78 deletions
diff --git a/auth/Makefile b/auth/Makefile index 75910c77..b9eedda5 100644 --- a/auth/Makefile +++ b/auth/Makefile @@ -25,6 +25,6 @@ target = auth HURDLIBS = ports ihash shouldbeinlibc OTHERLIBS = -lpthread -MIGSFLAGS = -imacros $(srcdir)/authmutations.h +MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h include ../Makeconf diff --git a/auth/auth.c b/auth/auth.c index e69c4f86..7d35bd37 100644 --- a/auth/auth.c +++ b/auth/auth.c @@ -35,6 +35,8 @@ #include "auth_S.h" #include "auth_reply_U.h" +#include "auth.h" + const char *argp_program_version = STANDARD_HURD_VERSION(auth); @@ -72,14 +74,6 @@ destroy_authhandle (void *p) idvec_free_contents (&h->auids); idvec_free_contents (&h->agids); } - -/* Called by server stub functions. */ - -authhandle_t -auth_port_to_handle (auth_t auth) -{ - return ports_lookup_port (auth_bucket, auth, authhandle_portclass); -} /* id management. */ diff --git a/auth/auth.h b/auth/auth.h new file mode 100644 index 00000000..0bc341d3 --- /dev/null +++ b/auth/auth.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2014 Free Software Foundation, Inc. + Written by Justus Winter. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef __AUTH_H__ +#define __AUTH_H__ + +#include <hurd/ports.h> + +extern struct port_bucket *auth_bucket; +extern struct port_class *authhandle_portclass; + +#endif /* __AUTH_H__ */ diff --git a/auth/auth_mig.h b/auth/auth_mig.h deleted file mode 100644 index d919c1b9..00000000 --- a/auth/auth_mig.h +++ /dev/null @@ -1,5 +0,0 @@ -typedef struct authhandle *authhandle_t; - -authhandle_t auth_port_to_handle (auth_t); - -#include <hurd/ports.h> diff --git a/auth/authmutations.h b/auth/authmutations.h deleted file mode 100644 index 63b2f540..00000000 --- a/auth/authmutations.h +++ /dev/null @@ -1,6 +0,0 @@ -/* CPP definitions for MiG processing of auth.defs for auth server. */ - -#define AUTH_INTRAN authhandle_t auth_port_to_handle (auth_t) -#define AUTH_DESTRUCTOR ports_port_deref (authhandle_t) - -#define AUTH_IMPORTS import "auth_mig.h"; diff --git a/auth/mig-decls.h b/auth/mig-decls.h new file mode 100644 index 00000000..09c7c70a --- /dev/null +++ b/auth/mig-decls.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2014 Free Software Foundation, Inc. + Written by Justus Winter. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef __AUTH_MIG_DECLS_H__ +#define __AUTH_MIG_DECLS_H__ + +#include "auth.h" + +typedef struct authhandle *authhandle_t; + +/* Called by server stub functions. */ + +static inline struct authhandle * __attribute__ ((unused)) +auth_port_to_handle (mach_port_t auth) +{ + return ports_lookup_port (auth_bucket, auth, authhandle_portclass); +} + +static inline void __attribute__ ((unused)) +end_using_authhandle (struct authhandle *auth) +{ + if (auth) + ports_port_deref (auth); +} + +#endif /* __AUTH_MIG_DECLS_H__ */ diff --git a/auth/mig-mutate.h b/auth/mig-mutate.h new file mode 100644 index 00000000..ea40c707 --- /dev/null +++ b/auth/mig-mutate.h @@ -0,0 +1,24 @@ +/* + Copyright (C) 1991,93,94,2014 Free Software Foundation, Inc. + Written by Michael I. Bushnell. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ + +/* CPP definitions for MiG processing of auth.defs for auth server. */ + +#define AUTH_INTRAN authhandle_t auth_port_to_handle (auth_t) +#define AUTH_DESTRUCTOR end_using_authhandle (authhandle_t) +#define AUTH_IMPORTS import "mig-decls.h"; diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index 0977a5d8..8f8e13e4 100644 --- a/mach-defpager/default_pager.c +++ b/mach-defpager/default_pager.c @@ -51,6 +51,7 @@ #include <errno.h> #include <stdio.h> #include <string.h> +#include <stdarg.h> #include <file_io.h> @@ -63,24 +64,30 @@ static char my_name[] = "(default pager):"; -static pthread_mutex_t printf_lock = PTHREAD_MUTEX_INITIALIZER; +static void __attribute__ ((format (printf, 1, 2), unused)) +synchronized_printf (const char *fmt, ...) +{ + static pthread_mutex_t printf_lock = PTHREAD_MUTEX_INITIALIZER; + va_list ap; + + va_start (ap, fmt); + pthread_mutex_lock (&printf_lock); + + vprintf (fmt, ap); + fflush (stdout); + + pthread_mutex_unlock (&printf_lock); + va_end (ap); +} #if 0 -#define dprintf(f, x...) \ - ({ pthread_mutex_lock (&printf_lock); \ - printf (f , ##x); \ - fflush (stdout); \ - pthread_mutex_unlock (&printf_lock); }) +#define dprintf(f, x...) synchronized_printf (f, ##x) #else #define dprintf(f, x...) #endif #if 0 -#define ddprintf(f, x...) \ - ({ pthread_mutex_lock (&printf_lock); \ - printf (f , ##x); \ - fflush (stdout); \ - pthread_mutex_unlock (&printf_lock); }) +#define ddprintf(f, x...) synchronized_printf (f, ##x) #else #define ddprintf(f, x...) #endif @@ -98,10 +105,7 @@ static pthread_mutex_t printf_lock = PTHREAD_MUTEX_INITIALIZER; #define ptoa(p) ((p)*vm_page_size) #define atop(a) ((a)/vm_page_size) - -/* - */ /* * Bitmap allocation. */ @@ -205,8 +209,6 @@ new_partition (const char *name, struct file_direct *fdp, part = partition_of(i); if (part && part->id == id) { - printf ("(default pager): Already paging to partition %s!\n", - name); pthread_mutex_unlock(&all_partitions.lock); return 0; } @@ -249,7 +251,8 @@ new_partition (const char *name, struct file_direct *fdp, { /* Filesystem block size is smaller than page size, so we must do several reads to get the whole page. */ - vm_address_t baddr, bsize; + vm_address_t baddr; + vm_size_t bsize; rc = page_read_file_direct(part->file, rsize, LINUX_PAGE_SIZE-rsize, &baddr, @@ -627,10 +630,7 @@ ddprintf ("pager_dealloc_page(%d,%x,%d)\n",pindex,page,lock_it); if (lock_it) pthread_mutex_unlock(&part->p_lock); } - -/* - */ /* * Allocation info for each paging object. * @@ -759,7 +759,9 @@ pager_alloc(pager, part, size) vm_size_t size; /* in BYTES */ { int i; +#ifdef CHECKSUM dp_map_t mapptr, emapptr; +#endif pthread_mutex_init(&pager->lock, NULL); #if DEBUG_READER_CONFLICTS @@ -1098,8 +1100,6 @@ dealloc_direct (dp_map_t mapptr, static void pager_truncate(dpager_t pager, vm_size_t new_size) /* in pages */ { - dp_map_t new_mapptr; - dp_map_t old_mapptr; int i; vm_size_t old_size; @@ -1706,11 +1706,7 @@ ok: pager->cur_partition = choose_partition(0, P_INDEX_INVALID); return TRUE; } - -/* - */ - /* * Read/write routines. */ @@ -1888,10 +1884,7 @@ default_has_page(ds, offset) { return ( ! no_block(pager_read_offset(ds, offset)) ); } -/* - */ - /* * Mapping between pager port and paging object. */ @@ -1997,7 +1990,7 @@ destroy_paging_partition(name, pp_private) void **pp_private; { unsigned int id = part_id(name); - partition_t part; + partition_t part = NULL; boolean_t all_ok = TRUE; default_pager_t entry; int pindex; @@ -2012,7 +2005,7 @@ destroy_paging_partition(name, pp_private) part = partition_of(pindex); if (part && (part->id == id)) break; } - if (pindex == all_partitions.n_partitions) { + if (! part) { pthread_mutex_unlock(&all_partitions.lock); return KERN_INVALID_ARGUMENT; } @@ -2512,7 +2505,6 @@ seqnos_memory_object_terminate(pager, seqno, pager_request, pager_name) mach_port_t pager_name; { default_pager_t ds; - kern_return_t kr; static char here[] = "%sterminate"; /* @@ -2524,7 +2516,7 @@ seqnos_memory_object_terminate(pager, seqno, pager_request, pager_name) if (ds == DEFAULT_PAGER_NULL) panic(here, my_name); ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_lock: <%p>[s:%d,r:%d,w:%d,l:%d], %d\n", - &kr, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held, seqno); + &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held, seqno); pager_port_lock(ds, seqno); /* @@ -2555,7 +2547,7 @@ ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_lock: <%p>[s:%d,r:%d, ds->pager_name = MACH_PORT_NULL; ds->name_refs = 0; ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_unlock: <%p>[s:%d,r:%d,w:%d,l:%d]\n", - &kr, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held); + &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held); pager_port_unlock(ds); /* @@ -2853,7 +2845,6 @@ seqnos_memory_object_data_write(pager, seqno, pager_request, vm_size_t tail_size = round_page(limit) - limit; memset((void *) tail, 0, tail_size); - unsigned *arr = (unsigned *)addr; memory_object_data_supply(pager_request, trunc_page(limit), addr, vm_page_size, TRUE, VM_PROT_NONE, TRUE, MACH_PORT_NULL); @@ -3431,13 +3422,13 @@ S_default_pager_objects (mach_port_t pager, mach_port_array_t *portsp, natural_t *pcountp) { - vm_offset_t oaddr; /* memory for objects */ - vm_size_t osize; /* current size */ + vm_offset_t oaddr = 0; /* memory for objects */ + vm_size_t osize = 0; /* current size */ default_pager_object_t *objects; natural_t opotential; - vm_offset_t paddr; /* memory for ports */ - vm_size_t psize; /* current size */ + vm_offset_t paddr = 0; /* memory for ports */ + vm_size_t psize = 0; /* current size */ mach_port_t *ports; natural_t ppotential; @@ -3665,8 +3656,8 @@ S_default_pager_object_pages (mach_port_t pager, default_pager_page_array_t *pagesp, natural_t *countp) { - vm_offset_t addr; /* memory for page offsets */ - vm_size_t size; /* current memory size */ + vm_offset_t addr = 0; /* memory for page offsets */ + vm_size_t size = 0; /* current memory size */ default_pager_page_t *pages; natural_t potential, actual; kern_return_t kr; @@ -3769,7 +3760,7 @@ S_default_pager_object_set_size (mach_port_t pager, mach_port_seqno_t seqno, vm_size_t limit) { - kern_return_t kr; + kern_return_t kr = KERN_SUCCESS; default_pager_t ds; ds = pager_port_lookup(pager); diff --git a/mach-defpager/file_io.h b/mach-defpager/file_io.h index d0b03f33..2721412b 100644 --- a/mach-defpager/file_io.h +++ b/mach-defpager/file_io.h @@ -57,13 +57,13 @@ struct file_direct int page_read_file_direct (struct file_direct *fdp, vm_offset_t offset, vm_size_t size, - vm_offset_t *addr, /* out */ - mach_msg_type_number_t *size_read); /* out */ + vm_offset_t *addr, /* out */ + vm_size_t *size_read); /* out */ int page_write_file_direct(struct file_direct *fdp, vm_offset_t offset, vm_offset_t addr, vm_size_t size, - vm_offset_t *size_written); /* out */ + vm_size_t *size_written); /* out */ #endif /* file_io.h */ diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c index 777cd3d5..2f8f002e 100644 --- a/mach-defpager/kalloc.c +++ b/mach-defpager/kalloc.c @@ -122,7 +122,7 @@ void kalloc_init(void) */ vm_offset_t kget_space(vm_offset_t size) { - vm_size_t space_to_add; + vm_size_t space_to_add = 0; vm_offset_t new_space = 0; vm_offset_t addr; diff --git a/mach-defpager/setup.c b/mach-defpager/setup.c index 080b0fa6..7c1afbc9 100644 --- a/mach-defpager/setup.c +++ b/mach-defpager/setup.c @@ -106,8 +106,8 @@ int page_read_file_direct (struct file_direct *fdp, vm_offset_t offset, vm_size_t size, - vm_offset_t *addr, /* out */ - mach_msg_type_number_t *size_read) /* out */ + vm_offset_t *addr, /* out */ + vm_size_t *size_read) /* out */ { struct storage_run *r; error_t err; @@ -173,7 +173,7 @@ page_write_file_direct(struct file_direct *fdp, vm_offset_t offset, vm_offset_t addr, vm_size_t size, - vm_offset_t *size_written) /* out */ + vm_size_t *size_written) /* out */ { struct storage_run *r; error_t err; diff --git a/utils/Makefile b/utils/Makefile index 5ebb2310..81fa2932 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -73,7 +73,7 @@ rpctrace-CPPFLAGS = -DDATADIR=\"${datadir}\" fakeauth: authServer.o auth_requestUser.o interruptServer.o \ ../libports/libports.a ../libihash/libihash.a \ ../libshouldbeinlibc/libshouldbeinlibc.a -auth-MIGSFLAGS = -imacros $(srcdir)/../auth/authmutations.h +auth-MIGSFLAGS = -imacros $(srcdir)/../auth/mig-mutate.h fakeauth-CPPFLAGS = -I$(srcdir)/../auth authServer-CPPFLAGS = -I$(srcdir)/../auth auth_requestUser-CPPFLAGS = -I$(srcdir)/../auth diff --git a/utils/fakeauth.c b/utils/fakeauth.c index 660295f9..590a421a 100644 --- a/utils/fakeauth.c +++ b/utils/fakeauth.c @@ -30,6 +30,8 @@ #include "auth_request_U.h" #include "interrupt_S.h" +#include "../auth/auth.h" + /* Auth handles are server ports with sets of ids. */ struct authhandle { @@ -63,14 +65,6 @@ destroy_authhandle (void *p) idvec_free_contents (&h->auids); idvec_free_contents (&h->agids); } - -/* Called by server stub functions. */ - -authhandle_t -auth_port_to_handle (auth_t auth) -{ - return ports_lookup_port (auth_bucket, auth, authhandle_portclass); -} /* id management. */ |