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)
Sat, Mar 16, 9:13 PM
Unknown Object (File)
Feb 23 2024, 12:41 PM
Unknown Object (File)
Feb 22 2024, 4:30 AM
Unknown Object (File)
Feb 21 2024, 11:51 AM
Unknown Object (File)
Feb 21 2024, 11:51 AM
Unknown Object (File)
Feb 14 2024, 6:16 PM
Unknown Object (File)
Dec 19 2023, 11:51 PM
Unknown Object (File)
Dec 19 2023, 10:06 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

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
258

wrong indentation

lib/libc/sys/futimens.c
49

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
258

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

lib/libc/sys/futimens.c
49

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.