OSDN Git Service

* Makefile.in: Create libutil.a from bsdlib.o exports.
authorcorinna <corinna>
Fri, 10 Sep 2004 08:30:48 +0000 (08:30 +0000)
committercorinna <corinna>
Fri, 10 Sep 2004 08:30:48 +0000 (08:30 +0000)
* 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.

winsup/cygwin/ChangeLog
winsup/cygwin/Makefile.in
winsup/cygwin/exec.cc
winsup/cygwin/libc/bsdlib.cc
winsup/cygwin/syscalls.cc
winsup/cygwin/times.cc
winsup/cygwin/winsup.h

index 8ac7476..5e98a2e 100644 (file)
@@ -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>
 
        * fhandler_tape.cc (fhandler_dev_tape::open): Fix typo.
index bf531e8..efdd31f 100644 (file)
@@ -213,7 +213,7 @@ API_VER:=$(srcdir)/include/cygwin/version.h
 PWD:=${shell pwd}
 LIB_NAME:=$(PWD)/libcygwin.a
 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
 INSTOBJS:=automode.o binmode.o textmode.o textreadmode.o
 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
        /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)
        /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, $^}
 
 lib%.a: %.o
index d7c2ee1..ffc13ab 100644 (file)
@@ -35,8 +35,7 @@ execve (const char *path, char *const argv[], char *const envp[])
   return spawnve (_P_OVERLAY, path, argv, envp);
 }
 
-extern "C" int _execve (const char *, char *const [], char *const [])
-  __attribute__ ((alias ("execve")));
+EXPORT_ALIAS (execve, _execve)
 
 extern "C" int
 execl (const char *path, const char *arg0, ...)
index 71393fb..c25163e 100644 (file)
@@ -260,3 +260,52 @@ setprogname (const 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;
+}
index b98db3a..04291d2 100644 (file)
@@ -370,8 +370,7 @@ read (int fd, void *ptr, size_t len)
   return readv (fd, &iov, 1);
 }
 
-extern "C" ssize_t _read (int, void *, size_t)
-  __attribute__ ((alias ("read")));
+EXPORT_ALIAS (read, _read)
 
 extern "C" ssize_t
 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);
 }
 
-extern "C" ssize_t _write (int fd, const void *ptr, size_t len)
-  __attribute__ ((alias ("write")));
+EXPORT_ALIAS (write, _write)
 
 extern "C" ssize_t
 readv (int fd, const struct iovec *const iov, const int iovcnt)
@@ -572,11 +570,8 @@ open (const char *unix_path, int flags, ...)
   return res;
 }
 
-extern "C" int _open (const char *, int flags, ...)
-  __attribute__ ((alias ("open")));
-
-extern "C" int _open64 (const char *, int flags, ...)
-  __attribute__ ((alias ("open")));
+EXPORT_ALIAS (open, _open )
+EXPORT_ALIAS (open, _open64 )
 
 extern "C" _off64_t
 lseek64 (int fd, _off64_t pos, int dir)
@@ -601,8 +596,7 @@ lseek64 (int fd, _off64_t pos, int dir)
   return res;
 }
 
-extern "C" int _lseek64 (int fd, _off64_t pos, int dir)
-  __attribute__ ((alias ("lseek64")));
+EXPORT_ALIAS (lseek64, _lseek64)
 
 extern "C" _off_t
 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);
 }
 
-extern "C" _off_t _lseek (int, _off_t, int)
-  __attribute__ ((alias ("lseek")));
+EXPORT_ALIAS (lseek, _lseek)
 
 extern "C" int
 close (int fd)
@@ -635,7 +628,7 @@ close (int fd)
   return res;
 }
 
-extern "C" int _close (int) __attribute__ ((alias ("close")));
+EXPORT_ALIAS (close, _close)
 
 extern "C" int
 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 bool utmp_readonly = false;
 static char *utmp_file = (char *) _PATH_UTMP;
index 9dd579a..12eb821 100644 (file)
@@ -90,7 +90,7 @@ times (struct tms *buf)
    return tc;
 }
 
-extern "C" clock_t _times (struct tms *) __attribute__((alias ("times")));
+EXPORT_ALIAS (times, _times)
 
 /* settimeofday: BSD */
 extern "C" int
@@ -172,8 +172,7 @@ gettimeofday (struct timeval *tv, struct timezone *tz)
   return 0;
 }
 
-extern "C" int _gettimeofday (struct timeval *, struct timezone *)
-  __attribute__((alias ("gettimeofday")));
+EXPORT_ALIAS (gettimeofday, _gettimeofday)
 
 /* Cygwin internal */
 void
index 2c89ef4..bee5fa2 100644 (file)
@@ -32,6 +32,8 @@ details. */
 #define NO_COPY __attribute__((nocommon)) __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
 #define NEW_MACRO_VARARGS
 #endif