* Makefile.in: Create libutil.a from bsdlib.o exports.
* bsdlib.cc (logwtmp): Move from syscalls.cc to here. (login): Ditto. (logout): Ditto. * winsup.h (EXPORT_ALIAS): New macro. * exec.cc: Define alias symbols using EXPORT_ALIAS macro. * syscalls.cc: Ditto. * times.cc: Ditto.
This commit is contained in:
parent
04d55823da
commit
4875a4b66e
@ -1,3 +1,15 @@
|
|||||||
|
2004-09-10 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* Makefile.in: Create libutil.a from bsdlib.o exports.
|
||||||
|
* bsdlib.cc (logwtmp): Move from syscalls.cc to here.
|
||||||
|
(login): Ditto.
|
||||||
|
(logout): Ditto.
|
||||||
|
|
||||||
|
* winsup.h (EXPORT_ALIAS): New macro.
|
||||||
|
* exec.cc: Define alias symbols using EXPORT_ALIAS macro.
|
||||||
|
* syscalls.cc: Ditto.
|
||||||
|
* times.cc: Ditto.
|
||||||
|
|
||||||
2004-09-09 Corinna Vinschen <corinna@vinschen.de>
|
2004-09-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_tape.cc (fhandler_dev_tape::open): Fix typo.
|
* fhandler_tape.cc (fhandler_dev_tape::open): Fix typo.
|
||||||
|
@ -213,7 +213,7 @@ API_VER:=$(srcdir)/include/cygwin/version.h
|
|||||||
PWD:=${shell pwd}
|
PWD:=${shell pwd}
|
||||||
LIB_NAME:=$(PWD)/libcygwin.a
|
LIB_NAME:=$(PWD)/libcygwin.a
|
||||||
LIBSERVER:=@LIBSERVER@
|
LIBSERVER:=@LIBSERVER@
|
||||||
SUBLIBS:=$(PWD)/libpthread.a $(PWD)/libm.a $(PWD)/libc.a
|
SUBLIBS:=$(PWD)/libpthread.a $(PWD)/libutil.a $(PWD)/libm.a $(PWD)/libc.a
|
||||||
EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a libtextreadmode.a
|
EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a libtextreadmode.a
|
||||||
INSTOBJS:=automode.o binmode.o textmode.o textreadmode.o
|
INSTOBJS:=automode.o binmode.o textmode.o textreadmode.o
|
||||||
TARGET_LIBS:=$(LIB_NAME) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
|
TARGET_LIBS:=$(LIB_NAME) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
|
||||||
@ -414,10 +414,13 @@ $(srcdir)/devices.cc: gendevices devices.in devices.h
|
|||||||
$(PWD)/libpthread.a: speclib $(LIB_NAME) pthread.o thread.o
|
$(PWD)/libpthread.a: speclib $(LIB_NAME) pthread.o thread.o
|
||||||
/bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
|
/bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
|
||||||
|
|
||||||
|
$(PWD)/libutil.a: speclib $(LIB_NAME) bsdlib.o
|
||||||
|
/bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
|
||||||
|
|
||||||
$(PWD)/libm.a: speclib $(LIB_NAME) $(LIBM)
|
$(PWD)/libm.a: speclib $(LIB_NAME) $(LIBM)
|
||||||
/bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
|
/bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
|
||||||
|
|
||||||
$(PWD)/libc.a: speclib $(LIB_NAME) $(PWD)/libm.a libpthread.a
|
$(PWD)/libc.a: speclib $(LIB_NAME) $(PWD)/libm.a libpthread.a libutil.a
|
||||||
/bin/sh ${word 1, $^} -v $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
|
/bin/sh ${word 1, $^} -v $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
|
||||||
|
|
||||||
lib%.a: %.o
|
lib%.a: %.o
|
||||||
|
@ -35,8 +35,7 @@ execve (const char *path, char *const argv[], char *const envp[])
|
|||||||
return spawnve (_P_OVERLAY, path, argv, envp);
|
return spawnve (_P_OVERLAY, path, argv, envp);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int _execve (const char *, char *const [], char *const [])
|
EXPORT_ALIAS (execve, _execve)
|
||||||
__attribute__ ((alias ("execve")));
|
|
||||||
|
|
||||||
extern "C" int
|
extern "C" int
|
||||||
execl (const char *path, const char *arg0, ...)
|
execl (const char *path, const char *arg0, ...)
|
||||||
|
@ -260,3 +260,52 @@ setprogname (const char *newprogname)
|
|||||||
__progname = (char *)newprogname;
|
__progname = (char *)newprogname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
logwtmp (const char *line, const char *user, const char *host)
|
||||||
|
{
|
||||||
|
struct utmp ut;
|
||||||
|
memset (&ut, 0, sizeof ut);
|
||||||
|
ut.ut_type = USER_PROCESS;
|
||||||
|
ut.ut_pid = getpid ();
|
||||||
|
if (line)
|
||||||
|
strncpy (ut.ut_line, line, sizeof ut.ut_line);
|
||||||
|
time (&ut.ut_time);
|
||||||
|
if (user)
|
||||||
|
strncpy (ut.ut_user, user, sizeof ut.ut_user);
|
||||||
|
if (host)
|
||||||
|
strncpy (ut.ut_host, host, sizeof ut.ut_host);
|
||||||
|
updwtmp (_PATH_WTMP, &ut);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
login (struct utmp *ut)
|
||||||
|
{
|
||||||
|
pututline (ut);
|
||||||
|
endutent ();
|
||||||
|
updwtmp (_PATH_WTMP, ut);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int
|
||||||
|
logout (char *line)
|
||||||
|
{
|
||||||
|
struct utmp ut_buf, *ut;
|
||||||
|
|
||||||
|
memset (&ut_buf, 0, sizeof ut_buf);
|
||||||
|
strncpy (ut_buf.ut_line, line, sizeof ut_buf.ut_line);
|
||||||
|
setutent ();
|
||||||
|
ut = getutline (&ut_buf);
|
||||||
|
|
||||||
|
if (ut)
|
||||||
|
{
|
||||||
|
ut->ut_type = DEAD_PROCESS;
|
||||||
|
memset (ut->ut_user, 0, sizeof ut->ut_user);
|
||||||
|
memset (ut->ut_host, 0, sizeof ut->ut_host);
|
||||||
|
time (&ut->ut_time);
|
||||||
|
debug_printf ("set logout time for %s", line);
|
||||||
|
pututline (ut);
|
||||||
|
endutent ();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -370,8 +370,7 @@ read (int fd, void *ptr, size_t len)
|
|||||||
return readv (fd, &iov, 1);
|
return readv (fd, &iov, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" ssize_t _read (int, void *, size_t)
|
EXPORT_ALIAS (read, _read)
|
||||||
__attribute__ ((alias ("read")));
|
|
||||||
|
|
||||||
extern "C" ssize_t
|
extern "C" ssize_t
|
||||||
write (int fd, const void *ptr, size_t len)
|
write (int fd, const void *ptr, size_t len)
|
||||||
@ -385,8 +384,7 @@ write (int fd, const void *ptr, size_t len)
|
|||||||
return writev (fd, &iov, 1);
|
return writev (fd, &iov, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" ssize_t _write (int fd, const void *ptr, size_t len)
|
EXPORT_ALIAS (write, _write)
|
||||||
__attribute__ ((alias ("write")));
|
|
||||||
|
|
||||||
extern "C" ssize_t
|
extern "C" ssize_t
|
||||||
readv (int fd, const struct iovec *const iov, const int iovcnt)
|
readv (int fd, const struct iovec *const iov, const int iovcnt)
|
||||||
@ -572,11 +570,8 @@ open (const char *unix_path, int flags, ...)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int _open (const char *, int flags, ...)
|
EXPORT_ALIAS (open, _open )
|
||||||
__attribute__ ((alias ("open")));
|
EXPORT_ALIAS (open, _open64 )
|
||||||
|
|
||||||
extern "C" int _open64 (const char *, int flags, ...)
|
|
||||||
__attribute__ ((alias ("open")));
|
|
||||||
|
|
||||||
extern "C" _off64_t
|
extern "C" _off64_t
|
||||||
lseek64 (int fd, _off64_t pos, int dir)
|
lseek64 (int fd, _off64_t pos, int dir)
|
||||||
@ -601,8 +596,7 @@ lseek64 (int fd, _off64_t pos, int dir)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int _lseek64 (int fd, _off64_t pos, int dir)
|
EXPORT_ALIAS (lseek64, _lseek64)
|
||||||
__attribute__ ((alias ("lseek64")));
|
|
||||||
|
|
||||||
extern "C" _off_t
|
extern "C" _off_t
|
||||||
lseek (int fd, _off_t pos, int dir)
|
lseek (int fd, _off_t pos, int dir)
|
||||||
@ -610,8 +604,7 @@ lseek (int fd, _off_t pos, int dir)
|
|||||||
return lseek64 (fd, (_off64_t) pos, dir);
|
return lseek64 (fd, (_off64_t) pos, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" _off_t _lseek (int, _off_t, int)
|
EXPORT_ALIAS (lseek, _lseek)
|
||||||
__attribute__ ((alias ("lseek")));
|
|
||||||
|
|
||||||
extern "C" int
|
extern "C" int
|
||||||
close (int fd)
|
close (int fd)
|
||||||
@ -635,7 +628,7 @@ close (int fd)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int _close (int) __attribute__ ((alias ("close")));
|
EXPORT_ALIAS (close, _close)
|
||||||
|
|
||||||
extern "C" int
|
extern "C" int
|
||||||
isatty (int fd)
|
isatty (int fd)
|
||||||
@ -2482,55 +2475,6 @@ updwtmp (const char *wtmp_file, const struct utmp *ut)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void
|
|
||||||
logwtmp (const char *line, const char *user, const char *host)
|
|
||||||
{
|
|
||||||
struct utmp ut;
|
|
||||||
memset (&ut, 0, sizeof ut);
|
|
||||||
ut.ut_type = USER_PROCESS;
|
|
||||||
ut.ut_pid = getpid ();
|
|
||||||
if (line)
|
|
||||||
strncpy (ut.ut_line, line, sizeof ut.ut_line);
|
|
||||||
time (&ut.ut_time);
|
|
||||||
if (user)
|
|
||||||
strncpy (ut.ut_user, user, sizeof ut.ut_user);
|
|
||||||
if (host)
|
|
||||||
strncpy (ut.ut_host, host, sizeof ut.ut_host);
|
|
||||||
updwtmp (_PATH_WTMP, &ut);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void
|
|
||||||
login (struct utmp *ut)
|
|
||||||
{
|
|
||||||
pututline (ut);
|
|
||||||
endutent ();
|
|
||||||
updwtmp (_PATH_WTMP, ut);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int
|
|
||||||
logout (char *line)
|
|
||||||
{
|
|
||||||
struct utmp ut_buf, *ut;
|
|
||||||
|
|
||||||
memset (&ut_buf, 0, sizeof ut_buf);
|
|
||||||
strncpy (ut_buf.ut_line, line, sizeof ut_buf.ut_line);
|
|
||||||
setutent ();
|
|
||||||
ut = getutline (&ut_buf);
|
|
||||||
|
|
||||||
if (ut)
|
|
||||||
{
|
|
||||||
ut->ut_type = DEAD_PROCESS;
|
|
||||||
memset (ut->ut_user, 0, sizeof ut->ut_user);
|
|
||||||
memset (ut->ut_host, 0, sizeof ut->ut_host);
|
|
||||||
time (&ut->ut_time);
|
|
||||||
debug_printf ("set logout time for %s", line);
|
|
||||||
pututline (ut);
|
|
||||||
endutent ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int utmp_fd = -1;
|
static int utmp_fd = -1;
|
||||||
static bool utmp_readonly = false;
|
static bool utmp_readonly = false;
|
||||||
static char *utmp_file = (char *) _PATH_UTMP;
|
static char *utmp_file = (char *) _PATH_UTMP;
|
||||||
|
@ -90,7 +90,7 @@ times (struct tms *buf)
|
|||||||
return tc;
|
return tc;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" clock_t _times (struct tms *) __attribute__((alias ("times")));
|
EXPORT_ALIAS (times, _times)
|
||||||
|
|
||||||
/* settimeofday: BSD */
|
/* settimeofday: BSD */
|
||||||
extern "C" int
|
extern "C" int
|
||||||
@ -172,8 +172,7 @@ gettimeofday (struct timeval *tv, struct timezone *tz)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int _gettimeofday (struct timeval *, struct timezone *)
|
EXPORT_ALIAS (gettimeofday, _gettimeofday)
|
||||||
__attribute__((alias ("gettimeofday")));
|
|
||||||
|
|
||||||
/* Cygwin internal */
|
/* Cygwin internal */
|
||||||
void
|
void
|
||||||
|
@ -32,6 +32,8 @@ details. */
|
|||||||
#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy")))
|
#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy")))
|
||||||
#define NO_COPY_INIT __attribute__((section(".data_cygwin_nocopy")))
|
#define NO_COPY_INIT __attribute__((section(".data_cygwin_nocopy")))
|
||||||
|
|
||||||
|
#define EXPORT_ALIAS(sym,symalias) extern "C" __typeof (sym) symalias __attribute__ ((alias(#sym)));
|
||||||
|
|
||||||
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ >= 199900L
|
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ >= 199900L
|
||||||
#define NEW_MACRO_VARARGS
|
#define NEW_MACRO_VARARGS
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user