libc, libutil: remove compat hacks

This commit is contained in:
Ben Gras 2013-01-07 19:10:08 +00:00
parent 604046faf3
commit 017ce5a503
40 changed files with 180 additions and 83 deletions

View file

@ -1,32 +0,0 @@
ORIGFUNC= ${.PREFIX:S/^compat//}
RENAMEDFUNC=${.PREFIX:S/^compat__//:C/([0-9]{2})$//}
.if (${MACHINE_ARCH} == "i386")
FUNCTYPE= @function
PICJMP= jmpl *PIC_PLT(${ORIGFUNC})
JMP= jmp ${ORIGFUNC}
.elif (${MACHINE_ARCH} == "arm")
FUNCTYPE= %%function
PICJMP= bl PIC_SYM(${ORIGFUNC}, PLT)
JMP= b ${ORIGFUNC}
.endif
${ASM}:
${_MKTARGET_CREATE}
printf '/* MINIX3 */ \n\
/* \n\
* Compatibility jump table for renamed symbols. \n\
* \n\
* DO NOT EDIT: this file is automatically generated. \n\
*/ \n\
#include <machine/asm.h> \n\
.global ${RENAMEDFUNC}; \n\
.global ${ORIGFUNC}; \n\
.type ${RENAMEDFUNC},${FUNCTYPE} \n\
${RENAMEDFUNC}: \n\
#ifdef PIC \n\
${PICJMP} \n\
#else \n\
${JMP} \n\
#endif \n\
\n ' >${.TARGET}

View file

@ -55,8 +55,6 @@ COMPATDIR=${.CURDIR}/compat
.else .else
SUBDIR+= pkgconfig SUBDIR+= pkgconfig
.include <bsd.subdir.mk> .include <bsd.subdir.mk>
COMPATDIR= ${.CURDIR}/compat-minix
.include "${.CURDIR}/compat-minix/Makefile.inc"
.endif .endif
.endif .endif

View file

@ -111,3 +111,8 @@ ENTRY(__longjmp14)
incl %eax incl %eax
1: movl %ecx,0(%esp) 1: movl %ecx,0(%esp)
ret ret
#ifdef __minix
.weak longjmp; sigsetjmp = __longjmp14
.weak setjmp; sigsetjmp = __setjmp14
#endif

View file

@ -111,3 +111,8 @@ ENTRY(__siglongjmp14)
incl %eax incl %eax
3: movl %ecx,0(%esp) 3: movl %ecx,0(%esp)
ret ret
#ifdef __minix
.weak sigsetjmp; sigsetjmp = __sigsetjmp14
.weak siglongjmp; siglongjmp = __siglongjmp14
#endif

View file

@ -1,38 +0,0 @@
ASM= compat__opendir230.S compat__alphasort30.S compat__ctime50.S \
compat__ctime_r50.S compat__ctime_rz50.S compat__dbm_delete13.S \
compat__dbm_fetch13.S compat__dbm_firstkey13.S \
compat__dbm_nextkey13.S compat__dbm_store13.S compat__difftime50.S \
compat__fts_children60.S compat__fts_close60.S compat__fts_open60.S \
compat__fts_read60.S compat__fts_set60.S compat__getdents30.S \
compat__getitimer50.S compat__getlastlogx50.S compat__getpwent50.S \
compat__getpwent_r50.S compat__getpwnam50.S compat__getpwnam_r50.S \
compat__getpwuid50.S compat__getpwuid_r50.S compat__getutent50.S \
compat__getutmp50.S compat__getutmpx50.S compat__getutxent50.S \
compat__getutxid50.S compat__getutxline50.S compat__glob30.S \
compat__globfree30.S compat__gmtime50.S compat__gmtime_r50.S \
compat__localtime_r50.S compat__localtime_rz50.S \
compat__longjmp14.S compat__mknod50.S compat__mktime50.S \
compat__mktime_z50.S compat__nanosleep50.S compat__offtime50.S \
compat__offtime_r50.S compat__opendir30.S compat__posix2time50.S \
compat__posix2time_z50.S compat__pututxline50.S \
compat__pwcache_userdb50.S compat__readdir30.S compat__readdir_r30.S \
compat___readdir_unlocked50.S compat__scandir30.S compat__select50.S \
compat__setitimer50.S compat__setjmp14.S compat__setlocale50.S \
compat__settimeofday50.S compat__shmctl50.S compat__sigaction14.S \
compat__sigaddset14.S compat__sigdelset14.S compat__sigemptyset14.S \
compat__sigfillset14.S compat__sigismember14.S compat__siglongjmp14.S \
compat__sigpending14.S compat__sigprocmask14.S compat__sigsetjmp14.S \
compat__sigsuspend14.S compat__time50.S compat__time2posix50.S \
compat__stat50.S compat__fstat50.S compat__lstat50.S \
compat__time2posix_z50.S compat__timegm50.S compat__timelocal50.S \
compat__timelocal_z50.S compat__timeoff50.S compat__tzalloc50.S \
compat__tzfree50.S compat__tzgetname50.S compat__tzset50.S \
compat__tzsetwall50.S compat__unsetenv13.S compat__unvis13.S \
compat__updlastlogx50.S compat__updwtmpx50.S compat__utime50.S \
compat__vfork14.S
SRCS+= ${ASM}
CLEANFILES+= ${ASM}
.include "../generateasm.mk"

View file

@ -156,3 +156,11 @@ dbm_store(DBM *db, datum key, datum data, int flags)
return ((db->put)(db, &dbtkey, &dbtdata, return ((db->put)(db, &dbtkey, &dbtdata,
(u_int)((flags == DBM_INSERT) ? R_NOOVERWRITE : 0))); (u_int)((flags == DBM_INSERT) ? R_NOOVERWRITE : 0)));
} }
#ifdef __minix
__weak_alias(dbm_delete, __dbm_delete13)
__weak_alias(dbm_fetch, __dbm_fetch13)
__weak_alias(dbm_firstkey, __dbm_firstkey13)
__weak_alias(dbm_nextkey, __dbm_nextkey13)
__weak_alias(dbm_store, __dbm_store13)
#endif

View file

@ -57,3 +57,7 @@ alphasort(const void *d1, const void *d2)
return (strcmp((*(const struct dirent *const *)d1)->d_name, return (strcmp((*(const struct dirent *const *)d1)->d_name,
(*(const struct dirent *const *)d2)->d_name)); (*(const struct dirent *const *)d2)->d_name));
} }
#ifdef __minix
__weak_alias(alphasort, __alphasort30)
#endif

View file

@ -1225,3 +1225,11 @@ bail:
} }
return ret; return ret;
} }
#ifdef __minix
__weak_alias(fts_children, __fts_children60)
__weak_alias(fts_close, __fts_close60)
__weak_alias(fts_open, __fts_open60)
__weak_alias(fts_read, __fts_read60)
__weak_alias(fts_set, __fts_set60)
#endif

View file

@ -2578,3 +2578,12 @@ setpwent(void)
__nsdefaultcompat_forceall); __nsdefaultcompat_forceall);
mutex_unlock(&_pwmutex); mutex_unlock(&_pwmutex);
} }
#ifdef __minix
__weak_alias(getpwent, __getpwent50)
__weak_alias(getpwent_r, __getpwent_r50)
__weak_alias(getpwnam, __getpwnam50)
__weak_alias(getpwnam_r, __getpwnam_r50)
__weak_alias(getpwuid, __getpwuid50)
__weak_alias(getpwuid_r, __getpwuid_r50)
#endif

View file

@ -1168,3 +1168,8 @@ qprintf(const char *str, Char *s)
(void)printf("\n"); (void)printf("\n");
} }
#endif #endif
#ifdef __minix
__weak_alias(glob, __glob30)
__weak_alias(globfree, __globfree30)
#endif

View file

@ -22,3 +22,7 @@ int utime(const char *name, const struct utimbuf *timp)
m.m2_p1 = (char *) __UNCONST(name); m.m2_p1 = (char *) __UNCONST(name);
return(_syscall(VFS_PROC_NR, UTIME, &m)); return(_syscall(VFS_PROC_NR, UTIME, &m));
} }
#ifdef __minix
__weak_alias(utime, __utime50)
#endif

View file

@ -641,3 +641,7 @@ main(int argc, char *argv[])
} }
#endif /* TEST_PWCACHE */ #endif /* TEST_PWCACHE */
#endif /* !HAVE_PWCACHE_USERDB */ #endif /* !HAVE_PWCACHE_USERDB */
#ifdef __minix
__weak_alias(pwcache_userdb, __pwcache_userdb50)
#endif

View file

@ -149,3 +149,9 @@ readdir_r(dirp, entry, result)
return (0); return (0);
} }
#ifdef __minix
__weak_alias(readdir, __readdir30)
__weak_alias(readdir_r, __readdir_r30)
__weak_alias(readdir_unlocked, ___readdir_unlocked50)
#endif

View file

@ -153,3 +153,7 @@ bad:
(void)closedir(dirp); (void)closedir(dirp);
return -1; return -1;
} }
#ifdef __minix
__weak_alias(scandir, __scandir30)
#endif

View file

@ -44,3 +44,11 @@ __RCSID("$NetBSD: sigsetops.c,v 1.16 2010/07/31 00:04:43 joerg Exp $");
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#ifdef __minix
__weak_alias(sigaddset, __sigaddset14)
__weak_alias(sigdelset, __sigdelset14)
__weak_alias(sigemptyset, __sigemptyset14)
__weak_alias(sigfillset, __sigfillset14)
__weak_alias(sigismember, __sigismember14)
#endif

View file

@ -55,3 +55,7 @@ time(time_t *t)
*t = tt.tv_sec; *t = tt.tv_sec;
return tt.tv_sec; return tt.tv_sec;
} }
#ifdef __minix
__weak_alias(time, __time50)
#endif

View file

@ -104,3 +104,7 @@ utmpname(const char *fname)
endutent(); endutent();
return 1; return 1;
} }
#ifdef __minix
__weak_alias(getutent, __getutent50)
#endif

View file

@ -511,3 +511,15 @@ updlastlogx(const char *fname, uid_t uid, struct lastlogx *ll)
(db->close)(db); (db->close)(db);
return error; return error;
} }
#ifdef __minix
__weak_alias(getlastlogx, __getlastlogx50)
__weak_alias(getutmp, __getutmp50)
__weak_alias(getutmpx, __getutmpx50)
__weak_alias(getutxent, __getutxent50)
__weak_alias(getutxid, __getutxid50)
__weak_alias(getutxline, __getutxline50)
__weak_alias(pututxline, __pututxline50)
__weak_alias(updlastlogx, __updlastlogx50)
__weak_alias(updwtmpx, __updwtmpx50)
#endif

View file

@ -171,3 +171,7 @@ setlocale(int category, const char *locale)
__mb_len_max_runtime = MB_LEN_MAX; __mb_len_max_runtime = MB_LEN_MAX;
return __setlocale(category, locale); return __setlocale(category, locale);
} }
#ifdef __minix
__weak_alias(setlocale, __setlocale50)
#endif

View file

@ -104,3 +104,7 @@ unsetenv(const char *name)
(void)__unlockenv(); (void)__unlockenv();
return 0; return 0;
} }
#ifdef __minix
__weak_alias(unsetenv, __unsetenv13)
#endif

View file

@ -13,3 +13,7 @@ ssize_t getdents(int fd, char *buffer, size_t nbytes)
m.m1_p1 = (char *) buffer; m.m1_p1 = (char *) buffer;
return _syscall(VFS_PROC_NR, GETDENTS, &m); return _syscall(VFS_PROC_NR, GETDENTS, &m);
} }
#ifdef __minix
__weak_alias(getdents, __getdents30)
#endif

View file

@ -18,3 +18,7 @@ int getitimer(int which, struct itimerval *value)
return _syscall(PM_PROC_NR, ITIMER, &m); return _syscall(PM_PROC_NR, ITIMER, &m);
} }
#ifdef __minix
__weak_alias(getitimer, __getitimer50)
#endif

View file

@ -18,3 +18,7 @@ int mknod(const char *name, mode_t mode, dev_t dev)
m.m1_p2 = (char *) ((int) 0); /* obsolete size field */ m.m1_p2 = (char *) ((int) 0); /* obsolete size field */
return(_syscall(VFS_PROC_NR, MKNOD, &m)); return(_syscall(VFS_PROC_NR, MKNOD, &m));
} }
#ifdef __minix
__weak_alias(mknod, __mknod50)
#endif

View file

@ -90,3 +90,7 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
return r; return r;
} }
#ifdef __minix
__weak_alias(nanosleep, __nanosleep50)
#endif

View file

@ -20,3 +20,7 @@ int select(int nfds,
return (_syscall(VFS_PROC_NR, SELECT, &m)); return (_syscall(VFS_PROC_NR, SELECT, &m));
} }
#ifdef __minix
__weak_alias(select, __select50)
#endif

View file

@ -24,3 +24,7 @@ int setitimer(int which, const struct itimerval *__restrict value,
return _syscall(PM_PROC_NR, ITIMER, &m); return _syscall(PM_PROC_NR, ITIMER, &m);
} }
#ifdef __minix
__weak_alias(setitimer, __setitimer50)
#endif

View file

@ -13,3 +13,7 @@ int settimeofday(const struct timeval *tp, const void *tzp)
/* Ignore time zones */ /* Ignore time zones */
return stime(&sec); return stime(&sec);
} }
#ifdef __minix
__weak_alias(settimeofday, __settimeofday50)
#endif

View file

@ -40,3 +40,7 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf)
return m.SHMCTL_RET; return m.SHMCTL_RET;
return r; return r;
} }
#ifdef __minix
__weak_alias(shmctl, __shmctl50)
#endif

View file

@ -18,3 +18,7 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
return(_syscall(PM_PROC_NR, SIGACTION, &m)); return(_syscall(PM_PROC_NR, SIGACTION, &m));
} }
#ifdef __minix
__weak_alias(sigaction, __sigaction14)
#endif

View file

@ -13,3 +13,7 @@ sigset_t *set;
*set = (sigset_t) m.m2_l1; *set = (sigset_t) m.m2_l1;
return(m.m_type); return(m.m_type);
} }
#ifdef __minix
__weak_alias(sigpending, __sigpending14)
#endif

View file

@ -22,3 +22,7 @@ sigset_t *oset;
if (oset != (sigset_t *) NULL) *oset = (sigset_t) (m.m2_l1); if (oset != (sigset_t *) NULL) *oset = (sigset_t) (m.m2_l1);
return(m.m_type); return(m.m_type);
} }
#ifdef __minix
__weak_alias(sigprocmask, __sigprocmask14)
#endif

View file

@ -12,3 +12,7 @@ const sigset_t *set;
m.m2_l1 = (long) *set; m.m2_l1 = (long) *set;
return(_syscall(PM_PROC_NR, SIGSUSPEND, &m)); return(_syscall(PM_PROC_NR, SIGSUSPEND, &m));
} }
#ifdef __minix
__weak_alias(sigsuspend, __sigsuspend14)
#endif

View file

@ -72,3 +72,7 @@ const time_t time0;
return -(double) ((unsigned long) time0 + return -(double) ((unsigned long) time0 +
(unsigned long) (-(time1 + 1)) + 1); (unsigned long) (-(time1 + 1)) + 1);
} }
#ifdef __minix
__weak_alias(difftime, __difftime50)
#endif

View file

@ -2207,3 +2207,21 @@ posix2time(time_t t)
} }
#endif /* defined STD_INSPIRED */ #endif /* defined STD_INSPIRED */
#ifdef __minix
__weak_alias(gmtime, __gmtime50)
__weak_alias(gmtime_r, __gmtime_r50)
__weak_alias(offtime, __offtime50)
__weak_alias(offtime_r, __offtime_r50)
__weak_alias(time2posix, __time2posix50)
__weak_alias(time2posix_z, __time2posix_z50)
__weak_alias(timegm, __timegm50)
__weak_alias(timelocal, __timelocal50)
__weak_alias(timelocal_z, __timelocal_z50)
__weak_alias(timeoff, __timeoff50)
__weak_alias(tzalloc, __tzalloc50)
__weak_alias(tzfree, __tzfree50)
__weak_alias(tzgetname, __tzgetname50)
__weak_alias(tzset, __tzset50)
__weak_alias(tzsetwall, __tzsetwall50)
#endif

View file

@ -59,9 +59,7 @@ MAN= efun.3 getbootfile.3 \
YPREFIX=__pd YPREFIX=__pd
.PATH: ${NETBSDSRCDIR}/lib/libc/gen .PATH: ${NETBSDSRCDIR}/lib/libc/gen
.if defined(__MINIX) .if !defined(__MINIX)
.include "compat-minix/Makefile.inc"
.else
.include "compat/Makefile.inc" .include "compat/Makefile.inc"
.endif .endif

View file

@ -1,8 +0,0 @@
ASM= compat__login_getpwclass50.S compat__login50.S compat__loginx50.S \
compat__pw_copy50.S compat__pw_copyx50.S \
compat__pw_getpwconf50.S compat__setusercontext50.S
SRCS+= ${ASM}
CLEANFILES+= ${ASM}
.include "../generateasm.mk"

View file

@ -68,3 +68,5 @@ login(const struct utmp *ut)
(void)close(fd); (void)close(fd);
} }
} }
__weak_alias(login, __login50)

View file

@ -994,3 +994,6 @@ multiply(u_quad_t n1, u_quad_t n2)
return (m); return (m);
} }
__weak_alias(login_getpwclass, __login_getpwclass50)
__weak_alias(setusercontext, __setusercontext50)

View file

@ -52,3 +52,5 @@ loginx(const struct utmpx *ut)
(void)pututxline(ut); (void)pututxline(ut);
(void)updwtmpx(_PATH_WTMPX, ut); (void)updwtmpx(_PATH_WTMPX, ut);
} }
__weak_alias(loginx, __loginx50)

View file

@ -661,3 +661,7 @@ pw_getpwconf(char *data, size_t max, const struct passwd *pwd,
pw_getconf(data, max, "default", option); pw_getconf(data, max, "default", option);
} }
} }
__weak_alias(pw_copy, __pw_copy50)
__weak_alias(pw_copyx, __pw_copyx50)
__weak_alias(pw_getpwconf, __pw_getpwconf50)