]>
git.saurik.com Git - apple/xnu.git/blob - bsd/sys/pgo.h
2 * Copyright (c) 2014 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 #include <sys/_types.h>
33 #include <sys/_types/_ssize_t.h>
35 #include <uuid/uuid.h>
38 #define PGO_WAIT_FOR_UNLOAD (2)
39 #define PGO_METADATA (4)
41 #define PGO_ALL_FLAGS (PGO_HIB | PGO_WAIT_FOR_UNLOAD | PGO_METADATA)
45 * This is a serialization format for metadata related to a profile data buffer.
47 * If metadata is present, this footer will appear at the end of the file, so
48 * the last four bytes of the file will be the ASCII string "meta".
50 * The metadata is stored in a environment-string style buffer. The buffer
51 * consists of key-value pairs, which are delimited by null bytes. Each
52 * key-value pair is a string of the form "FOO=bar". Everything before the
53 * first equal sign is the key, everything after is the value.
55 * All members are in network byte order.
57 struct pgo_metadata_footer
{
61 * This should be htonl(n), where n is the number of key-value pairs in the
64 uint32_t number_of_pairs
;
67 * pointer to the metadata buffer
69 * This should be htonl(offset), where offset is the backwards offset from
70 * the end of the file to the metadata buffer.
72 uint32_t offset_to_pairs
;
77 * This should be htonl(0x6d657461);
84 ssize_t
grab_pgo_data(
87 unsigned char *buffer
,