Page MenuHomeFreeBSD

Add futimens and utimensat system calls.
ClosedPublic

Authored by jilles on Jan 3 2015, 4:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 2:08 AM
Unknown Object (File)
Fri, Oct 25, 12:06 AM
Unknown Object (File)
Fri, Oct 25, 12:06 AM
Unknown Object (File)
Thu, Oct 24, 11:44 PM
Unknown Object (File)
Fri, Oct 18, 7:34 PM
Unknown Object (File)
Wed, Oct 16, 3:25 PM
Unknown Object (File)
Wed, Oct 16, 3:15 PM
Unknown Object (File)
Wed, Oct 16, 3:15 PM

Details

Summary

The core kernel part is patch file utimes.2008.4.diff from
pluknet@FreeBSD.org. I updated the code for API changes, added the manual
page and added compatibility code for old kernels.

This diff does not contain man page .Dd updates, exact __FreeBSD_version
values and make sysent.

Test Plan

installworld and installkernel on VM.
Not in this diff: Fixed and ran NetBSD utimensat tests. Patched touch, cp and
mv.
All these using old kernel+new world and new kernel+new world.
The former gives expected failures only.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

jilles retitled this revision from to Add futimens and utimensat system calls..
jilles updated this object.
jilles edited the test plan for this revision. (Show Details)

minor mdoc

bin/ln/symlink.7
150–151

missing comma

Seems reasonable to me; thanks for taking care of both audit and Capsicum aspects!

sys/sys/stat.h
314

In 2012, you suggested to use the same values for the new constants as Linux (and now NetBSD) to ease the compatibility layer. OpenBSD uses different values though (orthogonal to the proposed in the patch).

Rebase to recent head, fix symlink.7 per pluknet@.

I can't build head on stable/9 anymore, so testing took more time.

Further notes:

  • The UTIME_* constant values in the current patch may be folded by a compiler into a (tv_nsec >= 0 && tv_nsec < 1000000000) test (OpenBSD's reason to use these). On the other hand, Linux/NetBSD's values may allow better error detection if someone erroneously decrements a 0 nanosecond value.
  • A new UTIME_* constant might allow setting birthtimes in future. An alternative would be adding a flags word to the syscall underlying futimens().
delphij added a reviewer: delphij.

Looks good to go.

This revision is now accepted and ready to land.Jan 20 2015, 10:11 PM
pluknet added a reviewer: pluknet.

I see no objection to commit the change in its current form.
See minor notes.

lib/libc/include/libc_private.h
363

wrong indentation

lib/libc/sys/futimens.c
48

I do not remember such precedents that we support older kernel (also utimensat).
As I understand this is done for portmgr purposes? So, just a remark.

lib/libc/include/libc_private.h
363

Good catch -- there should be two tabs after 'int' to match surrounding code.

lib/libc/sys/futimens.c
48

I think this is good: especially if we modify existing base system applications to use futimens(2) -- some users would do 'make installkernel installworld' instead of rebooting and installing world, while they should. I have been doing it for ZFS ioctl's for some while by the way.

The compatibility code is to stop breaking things too badly for people running an old kernel and a new world. It is not useful for running tests since it naturally pretends to support more than the kernel can deliver. It is probably best to remove it in 12-current or so.

Thanks for the review.

wollman added a reviewer: wollman.

Linux emulator support? I'm assuming it's already stubbed out (haven't looked) and just needs to be switched to the new internal interface.