Partially fix namespace visibility issues by using new visibility macros.

Some issues still remain, and will require research in old POSIX standards
if we care to get them right.
This commit is contained in:
Garrett Wollman 2002-06-15 23:35:37 +00:00
parent e7f478b2f6
commit 1cb2a9ae56
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98269
2 changed files with 89 additions and 63 deletions

View file

@ -45,13 +45,13 @@
#ifndef _TIME_H_
#define _TIME_H_
#include <sys/cdefs.h>
#include <machine/ansi.h>
#include <sys/_posix.h>
#ifndef _ANSI_SOURCE
#if __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
/*
* Frequency of the clock ticks reported by times(). Deprecated - use
* sysconf(_SC_CLK_TCK) instead.
* sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.)
*/
#define CLK_TCK _BSD_CLK_TCK_
#endif
@ -78,10 +78,7 @@ typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
/* XXX I'm not sure if _ANSI_SOURCE is playing properly
* with the setups in _posix.h:
*/
#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY)
#if __POSIX_VISIBLE >= 199309
/*
* New in POSIX 1003.1b-1993.
*/
@ -95,14 +92,8 @@ typedef _BSD_TIMER_T_ timer_t;
#undef _BSD_TIMER_T_
#endif
#ifndef _TIMESPEC_DECLARED
#define _TIMESPEC_DECLARED
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
#endif
#endif /* Neither ANSI nor POSIX */
#include <sys/timespec.h>
#endif /* __POSIX_VISIBLE >= 199309 */
struct tm {
int tm_sec; /* seconds after the minute [0-60] */
@ -118,9 +109,7 @@ struct tm {
char *tm_zone; /* timezone abbreviation */
};
#include <sys/cdefs.h>
#ifndef _ANSI_SOURCE
#if __POSIX_VISIBLE
extern char *tzname[];
#endif
@ -135,7 +124,7 @@ time_t mktime(struct tm *);
size_t strftime(char *, size_t, const char *, const struct tm *);
time_t time(time_t *);
#ifndef _ANSI_SOURCE
#if __BSD_VISIBLE /* XXX what are these? */
time_t _time32_to_time(__int32_t t32);
__int32_t _time_to_time32(time_t t);
time_t _time64_to_time(__int64_t t64);
@ -146,29 +135,34 @@ int _time_to_int(time_t t);
time_t _int_to_time(int tint);
#endif /* not ANSI */
#ifndef _ANSI_SOURCE
#if __POSIX_VISIBLE
void tzset(void);
#endif /* not ANSI */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
/* XXX - figure out which standard introduced these */
char *asctime_r(const struct tm *, char *);
char *ctime_r(const time_t *, char *);
struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime_r(const time_t *, struct tm *);
#endif
#if __XSI_VISIBLE
char *strptime(const char *, const char *, struct tm *);
#endif
#if __BSD_VISIBLE
char *timezone(int, int);
void tzsetwall(void);
time_t timelocal(struct tm * const);
time_t timegm(struct tm * const);
#endif /* neither ANSI nor POSIX */
#endif /* __BSD_VISIBLE */
#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY)
#if __POSIX_VISIBLE >= 199309
/* Introduced in POSIX 1003.1b-1993, not part of 1003.1-1990. */
int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
int clock_settime(clockid_t, const struct timespec *);
int nanosleep(const struct timespec *, struct timespec *);
#endif /* neither ANSI nor POSIX */
#endif /* __POSIX_VISIBLE >= 199309 */
__END_DECLS
#endif /* !_TIME_H_ */

View file

@ -74,7 +74,7 @@ typedef _BSD_UID_T_ uid_t;
#define NULL 0 /* null pointer constant */
#endif
#ifndef _POSIX_SOURCE
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define F_ULOCK 0 /* unlock locked section */
#define F_LOCK 1 /* lock a section for exclusive use */
#define F_TLOCK 2 /* test and lock a section for exclusive use */
@ -82,6 +82,7 @@ typedef _BSD_UID_T_ uid_t;
#endif
__BEGIN_DECLS
/* 1003.1-1990 */
void _exit(int) __dead2;
int access(const char *, int);
unsigned int alarm(unsigned int);
@ -137,52 +138,100 @@ extern char *optarg; /* getopt(3) external variables */
extern int optind, opterr, optopt;
int getopt(int, char * const [], const char *);
#ifndef _POSIX_SOURCE
/* 1003.1b-1993 */
#if __POSIX_VISIBLE >= 199309
/*
* Need to check old copies of POSIX to determine when each of these
* interfaces was added.
*/
size_t confstr(int, char *, size_t);
int fchown(int, uid_t, gid_t);
int fsync(int);
/* symlink is from .1a and XPG4.2 -- need to check version for the former */
int symlink(const char *, const char *);
#endif
/* ISO/IEC 9945-1: 1996 */
#if __POSIX_VISIBLE >= 199506
/*
* ftruncate() was in the POSIX Realtime Extension (it's used for shared
* memory), but truncate() was not.
*/
#ifndef _FTRUNCATE_DECLARED
#define _FTRUNCATE_DECLARED
int ftruncate(int, off_t);
#endif
int getlogin_r(char *, int);
#endif
/* 1003.1-2001 */
#if __POSIX_VISIBLE >= 200112
int gethostname(char *, int /* socklen_t */);
int setegid(gid_t);
int seteuid(uid_t);
#endif
/* X/Open System Interfaces */
#if __XSI_VISIBLE
char *crypt(const char *, const char *);
/* char *ctermid(char *); */ /* XXX ??? */
int encrypt(char *, int);
int fchdir(int);
int getpgid(pid_t _pid);
int getsid(pid_t _pid);
char *getwd(char *); /* LEGACY: obsoleted by getcwd() */
int lchown(const char *, uid_t, gid_t);
int lockf(int, int, off_t);
int nice(int);
ssize_t pread(int, void *, size_t, off_t);
ssize_t pwrite(int, const void *, size_t, off_t);
int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
/* void swab(const void *__restrict, void *__restrict, ssize_t); */
void sync(void);
unsigned int ualarm(unsigned int, unsigned int);
int usleep(unsigned int);
pid_t vfork(void);
/* See comment at ftruncate() above. */
#ifndef _TRUNCATE_DECLARED
#define _TRUNCATE_DECLARED
int truncate(const char *, off_t);
#endif
#endif /* __XSI_VISIBLE */
#if __BSD_VISIBLE
struct timeval; /* select(2) */
int acct(const char *);
int async_daemon(void);
int brk(const void *);
int chroot(const char *);
size_t confstr(int, char *, size_t);
char *crypt(const char *, const char *);
__const char *
const char *
crypt_get_format(void);
int crypt_set_format(const char *);
int des_cipher(const char *, char *, long, int);
int des_setkey(const char *key);
int encrypt(char *, int);
void endusershell(void);
int exect(const char *, char * const *, char * const *);
int fchdir(int);
int fchown(int, uid_t, gid_t);
char *fflagstostr(u_long);
int fsync(int);
#ifndef _FTRUNCATE_DECLARED
#define _FTRUNCATE_DECLARED
int ftruncate(int, off_t);
#endif
int getdomainname(char *, int);
int getdtablesize(void);
int getgrouplist(const char *, gid_t, gid_t *, int *);
long gethostid(void);
int gethostname(char *, int);
int getlogin_r(char *, int);
mode_t getmode(const void *, mode_t);
int getpagesize(void) __pure2;
char *getpass(const char *);
int getpeereid(int, uid_t *, gid_t *);
int getpgid(pid_t _pid);
int getresgid(gid_t *, gid_t *, gid_t *);
int getresuid(uid_t *, uid_t *, uid_t *);
int getsid(pid_t _pid);
char *getusershell(void);
char *getwd(char *); /* obsoleted by getcwd() */
int initgroups(const char *, gid_t);
int iruserok(unsigned long, int, const char *, const char *);
int iruserok_sa(const void *, int, int, const char *, const char *);
int issetugid(void);
int lchown(const char *, uid_t, gid_t);
int lockf(int, int, off_t);
char *mkdtemp(char *);
int mknod(const char *, mode_t, dev_t);
int mkstemp(char *);
@ -190,10 +239,7 @@ int mkstemps(char *, int);
char *mktemp(char *);
int nfsclnt(int, void *);
int nfssvc(int, void *);
int nice(int);
ssize_t pread(int, void *, size_t, off_t);
int profil(char *, size_t, vm_offset_t, int);
ssize_t pwrite(int, const void *, size_t, off_t);
int rcmd(char **, int, const char *, const char *, const char *, int *);
int rcmd_af(char **, int, const char *,
const char *, const char *, int *, int);
@ -212,44 +258,30 @@ int ruserok(const char *, int, const char *, const char *);
void *sbrk(intptr_t);
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
int setdomainname(const char *, int);
int setegid(gid_t);
int seteuid(uid_t);
int setgroups(int, const gid_t *);
void sethostid(long);
int sethostname(const char *, int);
int setkey(const char *);
int setlogin(const char *);
void *setmode(const char *);
int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
int setregid(gid_t, gid_t);
int setresgid(gid_t, gid_t, gid_t);
int setresuid(uid_t, uid_t, uid_t);
int setreuid(uid_t, uid_t);
int setrgid(gid_t);
int setruid(uid_t);
void setusershell(void);
int strtofflags(char **, u_long *, u_long *);
int swapon(const char *);
int symlink(const char *, const char *);
void sync(void);
int syscall(int, ...);
off_t __syscall(quad_t, ...);
#ifndef _TRUNCATE_DECLARED
#define _TRUNCATE_DECLARED
int truncate(const char *, off_t);
#endif
int ttyslot(void);
unsigned int ualarm(unsigned int, unsigned int);
int undelete(const char *);
int unwhiteout(const char *);
int usleep(unsigned int);
void *valloc(size_t); /* obsoleted by malloc() */
pid_t vfork(void);
extern char *suboptarg; /* getsubopt(3) external variable */
int getsubopt(char **, char * const *, char **);
#endif /* !_POSIX_SOURCE */
extern int optreset; /* getopt(3) external variable */
#endif /* __BSD_VISIBLE */
__END_DECLS
#endif /* !_UNISTD_H_ */