LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 03-01-2008, 12:36 AM   #1
avanigadhai
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Rep: Reputation: 0
unable to modify created and modification time of symbolic links


Hi,

I am trying to duplicate a symbolic link, the new link should be the exact replica of the original one, with same file attributes, permissions, owner, group and even the time.

i m successful in changing the owner and group, but when i try to change the time using utime, the time of the file which is pointed to by this link get updated.

for example, there is file1 and file1_link is a symbolic link to file1. something like this:

lrwxrwxrwx 1 avni avni 5 Feb 27 11:44 file1_link -> file1
-rw-rw-rw- 1 avni avni 2061 Feb 26 18:47 file1


now i have to duplicate file1_link so that i have

lrwxrwxrwx 1 avni avni 5 Feb 27 11:44 file1_link_dup -> file1

but instead i get
lrwxrwxrwx 1 avni avni 5 Feb 28 11:30 file1_link_dup -> file1

when is do utime for file1_link_dup the result is something like this:
lrwxrwxrwx 1 avni avni 5 Feb 27 11:44 file1_link -> file1
-rw-rw-rw- 1 avni avni 2061 Feb 27 11:44 file1
lrwxrwxrwx 1 avni avni 5 Feb 28 11:30 file1_link_dup -> file1


can any body tell how this can be achieved.
I read about lutimes, but its not on my system.

i am writing code in C. I don't want to use perl.

The kernel is 2.4.7.

I am new to UNIX and hence have little knowledge of the various distributions and commands available.

Can any one guide me where should I start the search for the solution!!!

If you think this is the wrong forum, then Please guide me to the correct forum.

Thanks in advance.
 
Old 03-01-2008, 09:29 AM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
How do you know lutimes isn't on your system? It doesn't have a manpage on my system, but info libc lists it. Have you tried using it?
ta0kira
 
Old 03-01-2008, 11:45 AM   #3
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 69
Quote:
Originally Posted by ta0kira View Post
How do you know lutimes isn't on your system?
Because lutimes() on linux uses the utimensat() system call with the AT_SYMLINK_NOFOLLOW flag. This system call was introduced in linux-2.6.22, so is unavailable for 2.4.7.
 
Old 03-02-2008, 11:13 PM   #4
avanigadhai
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ta0kira View Post
How do you know lutimes isn't on your system? It doesn't have a manpage on my system, but info libc lists it. Have you tried using it?
ta0kira
thanks ta0kira for your reply.

I know lutimes is not in my system because when i used it, the compiler flashed an error "function not implemented". I read info lutimes, this is the reason that i tried using it in my code.
 
Old 03-02-2008, 11:19 PM   #5
avanigadhai
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by osor View Post
Because lutimes() on linux uses the utimensat() system call with the AT_SYMLINK_NOFOLLOW flag. This system call was introduced in linux-2.6.22, so is unavailable for 2.4.7.
thanks osor,
Is it possible to implement utimes like function?
I strongly believe that there should be some way to modify the time of links. The main reason being, there would be some inode that maintains the record for the link, and if there is some inode there should be some sub-routine to access/modify it.
 
  


Reply

Tags
links, modify, symbolic, time


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
symbolic links durden2.0 Linux - Newbie 6 11-12-2008 03:06 AM
symbolic links neocontrol Linux - Software 3 05-15-2006 12:08 AM
Symbolic Links suavecu Linux - Software 1 01-11-2006 10:04 PM
cp and symbolic links? sausagejohnson Linux - General 3 07-19-2005 01:25 AM
help with symbolic links sopiaz57 Linux - General 2 06-11-2004 06:17 PM


All times are GMT -5. The time now is 08:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration