linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use utime rather than utimes
@ 2010-03-10  4:36 Jon Ringle
  2010-03-10  8:34 ` Kay Sievers
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jon Ringle @ 2010-03-10  4:36 UTC (permalink / raw)
  To: linux-hotplug

uclibc does not have lutimes and legacy function utimes should be replaced
with utime

Signed-off-by: Jon Ringle <jon@ringle.org>
---
 udev/udev-node.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/udev/udev-node.c b/udev/udev-node.c
index a70c147..f90567d 100644
--- a/udev/udev-node.c
+++ b/udev/udev-node.c
@@ -57,7 +57,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod
 			preserve = 1;
 			udev_selinux_lsetfilecon(udev, file, mode);
 			/* update time stamp when we re-use the node, like on media change events */
-			utimes(file, NULL);
+			utime(file, NULL);
 		} else {
 			char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
 
@@ -178,7 +178,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink)
 					info(udev, "preserve already existing symlink '%s' to '%s'\n",
 					     slink, target);
 					udev_selinux_lsetfilecon(udev, slink, S_IFLNK);
-					lutimes(slink, NULL);
+					utime(target, NULL);
 					goto exit;
 				}
 			}
-- 
1.7.0.rc2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use utime rather than utimes
  2010-03-10  4:36 [PATCH] Use utime rather than utimes Jon Ringle
@ 2010-03-10  8:34 ` Kay Sievers
  2010-03-10  9:22 ` Martin Pitt
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kay Sievers @ 2010-03-10  8:34 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Mar 10, 2010 at 05:36, Jon Ringle <jon@ringle.org> wrote:
> uclibc does not have lutimes and legacy function utimes should be replaced
> with utime

utime(): POSIX.1-2008 marks utime() as obsolete. I guess uclibc needs
to be fixed if it is supposed to compile udev.

> -                                       lutimes(slink, NULL);
> +                                       utime(target, NULL);

We do not care about the target, also utime() follows links which is
why we can't use it.

Kay

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use utime rather than utimes
  2010-03-10  4:36 [PATCH] Use utime rather than utimes Jon Ringle
  2010-03-10  8:34 ` Kay Sievers
@ 2010-03-10  9:22 ` Martin Pitt
  2010-03-10 11:35 ` Kay Sievers
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Martin Pitt @ 2010-03-10  9:22 UTC (permalink / raw)
  To: linux-hotplug

Kay Sievers [2010-03-10  9:34 +0100]:
> utime(): POSIX.1-2008 marks utime() as obsolete. 

That's actually what the manpage says, indeed. However, it contradicts
what's written in the standard:

  http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html#tag_13_64

says utimes() is obsolete and

  http://www.opengroup.org/onlinepubs/009695399/basedefs/utime.h.html#tag_13_81

says nothing about being obsolete. However, this might not be _the_
POSIX standard?

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use utime rather than utimes
  2010-03-10  4:36 [PATCH] Use utime rather than utimes Jon Ringle
  2010-03-10  8:34 ` Kay Sievers
  2010-03-10  9:22 ` Martin Pitt
@ 2010-03-10 11:35 ` Kay Sievers
  2010-03-10 11:47 ` Kay Sievers
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kay Sievers @ 2010-03-10 11:35 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Mar 10, 2010 at 10:22, Martin Pitt <martin.pitt@ubuntu.com> wrote:
> Kay Sievers [2010-03-10  9:34 +0100]:
>> utime(): POSIX.1-2008 marks utime() as obsolete.
>
> That's actually what the manpage says, indeed. However, it contradicts
> what's written in the standard:
>
>  http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html#tag_13_64
>
> says utimes() is obsolete and
>
>  http://www.opengroup.org/onlinepubs/009695399/basedefs/utime.h.html#tag_13_81
>
> says nothing about being obsolete. However, this might not be _the_
> POSIX standard?

Sounds all pretty weird. Maybe we just go for utimensat(AT_FDCWD,
..., if that is in uclibc. Jon, care to check?

Thanks,
Kay

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use utime rather than utimes
  2010-03-10  4:36 [PATCH] Use utime rather than utimes Jon Ringle
                   ` (2 preceding siblings ...)
  2010-03-10 11:35 ` Kay Sievers
@ 2010-03-10 11:47 ` Kay Sievers
  2010-03-10 13:56 ` Scott James Remnant
  2010-03-10 15:32 ` Jon Ringle
  5 siblings, 0 replies; 7+ messages in thread
From: Kay Sievers @ 2010-03-10 11:47 UTC (permalink / raw)
  To: linux-hotplug

On Wed, 2010-03-10 at 12:35 +0100, Kay Sievers wrote:
> On Wed, Mar 10, 2010 at 10:22, Martin Pitt <martin.pitt@ubuntu.com> wrote:
> > Kay Sievers [2010-03-10  9:34 +0100]:
> >> utime(): POSIX.1-2008 marks utime() as obsolete.
> >
> > That's actually what the manpage says, indeed. However, it contradicts
> > what's written in the standard:
> >
> >  http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html#tag_13_64
> >
> > says utimes() is obsolete and
> >
> >  http://www.opengroup.org/onlinepubs/009695399/basedefs/utime.h.html#tag_13_81
> >
> > says nothing about being obsolete. However, this might not be _the_
> > POSIX standard?
> 
> Sounds all pretty weird. Maybe we just go for utimensat(AT_FDCWD,
> ..., if that is in uclibc. Jon, care to check?

Jon, care to try if this compiles?

Thanks,
Kay


diff --git a/udev/udev-node.c b/udev/udev-node.c
index a70c147..23bfade 100644
--- a/udev/udev-node.c
+++ b/udev/udev-node.c
@@ -57,7 +57,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod
 			preserve = 1;
 			udev_selinux_lsetfilecon(udev, file, mode);
 			/* update time stamp when we re-use the node, like on media change events */
-			utimes(file, NULL);
+			utimensat(AT_FDCWD, file, NULL, 0);
 		} else {
 			char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
 
@@ -178,7 +178,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink)
 					info(udev, "preserve already existing symlink '%s' to '%s'\n",
 					     slink, target);
 					udev_selinux_lsetfilecon(udev, slink, S_IFLNK);
-					lutimes(slink, NULL);
+					utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW);
 					goto exit;
 				}
 			}


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use utime rather than utimes
  2010-03-10  4:36 [PATCH] Use utime rather than utimes Jon Ringle
                   ` (3 preceding siblings ...)
  2010-03-10 11:47 ` Kay Sievers
@ 2010-03-10 13:56 ` Scott James Remnant
  2010-03-10 15:32 ` Jon Ringle
  5 siblings, 0 replies; 7+ messages in thread
From: Scott James Remnant @ 2010-03-10 13:56 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 980 bytes --]

On Wed, 2010-03-10 at 10:22 +0100, Martin Pitt wrote:

> Kay Sievers [2010-03-10  9:34 +0100]:
> > utime(): POSIX.1-2008 marks utime() as obsolete. 
> 
> That's actually what the manpage says, indeed. However, it contradicts
> what's written in the standard:
> 
>   http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html#tag_13_64
> 
> says utimes() is obsolete and
> 
>   http://www.opengroup.org/onlinepubs/009695399/basedefs/utime.h.html#tag_13_81
> 
> says nothing about being obsolete. However, this might not be _the_
> POSIX standard?
> 
That's the 2004 version of the standard you're quoting.  2008 changed
its mind ;-)

http://www.opengroup.org/onlinepubs/9699919799/functions/utime.html

This notes:

    The utime() function is marked obsolescent.


http://www.opengroup.org/onlinepubs/9699919799/functions/utimes.html

This notes:

    The LEGACY marking is removed.

Scott
-- 
Scott James Remnant
scott@ubuntu.com

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use utime rather than utimes
  2010-03-10  4:36 [PATCH] Use utime rather than utimes Jon Ringle
                   ` (4 preceding siblings ...)
  2010-03-10 13:56 ` Scott James Remnant
@ 2010-03-10 15:32 ` Jon Ringle
  5 siblings, 0 replies; 7+ messages in thread
From: Jon Ringle @ 2010-03-10 15:32 UTC (permalink / raw)
  To: linux-hotplug

I'm not subscribed to the list, but saw the discussion in the archive.
I tested your patch here: http://www.spinics.net/lists/hotplug/msg03470.html
And it builds successfully with uclibc

Jon

On Wed, Mar 10, 2010 at 3:34 AM, Kay Sievers <kay.sievers@vrfy.org> wrote:
> On Wed, Mar 10, 2010 at 05:36, Jon Ringle <jon@ringle.org> wrote:
>> uclibc does not have lutimes and legacy function utimes should be replaced
>> with utime
>
> utime(): POSIX.1-2008 marks utime() as obsolete. I guess uclibc needs
> to be fixed if it is supposed to compile udev.
>
>> -                                       lutimes(slink, NULL);
>> +                                       utime(target, NULL);
>
> We do not care about the target, also utime() follows links which is
> why we can't use it.
>
> Kay
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-03-10 15:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-10  4:36 [PATCH] Use utime rather than utimes Jon Ringle
2010-03-10  8:34 ` Kay Sievers
2010-03-10  9:22 ` Martin Pitt
2010-03-10 11:35 ` Kay Sievers
2010-03-10 11:47 ` Kay Sievers
2010-03-10 13:56 ` Scott James Remnant
2010-03-10 15:32 ` Jon Ringle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).