This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FreeBSD port (28): futimes, lutimes


Hi,

FreeBSD has two system calls futimes() and lutimes(), which are to utimes()
what fstat() and lstat() are to stat(). It seems they can be useful to user
programs (for example, tar and the fileutils could use lutimes()).
The right place to declare them in the headers in <sys/time.h>. So here is
a patch to declare them there.


2002-07-06  Bruno Haible  <bruno@clisp.org>

	* time/sys/time.h (futimes, lutimes): New declarations.
	* sysdeps/generic/futimes.c: New file.
	* sysdeps/generic/lutimes.c: New file.
	* misc/Makefile (routines): Add futimes, lutimes.

diff -r -c3 glibc-20020627.bak/time/sys/time.h glibc-20020627/time/sys/time.h
--- glibc-20020627.bak/time/sys/time.h	Tue Jul 10 23:02:12 2001
+++ glibc-20020627/time/sys/time.h	Fri Jul  5 01:18:02 2002
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1994,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1994,1996-1999,2000-2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -137,6 +137,20 @@
 extern int utimes (__const char *__file, __const struct timeval __tvp[2])
      __THROW;
 
+#ifdef __USE_BSD
+
+/* Change the access time and the modification time of the file that FD is
+   open on, to TVP[0] and TVP[1], respectively.  */
+extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW;
+
+/* Change the access time and the modification time of FILE to TVP[0] and
+   TVP[1], respectively.  If FILE is a symbolic link, the times of the
+   symbolic link are changed.  */
+extern int lutimes (__const char *__file, __const struct timeval __tvp[2])
+     __THROW;
+
+#endif /* Use BSD */
+
 
 #ifdef __USE_BSD
 /* Convenience macros for operations on timevals.
--- /dev/null	Sat Jul  6 20:56:49 2002
+++ glibc-20020627/sysdeps/generic/futimes.c	Mon Jun 24 17:59:26 2002
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995-1997, 2000, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/time.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Change the access time and the modification time of the file that FD is
+   open on, to TVP[0] and TVP[1], respectively.  */
+int
+__futimes (int fd, const struct timeval tvp[2])
+{
+  if (tvp == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+weak_alias (__futimes, futimes)
+
+stub_warning (futimes)
+#include <stub-tag.h>
--- /dev/null	Sat Jul  6 20:56:49 2002
+++ glibc-20020627/sysdeps/generic/lutimes.c	Mon Jun 24 17:57:52 2002
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1995-1997, 2000, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/time.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Change the access time and the modification time of FILE to TVP[0] and
+   TVP[1], respectively.  If FILE is a symbolic link, the times of the
+   symbolic link are changed.  */
+int
+__lutimes (const char *file, const struct timeval tvp[2])
+{
+  if (file == NULL || tvp == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+weak_alias (__lutimes, lutimes)
+
+stub_warning (lutimes)
+#include <stub-tag.h>
diff -r -c3 glibc-20020627.bak/misc/Makefile glibc-20020627/misc/Makefile
--- glibc-20020627.bak/misc/Makefile	Mon Feb  4 12:42:40 2002
+++ glibc-20020627/misc/Makefile	Fri Jul  5 01:17:06 2002
@@ -47,7 +47,7 @@
 	    gtty stty \
 	    ptrace \
 	    fstab mntent mntent_r \
-	    utimes \
+	    utimes futimes lutimes \
 	    truncate ftruncate truncate64 ftruncate64 \
 	    chflags fchflags \
 	    insremque getttyent getusershell getpass ttyslot \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]