Bug 144989

Summary: [SOUP] Use st_birthtime on FreeBSD and NetBSD instead of setting xattr
Product: WebKit Reporter: Ting-Wei Lan <lantw44>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ajacoutot, benjamin, cgarcia, cmarcelo, commit-queue, darin, koivisto
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Ting-Wei Lan 2015-05-13 23:15:53 PDT
FreeBSD and NetBSD have st_birthtime in struct stat, so we can easily get creation time of files without manually setting xattr. There is existing code for PLATFORM(COCOA), and we can just reuse it.

FreeBSD xattr API is incompatible with Linux xattr API, so GLib doesn't support it. st_birthtime works on both UFS2 and tmpfs.
NetBSD xattr has a compatible interface with Linux xattr, but it is only supported on old filesystem such as UFS1. st_birthtime works on both UFS2 and tmpfs.
Comment 1 Ting-Wei Lan 2015-05-13 23:19:46 PDT
Created attachment 253099 [details]
Patch
Comment 2 Carlos Garcia Campos 2015-05-14 00:35:49 PDT
Comment on attachment 253099 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253099&action=review

> Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystemPosix.h:80
> -#if PLATFORM(COCOA)
> +#if PLATFORM(COCOA) || (USE(SOUP) && (OS(DARWIN) || OS(FREEBSD) || OS(NETBSD)))

Maybe we could simplify this by defining a macro for this in WTF/wtf/Platform.h, something like HAVE_STAT_BIRTHTIME or something similar.
Comment 3 Ting-Wei Lan 2015-05-16 11:48:11 PDT
Created attachment 253272 [details]
Patch
Comment 4 Carlos Garcia Campos 2015-05-17 23:24:02 PDT
Comment on attachment 253272 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253272&action=review

> Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystemPosix.h:80
> -#if PLATFORM(COCOA)
> +#if PLATFORM(COCOA) || (USE(SOUP) && HAVE(STAT_BIRTHTIME))

I think we could use just #if HAVE(STAT_BIRTHTIME)
Comment 5 Darin Adler 2015-05-18 08:39:27 PDT
Comment on attachment 253272 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253272&action=review

>> Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystemPosix.h:80
>> +#if PLATFORM(COCOA) || (USE(SOUP) && HAVE(STAT_BIRTHTIME))
> 
> I think we could use just #if HAVE(STAT_BIRTHTIME)

Yes, that’s right.
Comment 6 Ting-Wei Lan 2015-05-19 07:03:41 PDT
Created attachment 253384 [details]
Patch
Comment 7 Carlos Garcia Campos 2015-05-19 08:12:21 PDT
Comment on attachment 253384 [details]
Patch

Thanks!
Comment 8 WebKit Commit Bot 2015-05-19 09:37:19 PDT
Comment on attachment 253384 [details]
Patch

Clearing flags on attachment: 253384

Committed r184567: <http://trac.webkit.org/changeset/184567>
Comment 9 WebKit Commit Bot 2015-05-19 09:37:26 PDT
All reviewed patches have been landed.  Closing bug.