diff options
Diffstat (limited to 'libshouldbeinlibc')
-rw-r--r-- | libshouldbeinlibc/idvec-funcs.c | 2 | ||||
-rw-r--r-- | libshouldbeinlibc/idvec.h | 23 | ||||
-rw-r--r-- | libshouldbeinlibc/maptime-funcs.c | 2 | ||||
-rw-r--r-- | libshouldbeinlibc/maptime.h | 17 | ||||
-rw-r--r-- | libshouldbeinlibc/ugids-xinl.c | 4 | ||||
-rw-r--r-- | libshouldbeinlibc/ugids.h | 19 |
6 files changed, 54 insertions, 13 deletions
diff --git a/libshouldbeinlibc/idvec-funcs.c b/libshouldbeinlibc/idvec-funcs.c index 1bc6d85f..3bb0318d 100644 --- a/libshouldbeinlibc/idvec-funcs.c +++ b/libshouldbeinlibc/idvec-funcs.c @@ -1,2 +1,2 @@ -#define IDVEC_EI +#define IDVEC_DEFINE_EI #include "idvec.h" diff --git a/libshouldbeinlibc/idvec.h b/libshouldbeinlibc/idvec.h index 3c70a5d7..abbc273e 100644 --- a/libshouldbeinlibc/idvec.h +++ b/libshouldbeinlibc/idvec.h @@ -24,9 +24,12 @@ #include <hurd/hurd_types.h> #include <errno.h> #include <string.h> +#include <features.h> -#ifndef IDVEC_EI -#define IDVEC_EI extern inline +#ifdef IDVEC_DEFINE_EI +#define IDVEC_EI +#else +#define IDVEC_EI __extern_inline #endif struct idvec @@ -50,6 +53,14 @@ void idvec_free_wrapper (struct idvec *idvec); /* Free IDVEC and any storage associated with it. */ void idvec_free (struct idvec *idvec); +extern void idvec_clear (struct idvec *idvec); + +extern int idvec_is_empty (const struct idvec *idvec); + +extern int idvec_equal (const struct idvec *idvec1, const struct idvec *idvec2); + +#if defined(__USE_EXTERN_INLINES) || defined(IDVEC_DEFINE_EI) + /* Mark IDVEC as not containing any ids. */ IDVEC_EI void idvec_clear (struct idvec *idvec) @@ -74,6 +85,8 @@ idvec_equal (const struct idvec *idvec1, const struct idvec *idvec2) || memcmp (idvec1->ids, idvec2->ids, num * sizeof *idvec1->ids) == 0); } +#endif /* Use extern inlines. */ + /* Ensure that IDVEC has enough spaced allocated to hold NUM ids, thus ensuring that any subsequent ids added won't return a memory allocation error unless it would result in more ids that NUM. ENOMEM is returned if @@ -87,6 +100,10 @@ error_t idvec_grow (struct idvec *idvec, unsigned inc); /* Returns true if IDVEC contains ID, at or after position POS. */ int idvec_tail_contains (const struct idvec *idvec, unsigned pos, uid_t id); +extern int idvec_contains (const struct idvec *idvec, uid_t id); + +#if defined(__USE_EXTERN_INLINES) || defined(IDVEC_DEFINE_EI) + /* Returns true if IDVEC contains ID. */ IDVEC_EI int idvec_contains (const struct idvec *idvec, uid_t id) @@ -94,6 +111,8 @@ idvec_contains (const struct idvec *idvec, uid_t id) return idvec_tail_contains (idvec, 0, id); } +#endif /* Use extern inlines. */ + /* Insert ID into IDVEC at position POS, returning ENOMEM if there wasn't enough memory, or 0. */ error_t idvec_insert (struct idvec *idvec, unsigned pos, uid_t id); diff --git a/libshouldbeinlibc/maptime-funcs.c b/libshouldbeinlibc/maptime-funcs.c index eeac3b3e..080e3ae6 100644 --- a/libshouldbeinlibc/maptime-funcs.c +++ b/libshouldbeinlibc/maptime-funcs.c @@ -1,4 +1,4 @@ -#define MAPTIME_EI +#define MAPTIME_DEFINE_EI #include <errno.h> #include <sys/types.h> #include <sys/time.h> diff --git a/libshouldbeinlibc/maptime.h b/libshouldbeinlibc/maptime.h index ac97b411..947ad640 100644 --- a/libshouldbeinlibc/maptime.h +++ b/libshouldbeinlibc/maptime.h @@ -21,13 +21,16 @@ #ifndef __MAPTIME_H__ #define __MAPTIME_H__ -#ifndef MAPTIME_EI -#define MAPTIME_EI extern inline -#endif - #include <mach/time_value.h> #include <sys/time.h> #include <errno.h> +#include <features.h> + +#ifdef MAPTIME_DEFINE_EI +#define MAPTIME_EI +#else +#define MAPTIME_EI __extern_inline +#endif /* Return the mach mapped time page in MTIME. If USE_MACH_DEV is false, then the hurd time device DEV_NAME, or "/dev/time" if DEV_NAME is 0, is @@ -37,6 +40,10 @@ error_t maptime_map (int use_mach_dev, char *dev_name, volatile struct mapped_time_value **mtime); +extern void maptime_read (volatile struct mapped_time_value *mtime, struct timeval *tv); + +#if defined(__USE_EXTERN_INLINES) || defined(MAPTIME_DEFINE_EI) + /* Read the current time from MTIME into TV. This should be very fast. */ MAPTIME_EI void maptime_read (volatile struct mapped_time_value *mtime, struct timeval *tv) @@ -49,4 +56,6 @@ maptime_read (volatile struct mapped_time_value *mtime, struct timeval *tv) while (tv->tv_sec != mtime->check_seconds); } +#endif /* Use extern inlines. */ + #endif /* __MAPTIME_H__ */ diff --git a/libshouldbeinlibc/ugids-xinl.c b/libshouldbeinlibc/ugids-xinl.c index 26df93cc..107de8b9 100644 --- a/libshouldbeinlibc/ugids-xinl.c +++ b/libshouldbeinlibc/ugids-xinl.c @@ -19,7 +19,5 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define UGIDS_EI -#undef __OPTIMIZE__ -#define __OPTIMIZE__ 1 +#define UGIDS_DEFINE_EI #include "ugids.h" diff --git a/libshouldbeinlibc/ugids.h b/libshouldbeinlibc/ugids.h index 8440b608..10e7a242 100644 --- a/libshouldbeinlibc/ugids.h +++ b/libshouldbeinlibc/ugids.h @@ -23,9 +23,12 @@ #include <stdlib.h> /* For inline function stuff. */ #include <idvec.h> +#include <features.h> -#ifndef UGIDS_EI -#define UGIDS_EI extern inline +#ifdef UGIDS_DEFINE_EI +#define UGIDS_EI +#else +#define UGIDS_EI __extern_inline #endif /* A structure holding a set of the common various types of ids. */ @@ -47,6 +50,16 @@ struct ugids /* Return a new ugids structure, or 0 if an allocation error occurs. */ struct ugids *make_ugids (); +extern void ugids_fini (struct ugids *ugids); + +extern void ugids_free (struct ugids *ugids); + +extern int ugids_is_empty (const struct ugids *ugids); + +extern int ugids_equal (const struct ugids *ugids1, const struct ugids *ugids2); + +#if defined(__USE_EXTERN_INLINES) || defined(UGIDS_DEFINE_EI) + /* Free all resources used by UGIDS except UGIDS itself. */ UGIDS_EI void ugids_fini (struct ugids *ugids) @@ -93,6 +106,8 @@ ugids_equal (const struct ugids *ugids1, const struct ugids *ugids2) && idvec_equal (&ugids1->imp_avail_gids, &ugids2->imp_avail_gids); } +#endif /* Use extern inlines. */ + /* Add all ids in NEW to UGIDS. */ error_t ugids_merge (struct ugids *ugids, const struct ugids *new); |