Page MenuHomeFreeBSD

Add futimens and utimensat system calls.
ClosedPublic

Authored by jilles on Jan 3 2015, 4:01 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
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

jilles retitled this revision from to Add futimens and utimensat system calls..Jan 3 2015, 4:01 PM
jilles updated this object.
jilles edited the test plan for this revision. (Show Details)
jilles updated this revision to Diff 2978.
pluknet added a subscriber: pluknet.Jan 3 2015, 6:06 PM

minor mdoc

bin/ln/symlink.7
150–151

missing comma

rwatson added a subscriber: rwatson.Jan 3 2015, 8:49 PM

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

pluknet added inline comments.Jan 4 2015, 7:06 PM
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).

emaste added a subscriber: emaste.Jan 5 2015, 7:41 PM
delphij added a subscriber: delphij.Jan 9 2015, 7:45 PM
dchagin added a subscriber: dchagin.Jan 9 2015, 9:49 PM
jilles updated this revision to Diff 3239.Jan 18 2015, 10:18 PM

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 accepted this revision.

Looks good to go.

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

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.

delphij added inline comments.Jan 21 2015, 8:21 PM
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 accepted this revision.

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.

jilles closed this revision.Jan 24 2015, 10:33 PM

Committed as r277610.