--- /dev/null
+APPLE PUBLIC SOURCE LICENSE
+Version 2.0 - August 6, 2003
+
+Please read this License carefully before downloading this software.
+By downloading or using this software, you are agreeing to be bound by
+the terms of this License. If you do not or cannot agree to the terms
+of this License, please do not download or use the software.
+
+1. General; Definitions. This License applies to any program or other
+work which Apple Computer, Inc. ("Apple") makes publicly available and
+which contains a notice placed by Apple identifying such program or
+work as "Original Code" and stating that it is subject to the terms of
+this Apple Public Source License version 2.0 ("License"). As used in
+this License:
+
+1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is
+the grantor of rights, (i) claims of patents that are now or hereafter
+acquired, owned by or assigned to Apple and (ii) that cover subject
+matter contained in the Original Code, but only to the extent
+necessary to use, reproduce and/or distribute the Original Code
+without infringement; and (b) in the case where You are the grantor of
+rights, (i) claims of patents that are now or hereafter acquired,
+owned by or assigned to You and (ii) that cover subject matter in Your
+Modifications, taken alone or in combination with Original Code.
+
+1.2 "Contributor" means any person or entity that creates or
+contributes to the creation of Modifications.
+
+1.3 "Covered Code" means the Original Code, Modifications, the
+combination of Original Code and any Modifications, and/or any
+respective portions thereof.
+
+1.4 "Externally Deploy" means: (a) to sublicense, distribute or
+otherwise make Covered Code available, directly or indirectly, to
+anyone other than You; and/or (b) to use Covered Code, alone or as
+part of a Larger Work, in any way to provide a service, including but
+not limited to delivery of content, through electronic communication
+with a client other than You.
+
+1.5 "Larger Work" means a work which combines Covered Code or portions
+thereof with code not governed by the terms of this License.
+
+1.6 "Modifications" mean any addition to, deletion from, and/or change
+to, the substance and/or structure of the Original Code, any previous
+Modifications, the combination of Original Code and any previous
+Modifications, and/or any respective portions thereof. When code is
+released as a series of files, a Modification is: (a) any addition to
+or deletion from the contents of a file containing Covered Code;
+and/or (b) any new file or other representation of computer program
+statements that contains any part of Covered Code.
+
+1.7 "Original Code" means (a) the Source Code of a program or other
+work as originally made available by Apple under this License,
+including the Source Code of any updates or upgrades to such programs
+or works made available by Apple under this License, and that has been
+expressly identified by Apple as such in the header file(s) of such
+work; and (b) the object code compiled from such Source Code and
+originally made available by Apple under this License.
+
+1.8 "Source Code" means the human readable form of a program or other
+work that is suitable for making modifications to it, including all
+modules it contains, plus any associated interface definition files,
+scripts used to control compilation and installation of an executable
+(object code).
+
+1.9 "You" or "Your" means an individual or a legal entity exercising
+rights under this License. For legal entities, "You" or "Your"
+includes any entity which controls, is controlled by, or is under
+common control with, You, where "control" means (a) the power, direct
+or indirect, to cause the direction or management of such entity,
+whether by contract or otherwise, or (b) ownership of fifty percent
+(50%) or more of the outstanding shares or beneficial ownership of
+such entity.
+
+2. Permitted Uses; Conditions & Restrictions. Subject to the terms
+and conditions of this License, Apple hereby grants You, effective on
+the date You accept this License and download the Original Code, a
+world-wide, royalty-free, non-exclusive license, to the extent of
+Apple's Applicable Patent Rights and copyrights covering the Original
+Code, to do the following:
+
+2.1 Unmodified Code. You may use, reproduce, display, perform,
+internally distribute within Your organization, and Externally Deploy
+verbatim, unmodified copies of the Original Code, for commercial or
+non-commercial purposes, provided that in each instance:
+
+(a) You must retain and reproduce in all copies of Original Code the
+copyright and other proprietary notices and disclaimers of Apple as
+they appear in the Original Code, and keep intact all notices in the
+Original Code that refer to this License; and
+
+(b) You must include a copy of this License with every copy of Source
+Code of Covered Code and documentation You distribute or Externally
+Deploy, and You may not offer or impose any terms on such Source Code
+that alter or restrict this License or the recipients' rights
+hereunder, except as permitted under Section 6.
+
+2.2 Modified Code. You may modify Covered Code and use, reproduce,
+display, perform, internally distribute within Your organization, and
+Externally Deploy Your Modifications and Covered Code, for commercial
+or non-commercial purposes, provided that in each instance You also
+meet all of these conditions:
+
+(a) You must satisfy all the conditions of Section 2.1 with respect to
+the Source Code of the Covered Code;
+
+(b) You must duplicate, to the extent it does not already exist, the
+notice in Exhibit A in each file of the Source Code of all Your
+Modifications, and cause the modified files to carry prominent notices
+stating that You changed the files and the date of any change; and
+
+(c) If You Externally Deploy Your Modifications, You must make
+Source Code of all Your Externally Deployed Modifications either
+available to those to whom You have Externally Deployed Your
+Modifications, or publicly available. Source Code of Your Externally
+Deployed Modifications must be released under the terms set forth in
+this License, including the license grants set forth in Section 3
+below, for as long as you Externally Deploy the Covered Code or twelve
+(12) months from the date of initial External Deployment, whichever is
+longer. You should preferably distribute the Source Code of Your
+Externally Deployed Modifications electronically (e.g. download from a
+web site).
+
+2.3 Distribution of Executable Versions. In addition, if You
+Externally Deploy Covered Code (Original Code and/or Modifications) in
+object code, executable form only, You must include a prominent
+notice, in the code itself as well as in related documentation,
+stating that Source Code of the Covered Code is available under the
+terms of this License with information on how and where to obtain such
+Source Code.
+
+2.4 Third Party Rights. You expressly acknowledge and agree that
+although Apple and each Contributor grants the licenses to their
+respective portions of the Covered Code set forth herein, no
+assurances are provided by Apple or any Contributor that the Covered
+Code does not infringe the patent or other intellectual property
+rights of any other entity. Apple and each Contributor disclaim any
+liability to You for claims brought by any other entity based on
+infringement of intellectual property rights or otherwise. As a
+condition to exercising the rights and licenses granted hereunder, You
+hereby assume sole responsibility to secure any other intellectual
+property rights needed, if any. For example, if a third party patent
+license is required to allow You to distribute the Covered Code, it is
+Your responsibility to acquire that license before distributing the
+Covered Code.
+
+3. Your Grants. In consideration of, and as a condition to, the
+licenses granted to You under this License, You hereby grant to any
+person or entity receiving or distributing Covered Code under this
+License a non-exclusive, royalty-free, perpetual, irrevocable license,
+under Your Applicable Patent Rights and other intellectual property
+rights (other than patent) owned or controlled by You, to use,
+reproduce, display, perform, modify, sublicense, distribute and
+Externally Deploy Your Modifications of the same scope and extent as
+Apple's licenses under Sections 2.1 and 2.2 above.
+
+4. Larger Works. You may create a Larger Work by combining Covered
+Code with other code not governed by the terms of this License and
+distribute the Larger Work as a single product. In each such instance,
+You must make sure the requirements of this License are fulfilled for
+the Covered Code or any portion thereof.
+
+5. Limitations on Patent License. Except as expressly stated in
+Section 2, no other patent rights, express or implied, are granted by
+Apple herein. Modifications and/or Larger Works may require additional
+patent licenses from Apple which Apple may grant in its sole
+discretion.
+
+6. Additional Terms. You may choose to offer, and to charge a fee for,
+warranty, support, indemnity or liability obligations and/or other
+rights consistent with the scope of the license granted herein
+("Additional Terms") to one or more recipients of Covered Code.
+However, You may do so only on Your own behalf and as Your sole
+responsibility, and not on behalf of Apple or any Contributor. You
+must obtain the recipient's agreement that any such Additional Terms
+are offered by You alone, and You hereby agree to indemnify, defend
+and hold Apple and every Contributor harmless for any liability
+incurred by or claims asserted against Apple or such Contributor by
+reason of any such Additional Terms.
+
+7. Versions of the License. Apple may publish revised and/or new
+versions of this License from time to time. Each version will be given
+a distinguishing version number. Once Original Code has been published
+under a particular version of this License, You may continue to use it
+under the terms of that version. You may also choose to use such
+Original Code under the terms of any subsequent version of this
+License published by Apple. No one other than Apple has the right to
+modify the terms applicable to Covered Code created under this
+License.
+
+8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in
+part pre-release, untested, or not fully tested works. The Covered
+Code may contain errors that could cause failures or loss of data, and
+may be incomplete or contain inaccuracies. You expressly acknowledge
+and agree that use of the Covered Code, or any portion thereof, is at
+Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND
+WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND APPLE AND
+APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE" FOR THE
+PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM
+ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT
+NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF
+MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR
+PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST
+INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE
+FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS,
+THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR
+ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO
+ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE
+AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY.
+You acknowledge that the Covered Code is not intended for use in the
+operation of nuclear facilities, aircraft navigation, communication
+systems, or air traffic control machines in which case the failure of
+the Covered Code could lead to death, personal injury, or severe
+physical or environmental damage.
+
+9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO
+EVENT SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL,
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING
+TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED CODE, OR
+ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY,
+TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF
+APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY
+REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF
+INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY
+TO YOU. In no event shall Apple's total liability to You for all
+damages (other than as may be required by applicable law) under this
+License exceed the amount of fifty dollars ($50.00).
+
+10. Trademarks. This License does not grant any rights to use the
+trademarks or trade names "Apple", "Apple Computer", "Mac", "Mac OS",
+"QuickTime", "QuickTime Streaming Server" or any other trademarks,
+service marks, logos or trade names belonging to Apple (collectively
+"Apple Marks") or to any trademark, service mark, logo or trade name
+belonging to any Contributor. You agree not to use any Apple Marks in
+or as part of the name of products derived from the Original Code or
+to endorse or promote products derived from the Original Code other
+than as expressly permitted by and in strict compliance at all times
+with Apple's third party trademark usage guidelines which are posted
+at http://www.apple.com/legal/guidelinesfor3rdparties.html.
+
+11. Ownership. Subject to the licenses granted under this License,
+each Contributor retains all rights, title and interest in and to any
+Modifications made by such Contributor. Apple retains all rights,
+title and interest in and to the Original Code and any Modifications
+made by or on behalf of Apple ("Apple Modifications"), and such Apple
+Modifications will not be automatically subject to this License. Apple
+may, at its sole discretion, choose to license such Apple
+Modifications under this License, or on different terms from those
+contained in this License or may choose not to license them at all.
+
+12. Termination.
+
+12.1 Termination. This License and the rights granted hereunder will
+terminate:
+
+(a) automatically without notice from Apple if You fail to comply with
+any term(s) of this License and fail to cure such breach within 30
+days of becoming aware of such breach;
+
+(b) immediately in the event of the circumstances described in Section
+13.5(b); or
+
+(c) automatically without notice from Apple if You, at any time during
+the term of this License, commence an action for patent infringement
+against Apple; provided that Apple did not first commence
+an action for patent infringement against You in that instance.
+
+12.2 Effect of Termination. Upon termination, You agree to immediately
+stop any further use, reproduction, modification, sublicensing and
+distribution of the Covered Code. All sublicenses to the Covered Code
+which have been properly granted prior to termination shall survive
+any termination of this License. Provisions which, by their nature,
+should remain in effect beyond the termination of this License shall
+survive, including but not limited to Sections 3, 5, 8, 9, 10, 11,
+12.2 and 13. No party will be liable to any other for compensation,
+indemnity or damages of any sort solely as a result of terminating
+this License in accordance with its terms, and termination of this
+License will be without prejudice to any other right or remedy of
+any party.
+
+13. Miscellaneous.
+
+13.1 Government End Users. The Covered Code is a "commercial item" as
+defined in FAR 2.101. Government software and technical data rights in
+the Covered Code include only those rights customarily provided to the
+public as defined in this License. This customary commercial license
+in technical data and software is provided in accordance with FAR
+12.211 (Technical Data) and 12.212 (Computer Software) and, for
+Department of Defense purchases, DFAR 252.227-7015 (Technical Data --
+Commercial Items) and 227.7202-3 (Rights in Commercial Computer
+Software or Computer Software Documentation). Accordingly, all U.S.
+Government End Users acquire Covered Code with only those rights set
+forth herein.
+
+13.2 Relationship of Parties. This License will not be construed as
+creating an agency, partnership, joint venture or any other form of
+legal association between or among You, Apple or any Contributor, and
+You will not represent to the contrary, whether expressly, by
+implication, appearance or otherwise.
+
+13.3 Independent Development. Nothing in this License will impair
+Apple's right to acquire, license, develop, have others develop for
+it, market and/or distribute technology or products that perform the
+same or similar functions as, or otherwise compete with,
+Modifications, Larger Works, technology or products that You may
+develop, produce, market or distribute.
+
+13.4 Waiver; Construction. Failure by Apple or any Contributor to
+enforce any provision of this License will not be deemed a waiver of
+future enforcement of that or any other provision. Any law or
+regulation which provides that the language of a contract shall be
+construed against the drafter will not apply to this License.
+
+13.5 Severability. (a) If for any reason a court of competent
+jurisdiction finds any provision of this License, or portion thereof,
+to be unenforceable, that provision of the License will be enforced to
+the maximum extent permissible so as to effect the economic benefits
+and intent of the parties, and the remainder of this License will
+continue in full force and effect. (b) Notwithstanding the foregoing,
+if applicable law prohibits or restricts You from fully and/or
+specifically complying with Sections 2 and/or 3 or prevents the
+enforceability of either of those Sections, this License will
+immediately terminate and You must immediately discontinue any use of
+the Covered Code and destroy all copies of it that are in your
+possession or control.
+
+13.6 Dispute Resolution. Any litigation or other dispute resolution
+between You and Apple relating to this License shall take place in the
+Northern District of California, and You and Apple hereby consent to
+the personal jurisdiction of, and venue in, the state and federal
+courts within that District with respect to this License. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded.
+
+13.7 Entire Agreement; Governing Law. This License constitutes the
+entire agreement between the parties with respect to the subject
+matter hereof. This License shall be governed by the laws of the
+United States and the State of California, except that body of
+California law concerning conflicts of law.
+
+Where You are located in the province of Quebec, Canada, the following
+clause applies: The parties hereby confirm that they have requested
+that this License and all related documents be drafted in English. Les
+parties ont exige que le present contrat et tous les documents
+connexes soient rediges en anglais.
+
+EXHIBIT A.
+
+"Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
+Reserved.
+
+This file contains Original Code and/or Modifications of Original Code
+as defined in and that are subject to the Apple Public Source License
+Version 2.0 (the 'License'). You may not use this file except in
+compliance with the License. Please obtain a copy of the License at
+http://www.opensource.apple.com/apsl/ and read it before using this
+file.
+
+The Original Code and all software distributed under the License are
+distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+Please see the License for the specific language governing rights and
+limitations under the License."
#define PATH_LIBRARY_LOGS "/Library/Logs/"
#define PATH_LIBRARY_LOGS_LEN 14
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
#define _PATH_ASL_CONF_LOCAL_DIR "/usr/local/etc/asl"
#endif
status = mkdir(tmp, mode);
umask(mask);
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
uid_t u = 0;
gid_t g = 80;
free(dst->ext);
free(dst->rotate_dir);
free(dst->fmt);
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
free(dst->uid);
free(dst->gid);
#endif
int
asl_out_dst_set_access(int fd, asl_out_dst_data_t *dst)
{
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
uid_t fuid = 0;
gid_t fgid = 80;
#if !TARGET_OS_EMBEDDED
if (dst == NULL) return -1;
if (fd < 0) return -1;
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
return fd;
#else
acl_free(acl);
return fd;
#endif /* !TARGET_OS_EMBEDDED */
-#endif /* !TARGET_IPHONE_SIMULATOR */
+#endif /* !TARGET_OS_SIMULATOR */
}
/* create a file with acls */
return out;
}
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
static void
_dst_add_uid(asl_out_dst_data_t *dst, char *s)
{
dst->gid[dst->ngid++] = gid;
}
-#endif /* !TARGET_IPHONE_SIMULATOR */
+#endif /* !TARGET_OS_SIMULATOR */
static char *
_dst_format_string(char *s)
char *t = path;
const char *log_root = "/var/log";
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
log_root = getenv("SIMULATOR_LOG_ROOT");
if (log_root == NULL) log_root = "/tmp/log";
#endif
while (NULL != (p = next_word_from_string(&opts)))
{
if (KEYMATCH(p, "mode=")) dst->mode = strtol(p+5, NULL, 0);
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
else if (KEYMATCH(p, "uid=")) _dst_add_uid(dst, p+4);
else if (KEYMATCH(p, "gid=")) _dst_add_gid(dst, p+4);
#endif
else if (KEYMATCH(p+9, "false")) dst->flags &= ~MODULE_FLAG_COALESCE;
}
else if (KEYMATCH(p, "compress")) dst->flags |= MODULE_FLAG_COMPRESS;
- else if (KEYMATCH(p, "activity")) dst->flags |= MODULE_FLAG_ACTIVITY;
else if (KEYMATCH(p, "extern")) dst->flags |= MODULE_FLAG_EXTERNAL;
else if (KEYMATCH(p, "truncate")) dst->flags |= MODULE_FLAG_TRUNCATE;
else if (KEYMATCH(p, "dir")) dst->flags |= MODULE_FLAG_TYPE_ASL_DIR;
dst->ttl[x] = asl_core_str_to_time(p+5, SECONDS_PER_DAY);
}
}
+ else if (KEYMATCH(p, "size_only"))
+ {
+ dst->flags |= MODULE_FLAG_SIZE_ONLY;
+ }
free(p);
p = NULL;
/* set file_max to all_max if it is zero */
if (dst->file_max == 0) dst->file_max = dst->all_max;
+ /* size_only option requires non-zero file_max and all_max settings */
+ if ((dst->flags & MODULE_FLAG_SIZE_ONLY) && (dst->file_max == 0 || dst->all_max == 0))
+ {
+ dst->flags &= ~MODULE_FLAG_SIZE_ONLY;
+ }
+
+ /* size_only option cannot be used with crashlog option */
+ if ((dst->flags & MODULE_FLAG_SIZE_ONLY) && (dst->flags & MODULE_FLAG_CRASHLOG))
+ {
+ dst->flags &= ~MODULE_FLAG_SIZE_ONLY;
+ }
+
out->action = ACTION_OUT_DEST;
out->dst = dst;
out->dst->flags &= ~MODULE_FLAG_ROTATE;
}
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
if (out->dst->nuid == 0) _dst_add_uid(out->dst, "0");
if (out->dst->ngid == 0) _dst_add_gid(out->dst, "80");
#endif
{
asl_out_module_t *out = NULL;
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
char *sim_root_path, *sim_resources_path;
char *asl_conf, *asl_conf_dir, *asl_conf_local_dir;
if (_asl_out_module_find(out, ASL_MODULE_NAME) == NULL)
{
/* system just has old-style /etc/asl.conf */
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
FILE *f = fopen(asl_conf, "r");
free(asl_conf);
#else
fprintf(f, "%cexternal", c);
c = ' ';
}
- if (o->flags & MODULE_FLAG_ACTIVITY)
- {
- fprintf(f, "%cactivity", c);
- c = ' ';
- }
if (o->flags & MODULE_FLAG_CRASHLOG)
{
fprintf(f, "%ccrashlog", c);
fprintf(f, "%casl_directory", c);
c = ' ';
}
+ if (o->flags & MODULE_FLAG_SIZE_ONLY)
+ {
+ fprintf(f, "%csize_only", c);
+ c = ' ';
+ }
fprintf(f, ")");
}
fprintf(f, "\n");
fprintf(f, " mode: 0%o\n", o->mode);
fprintf(f, " file_max: %lu\n", o->file_max);
fprintf(f, " all_max: %lu\n", o->all_max);
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
fprintf(f, " uid:");
for (i = 0; i < o->nuid; i++) fprintf(f, " %d", o->uid[i]);
fprintf(f, "\n");
#define MODULE_FLAG_TYPE_ASL 0x00001000 /* asl format file */
#define MODULE_FLAG_TYPE_ASL_DIR 0x00002000 /* asl format directory */
#define MODULE_FLAG_STD_BSD_MSG 0x00004000 /* print format is std, bsd, or msg */
-#define MODULE_FLAG_ACTIVITY 0x00008000
+#define MODULE_FLAG_SIZE_ONLY 0x00008000 /* checkpoint on file size only */
#define MODULE_NAME_STYLE_FORMAT_MASK 0xf0000000
#define MODULE_NAME_STYLE_FORMAT_BS 0x10000000 /* base.stamp */
#define CHECKPOINT_TEST 0x00000000
#define CHECKPOINT_FORCE 0x00000001
-#define CHECKPOINT_CRASH 0x00000002
#define LEVEL_ALL 8
uint32_t fails;
uint32_t ttl[9];
mode_t mode;
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
uid_t *uid;
uint32_t nuid;
gid_t *gid;
type ooline_data = ^ array [] of MACH_MSG_TYPE_BYTE
ctype : caddr_t;
-routine _asl_server_query
-(
- server : mach_port_t;
- request : ooline_data, dealloc;
- startid : uint64_t;
- count : int;
- flags : int;
- out reply : ooline_data, dealloc;
- out lastid : uint64_t;
- out status : int;
- SecToken token : security_token_t
-);
+skip; /* removed: _asl_server_query */
-routine _asl_server_query_timeout
-(
- server : mach_port_t;
- request : ooline_data, dealloc;
- startid : uint64_t;
- count : int;
- WaitTime timeout: natural_t;
- flags : int;
- out reply : ooline_data, dealloc;
- out lastid : uint64_t;
- out status : int;
- ServerAuditToken token : audit_token_t
-);
+skip; /* removed: _asl_server_query_timeout */
-routine _asl_server_prune
-(
- server : mach_port_t;
- request : ooline_data, dealloc;
- out status : int;
- SecToken token : security_token_t
-);
+skip; /* removed: _asl_server_prune */
routine _asl_server_create_aux_link
(
#include <asl_store.h>
#include <errno.h>
#include <vproc_priv.h>
+#include <os/transaction_private.h>
#include "asl_common.h"
#include "daemon.h"
-#include "cache_delete.h"
/* global */
bool dryrun;
asl_out_dst_data_t store, opts, *asl_store_dst = NULL;
const char *mname = NULL;
bool quiet = false;
- bool cache_delete = false;
- bool cache_delete_query = false;
#if !TARGET_OS_SIMULATOR
if (geteuid() != 0)
{
work |= DO_CHECKPT;
}
- else if (!strcmp(argv[i], "-cache_delete"))
- {
- cache_delete = true;
- if (((i + 1) < argc) && (argv[i + 1][0] == 'q')) cache_delete_query = true;
- }
else if (!strcmp(argv[i], "-module"))
{
work &= ~DO_ASLDB;
debug_log(ASL_LEVEL_ERR, "aslmanager starting%s\n", dryrun ? " dryrun" : "");
- if (cache_delete)
- {
- size_t curr_size = 0;
-
- if (cache_delete_task(true, &curr_size) != 0)
- {
- debug_log(ASL_LEVEL_NOTICE, "cache_delete_process failed - can't determine current size\n");
- }
- else
- {
- debug_log(ASL_LEVEL_NOTICE, "cache delete current size = %lu\n", curr_size);
-
- if (!cache_delete_query)
- {
- size_t new_size = curr_size - opts.all_max;
-
- if (cache_delete_task(false, &new_size) != 0)
- {
- debug_log(ASL_LEVEL_NOTICE, "cache_delete_process failed - delete failed\n");
- }
- else
- {
- debug_log(ASL_LEVEL_NOTICE, "cache delete new size = %lu\n", new_size);
- }
- }
- }
-
- asl_out_module_free(mod);
-
- debug_log(ASL_LEVEL_NOTICE, "----------------------------------------\n");
- debug_log(ASL_LEVEL_ERR, "aslmanager finished%s\n", dryrun ? " dryrun" : "");
- debug_close();
-
- return 0;
- }
-
if (work & DO_ASLDB) process_asl_data_store(asl_store_dst, &opts);
if (work & DO_MODULE)
if (main_task_enqueued) return;
main_task_enqueued = true;
- xpc_transaction_begin();
+
+ os_transaction_t transaction = os_transaction_create("com.apple.aslmanager");
if (initial_main_task)
{
dispatch_after(delay, work_queue, ^{
cli_main(0, NULL);
main_task_enqueued = false;
- xpc_transaction_end();
+ os_release(transaction);
});
}
else
dispatch_async(work_queue, ^{
cli_main(0, NULL);
main_task_enqueued = false;
- xpc_transaction_end();
+ os_release(transaction);
});
}
}
/* send a reply immediately */
xpc_object_t reply = xpc_dictionary_create_reply(request);
- xpc_connection_send_message(peer, reply);
- xpc_release(reply);
+ if (reply != NULL)
+ {
+ xpc_connection_send_message(peer, reply);
+ xpc_release(reply);
+ }
/*
* Some day, we may use the dictionary to pass parameters
});
xpc_connection_resume(listener);
- cache_delete_register();
-
dispatch_main();
}
+++ /dev/null
-/*
- * Copyright (c) 2015 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#include <CacheDelete/CacheDelete.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include <asl.h>
-#include "daemon.h"
-
-/* CacheDelete ID (stored in cache delete plist). Must match suggested CacheDelete id naming conventions. */
-#define CACHE_DELETE_ID "com.apple.activity_tracing.cache-delete"
-
-#define CFSTR_FROM_DICT(dict, key) ({ \
- void *strRef = NULL; \
- if (dict != NULL) { \
- strRef = (void *)CFDictionaryGetValue(dict, key); \
- if ((strRef == NULL) || (CFStringGetTypeID() != CFGetTypeID(strRef))) strRef = NULL; \
- } \
- (CFStringRef)strRef; \
-})
-
-#define INT64_FROM_DICT(dict, key) ({ \
- int64_t value = 0; \
- if (dict != NULL) { \
- void *numRef = (void *)CFDictionaryGetValue(dict, key); \
- if (numRef && (CFNumberGetTypeID() == CFGetTypeID(numRef))) {\
- if (!CFNumberGetValue(numRef, kCFNumberSInt64Type, &value)) value = 0; \
- } \
- } \
- value; \
-})
-
-static int64_t
-_purgeable(void)
-{
- size_t psize = 0;
- int status = cache_delete_task(true, &psize);
- if (status == 0) return (uint64_t)psize;
- return 0;
-}
-
-static int64_t
-_purge(int64_t purge_amount_bytes, CacheDeleteUrgency urgency)
-{
- size_t curr_size, new_size;
- curr_size = 0;
-
- int status = cache_delete_task(true, &curr_size);
- if (status != 0) return 0;
-
- new_size = curr_size - purge_amount_bytes;
-
- status = cache_delete_task(false, &new_size);
- if (status == 0) return new_size;
-
- return 0;
-}
-
-static bool
-_volume_contains_cached_data(CFStringRef volume)
-{
- return true;
-}
-
-
-static CFDictionaryRef
-_handle_cache_delete_with_urgency(CFDictionaryRef info, CacheDeleteUrgency urgency, bool purge)
-{
- xpc_transaction_begin();
-
- uint64_t amount_requested = INT64_FROM_DICT(info, CFSTR(CACHE_DELETE_AMOUNT_KEY));
- CFStringRef volume_requested = CFSTR_FROM_DICT(info, CFSTR(CACHE_DELETE_VOLUME_KEY));
-
- CFMutableDictionaryRef result = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- if (result == NULL)
- {
- goto bail;
- }
- else if (volume_requested == NULL)
- {
- goto bail;
- }
-
- /* TODO: CFStringGetCStringPtr can return NULL */
-// debug_log(ASL_LEVEL_DEBUG, "CacheDelete request (purge=%d, urgency=%d, volume=%s, amount=%llu).", (int)urgency, CFStringGetCStringPtr(volume_requested, kCFStringEncodingUTF8), amount_requested);
-
- int64_t amount_purged = 0;
-
- if (_volume_contains_cached_data(volume_requested))
- {
- if (purge)
- {
- amount_purged = _purge(amount_requested, urgency);
-// debug_log(ASL_LEVEL_WARNING, "Purged %lld bytes.", amount_purged);
- }
- else
- {
- amount_purged = _purgeable();
-// debug_log(ASL_LEVEL_WARNING, "%lld bytes of purgeable space.", amount_purged);
- }
- }
-
- CFNumberRef amount_purged_obj = CFNumberCreate(NULL, kCFNumberSInt64Type, &amount_purged);
- if (amount_purged_obj != NULL)
- {
- CFDictionaryAddValue(result, CFSTR(CACHE_DELETE_AMOUNT_KEY), amount_purged_obj);
- CFRelease(amount_purged_obj);
- }
-
-bail:
-
- xpc_transaction_end();
- return result;
-}
-
-bool
-cache_delete_register(void)
-{
- return CacheDeleteRegisterInfoCallbacks(CFSTR(CACHE_DELETE_ID), ^CFDictionaryRef(CacheDeleteUrgency urgency, CFDictionaryRef info) {
- /* Purgeable Space Request */
- return _handle_cache_delete_with_urgency(info, urgency, false);
- }, ^CFDictionaryRef(CacheDeleteUrgency urgency, CFDictionaryRef info) {
- /* Purge Request */
- return _handle_cache_delete_with_urgency(info, urgency, true);
- }, NULL, NULL) == 0;
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-
-bool cache_delete_register(void);
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CACHE_DELETE_ID</key>
- <string>com.apple.activity_tracing.cache-delete</string>
- <key>CACHE_DELETE_SERVICES</key>
- <array>
- <string>PURGE</string>
- </array>
-</dict>
-</plist>
<dict>
<key>com.apple.aslmanager</key>
<true/>
- <key>com.apple.activity_tracing.cache-delete</key>
- <true/>
</dict>
<key>EnableTransactions</key>
<true/>
#include <vproc_priv.h>
#include <libkern/OSAtomic.h>
#include "daemon.h"
+#include "asl_ipc.h"
/* global */
extern bool dryrun;
static aslclient aslc;
static int asl_aux_fd = -1;
-extern kern_return_t _asl_server_query
-(
- mach_port_t server,
- caddr_t request,
- mach_msg_type_number_t requestCnt,
- uint64_t startid,
- int count,
- int flags,
- caddr_t *reply,
- mach_msg_type_number_t *replyCnt,
- uint64_t *lastid,
- int *status,
- security_token_t *token
- );
-
const char *
keep_str(uint8_t mask)
{
return 0;
}
-static asl_out_file_list_t *
-_remove_youngest_activity_tracing_file(asl_out_file_list_t *l)
-{
- asl_out_file_list_t *f;
-
- /* ignore youngest activity tracing file - it is the active file */
- if (l->next == NULL)
- {
- debug_log(ASL_LEVEL_INFO, " ignore youngest (only) activity tracing file %s\n", l->name);
- asl_out_file_list_free(l);
- return NULL;
- }
-
- for (f = l; f->next->next != NULL; f = f->next);
- debug_log(ASL_LEVEL_INFO, " ignore youngest activity tracing file %s\n", f->next->name);
- asl_out_file_list_free(f->next);
- f->next = NULL;
- return l;
-}
-
/* move sequenced source files to dst dir, renaming as we go */
int
module_copy_rename(asl_out_dst_data_t *dst)
dst_list = asl_list_dst_files(dst);
- if ((dst_list != NULL) && (dst->flags & MODULE_FLAG_ACTIVITY))
- {
- dst_list = _remove_youngest_activity_tracing_file(dst_list);
- }
-
dst_dir = dst->rotate_dir;
if (dst_dir == NULL) dst_dir = dst->dir;
dst_list = asl_list_dst_files(dst);
- if ((dst_list != NULL) && (dst->flags & MODULE_FLAG_ACTIVITY))
- {
- dst_list = _remove_youngest_activity_tracing_file(dst_list);
- }
-
*base = '\0';
dst_dir = dst->rotate_dir;
if (all_max == 0) return 0;
dst_list = asl_list_dst_files(dst);
-
- if ((dst_list != NULL) && (dst->flags & MODULE_FLAG_ACTIVITY))
- {
- dst_list = _remove_youngest_activity_tracing_file(dst_list);
- }
-
if (dst_list == NULL)
{
debug_log(ASL_LEVEL_INFO, " no dst files\n");
module_copy_rename(dst);
- if (ttl > 0)
+ if ((ttl > 0) && !(dst->flags & MODULE_FLAG_SIZE_ONLY))
{
char tstr[150];
return 0;
}
-int
-cache_delete_task(bool query, size_t *size)
-{
- dispatch_sync(work_queue, ^{
- asl_out_module_t *mod, *m;
- asl_out_dst_data_t opts;
- size_t total_size = 0;
-
- memset(&opts, 0, sizeof(opts));
- if ((!query) && (size != NULL)) opts.all_max = *size;
-
- debug_log(ASL_LEVEL_NOTICE, "cache_delete_process%s size %lu\n", query ? " query" : "", opts.all_max);
-
- mod = asl_out_module_init();
-
- for (m = mod; m != NULL; m = m->next)
- {
- bool logged = false;
- asl_out_rule_t *r;
-
- for (r = m->ruleset; r != NULL; r = r->next)
- {
- if (r->action == ACTION_OUT_DEST)
- {
- if (r->dst->flags & MODULE_FLAG_ACTIVITY)
- {
- if (!logged)
- {
- debug_log(ASL_LEVEL_NOTICE, "----------------------------------------\n");
- debug_log(ASL_LEVEL_NOTICE, "Processing activity module %s\n", (m->name == NULL) ? "asl.conf" : m->name);
- logged = true;
- }
-
- size_t dsize = 0;
- module_check_size(r->dst, &opts, false, &dsize);
- total_size += dsize;
- }
- }
- }
-
- if (logged) debug_log(ASL_LEVEL_NOTICE, "Finished processing activity module %s\n", (m->name == NULL) ? "asl.conf" : m->name);
- }
-
- asl_out_module_free(mod);
-
- if (size != NULL) *size = total_size;
- });
-
- return 0;
-}
-
asl_msg_list_t *
control_query(asl_msg_t *a)
{
uint64_t cmax, qmin;
kern_return_t kstatus;
caddr_t vmstr;
- security_token_t sec;
if (asl_server_port == MACH_PORT_NULL)
{
out = NULL;
qmin = 0;
cmax = 0;
- sec.val[0] = -1;
- sec.val[1] = -1;
res = NULL;
reslen = 0;
free(str);
status = 0;
- kstatus = _asl_server_query(asl_server_port, vmstr, len, qmin, 1, 0, (caddr_t *)&res, &reslen, &cmax, (int *)&status, &sec);
+ kstatus = _asl_server_query_2(asl_server_port, vmstr, len, qmin, 1, 0, (caddr_t *)&res, &reslen, &cmax, (int *)&status);
if (kstatus != KERN_SUCCESS) return NULL;
if (res == NULL) return NULL;
asl_msg_list_t * control_query(asl_msg_t *a);
int checkpoint(const char *name);
-int cache_delete_task(bool query, size_t *size);
void main_task(void);
#define EVAL_ASL_FILE 0x00100000
#define EVAL_TUNNEL 0x00200000
#define EVAL_QUOTA 0x00400000
+#define EVAL_MT_SHIM 0x00800000
/*
* Private types
.Os "Mac OS X"
.Sh NAME
.Nm asl_add_log_file ,
-.Nm asl_add_outout_file ,
+.Nm asl_add_output_file ,
.Nm asl_append ,
.Nm asl_close ,
.Nm asl_close_auxiliary_file ,
and it may supply additional key/value pairs.
The
.Fa format
-string and it's associated arguments are used to construct a string value for the
+string and its associated arguments are used to construct a string value for the
ASL_KEY_MSG key in the final log message dictionary.
.Pp
If the
/* fork handling in asl_fd.c */
extern void _asl_redirect_fork_child(void);
+#if TARGET_OS_OSX
+extern void _asl_mt_shim_fork_child(void);
+extern void _asl_mt_shim_send_message(asl_msg_t *msg);
+#endif
+
typedef struct
{
int fd;
pthread_mutex_init(&(_asl_global.lock), NULL);
_asl_redirect_fork_child();
+#if TARGET_OS_OSX
+ _asl_mt_shim_fork_child();
+#endif
}
/*
/* don't send MessageTracer messages to Activity Tracing */
val = NULL;
- if ((asl_msg_lookup(msg, ASL_KEY_MESSAGETRACER, &val, NULL) == 0) && (val != NULL)) eval &= ~EVAL_SEND_TRACE;
+ if ((asl_msg_lookup(msg, ASL_KEY_MESSAGETRACER, &val, NULL) == 0) && (val != NULL))
+ {
+ eval &= ~EVAL_SEND_TRACE;
+ eval |= EVAL_MT_SHIM;
+ }
/* don't send PowerManagement messages to Activity Tracing */
val = NULL;
}
}
+#if TARGET_OS_OSX
+ if (eval & EVAL_MT_SHIM)
+ {
+ _asl_mt_shim_send_message(sendmsg);
+ }
+#endif
+
if ((_asl_global.server_port != MACH_PORT_NULL) && (eval & EVAL_SEND_ASL))
{
asl_string_t *send_str;
count64 = count;
kstatus = _asl_server_match(asl_server_port, vmstr, len, start64, count64, duration, dir, (caddr_t *)&res, &reslen, &last64, (int *)&status);
- *last = last64;
+ if (kstatus != KERN_SUCCESS) return NULL;
+ *last = last64;
out = asl_msg_list_from_string(res);
vm_deallocate(mach_task_self(), (vm_address_t)res, reslen);
--- /dev/null
+/*
+ * Copyright (c) 2019 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <asl_msg.h>
+#include <os/lock_private.h>
+#include <xpc/private.h>
+
+#if TARGET_OS_OSX
+
+#define MT_SHIM_SERVICE_NAME "com.apple.analyticsd.messagetracer"
+
+static os_unfair_lock _mt_shim_lock = OS_UNFAIR_LOCK_INIT;
+static xpc_pipe_t _mt_shim_pipe;
+
+void
+_asl_mt_shim_fork_child(void)
+{
+ if (_mt_shim_pipe) {
+ xpc_pipe_invalidate(_mt_shim_pipe);
+ xpc_release(_mt_shim_pipe);
+ _mt_shim_pipe = NULL;
+ }
+ _mt_shim_lock = OS_UNFAIR_LOCK_INIT;
+}
+
+static xpc_pipe_t
+_asl_mt_shim_pipe_copy(OS_OBJECT_CONSUMED xpc_pipe_t prev)
+{
+ xpc_pipe_t pipe;
+
+ os_unfair_lock_lock_with_options(&_mt_shim_lock,
+ OS_UNFAIR_LOCK_DATA_SYNCHRONIZATION);
+ pipe = _mt_shim_pipe;
+ if (prev) {
+ if (pipe == prev) {
+ xpc_release(pipe);
+ pipe = NULL;
+ }
+ xpc_release(prev);
+ }
+ if (!pipe) {
+ uint64_t flags = XPC_PIPE_PRIVILEGED | XPC_PIPE_USE_SYNC_IPC_OVERRIDE;
+ _mt_shim_pipe = pipe = xpc_pipe_create(MT_SHIM_SERVICE_NAME, flags);
+ }
+ if (pipe) xpc_retain(pipe);
+ os_unfair_lock_unlock(&_mt_shim_lock);
+ return pipe;
+}
+
+static xpc_object_t
+_asl_mt_shim_send_with_reply(xpc_object_t msg)
+{
+ xpc_object_t reply = NULL;
+ xpc_pipe_t pipe = _asl_mt_shim_pipe_copy(NULL);
+
+ if (pipe && xpc_pipe_routine(pipe, msg, &reply) == EPIPE) {
+ pipe = _asl_mt_shim_pipe_copy(pipe);
+ if (pipe) (void)xpc_pipe_routine(pipe, msg, &reply);
+ }
+ if (pipe) xpc_release(pipe);
+ return reply;
+}
+
+void
+_asl_mt_shim_send_message(asl_msg_t *msg)
+{
+ /* don't send messages that were already shimmed by the caller */
+ const char *val = NULL;
+ if ((asl_msg_lookup(msg, "com.apple.message.__source__", &val, NULL) == 0) && (val != NULL)) {
+ if (!strcmp(val, "SPI")) return;
+ }
+
+ xpc_object_t xmsg = xpc_dictionary_create(NULL, NULL, 0);
+ _asl_log_args_to_xpc(NULL, (asl_object_t)msg, xmsg);
+ xpc_object_t reply = _asl_mt_shim_send_with_reply(xmsg);
+ if (reply) xpc_release(reply);
+ xpc_release(xmsg);
+}
+
+#endif /* TARGET_OS_OSX */
2D31F3D017E77F8800F2A60C /* asl_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D31F3CC17E77F8800F2A60C /* asl_string.c */; };
2D60F61115657D0F00F2E3F9 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D60F61015657D0F00F2E3F9 /* libz.dylib */; };
2D9DEB64150E6FE80059BA61 /* asl_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D30656D150E6EFF00F31A54 /* asl_common.h */; };
- 2DAF75551AE8613000054190 /* com.apple.activity_tracing.CacheDelete.plist in Copy CacheDelete plist */ = {isa = PBXBuildFile; fileRef = 2DAF75541AE8610200054190 /* com.apple.activity_tracing.CacheDelete.plist */; };
2DCF701A150E97C0002D5E8F /* libaslcommon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 505ACB9D108FD16400197086 /* libaslcommon.a */; };
- 2DEE8C411AE575A2007B5CBE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DEE8C401AE575A2007B5CBE /* CoreFoundation.framework */; };
- 2DEE8C431AE575AB007B5CBE /* CacheDelete.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DEE8C421AE575AB007B5CBE /* CacheDelete.framework */; };
- 2DEE8C461AE5798B007B5CBE /* cache_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DEE8C441AE5798B007B5CBE /* cache_delete.c */; };
3F6F43F21613A8E300CA9ADB /* asl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F6F43CF1613A8E300CA9ADB /* asl.h */; settings = {ATTRIBUTES = (Public, ); }; };
3F6F43F31613A8E300CA9ADB /* asl_core.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F6F43D01613A8E300CA9ADB /* asl_core.h */; settings = {ATTRIBUTES = (Private, ); }; };
3F6F43F41613A8E300CA9ADB /* asl_file.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F6F43D11613A8E300CA9ADB /* asl_file.h */; settings = {ATTRIBUTES = (Private, ); }; };
505ACBA8108FD18400197086 /* asl_ipc.defs in Headers */ = {isa = PBXBuildFile; fileRef = 505ACBA2108FD18400197086 /* asl_ipc.defs */; };
505ACBA9108FD18400197086 /* asl_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 505ACBA3108FD18400197086 /* asl_memory.c */; };
505ACBAA108FD18400197086 /* asl_memory.h in Headers */ = {isa = PBXBuildFile; fileRef = 505ACBA4108FD18400197086 /* asl_memory.h */; };
+ 8FBD22362241ED0000CEBA6A /* asl_mt_shim.c in Sources */ = {isa = PBXBuildFile; fileRef = 8F77AF5A2241CD17004AF9B4 /* asl_mt_shim.c */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
- 2D30D27D1AE6BBA000673818 /* Copy CacheDelete plist */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 8;
- dstPath = /System/Library/CacheDelete;
- dstSubfolderSpec = 0;
- files = (
- 2DAF75551AE8613000054190 /* com.apple.activity_tracing.CacheDelete.plist in Copy CacheDelete plist */,
- );
- name = "Copy CacheDelete plist";
- runOnlyForDeploymentPostprocessing = 1;
- };
3F6F44131613AA9300CA9ADB /* Install man3 */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
2D31F3CC17E77F8800F2A60C /* asl_string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asl_string.c; sourceTree = "<group>"; };
2D60F61015657D0F00F2E3F9 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
2D9C4F131B3A29E700219FB3 /* com.apple.system.log */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.system.log; path = syslogd.tproj/com.apple.system.log; sourceTree = "<group>"; };
- 2DAF75541AE8610200054190 /* com.apple.activity_tracing.CacheDelete.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = com.apple.activity_tracing.CacheDelete.plist; path = aslmanager.tproj/com.apple.activity_tracing.CacheDelete.plist; sourceTree = "<group>"; };
2DB4DA0A125FC69A001CDC45 /* after_install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = after_install.sh; path = syslogd.tproj/after_install.sh; sourceTree = "<group>"; };
2DB8178915589D0C004D0BDE /* entitlements.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = entitlements.plist; path = util.tproj/entitlements.plist; sourceTree = "<group>"; };
- 2DEE8C401AE575A2007B5CBE /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = ../../../../../../../../System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<group>"; };
- 2DEE8C421AE575AB007B5CBE /* CacheDelete.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CacheDelete.framework; path = ../../../../../../../../System/Library/PrivateFrameworks/CacheDelete.framework; sourceTree = "<group>"; };
- 2DEE8C441AE5798B007B5CBE /* cache_delete.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cache_delete.c; path = aslmanager.tproj/cache_delete.c; sourceTree = "<group>"; };
- 2DEE8C451AE5798B007B5CBE /* cache_delete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cache_delete.h; path = aslmanager.tproj/cache_delete.h; sourceTree = "<group>"; };
3F6B6311185AF66C00F692C5 /* aslmanager.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = aslmanager.xcconfig; sourceTree = "<group>"; };
3F6B6312185AF66C00F692C5 /* base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = base.xcconfig; sourceTree = "<group>"; };
3F6B6313185AF66C00F692C5 /* syslogd.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = syslogd.xcconfig; sourceTree = "<group>"; };
505ACBA2108FD18400197086 /* asl_ipc.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; path = asl_ipc.defs; sourceTree = "<group>"; };
505ACBA3108FD18400197086 /* asl_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asl_memory.c; sourceTree = "<group>"; };
505ACBA4108FD18400197086 /* asl_memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asl_memory.h; sourceTree = "<group>"; };
+ 8F77AF5A2241CD17004AF9B4 /* asl_mt_shim.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_mt_shim.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 2DEE8C431AE575AB007B5CBE /* CacheDelete.framework in Frameworks */,
- 2DEE8C411AE575A2007B5CBE /* CoreFoundation.framework in Frameworks */,
2D60F61115657D0F00F2E3F9 /* libz.dylib in Frameworks */,
2DCF701A150E97C0002D5E8F /* libaslcommon.a in Frameworks */,
);
08FB7794FE84155DC02AAC07 /* syslog */ = {
isa = PBXGroup;
children = (
- 2DEE8C421AE575AB007B5CBE /* CacheDelete.framework */,
- 2DEE8C401AE575A2007B5CBE /* CoreFoundation.framework */,
505ACBA1108FD18400197086 /* aslcommon */,
503917691091404D0001165E /* aslmanager */,
503917C41091412B0001165E /* util */,
3F6F43E51613A8E300CA9ADB /* asl_file.c */,
3F6F43E61613A8E300CA9ADB /* asl_legacy1.c */,
3F6F43E71613A8E300CA9ADB /* asl_msg.c */,
+ 8F77AF5A2241CD17004AF9B4 /* asl_mt_shim.c */,
3F6F43E81613A8E300CA9ADB /* asl_store.c */,
3F6F43E91613A8E300CA9ADB /* asl_util.c */,
);
503917691091404D0001165E /* aslmanager */ = {
isa = PBXGroup;
children = (
- 2DAF75541AE8610200054190 /* com.apple.activity_tracing.CacheDelete.plist */,
- 2DEE8C441AE5798B007B5CBE /* cache_delete.c */,
- 2DEE8C451AE5798B007B5CBE /* cache_delete.h */,
5039176B1091408B0001165E /* aslmanager.8 */,
5039176C1091408B0001165E /* aslmanager.c */,
2D30D27F1AE6C84200673818 /* daemon.c */,
50391764109140450001165E /* Frameworks */,
503A82631099037D00B0D08A /* Copy Manpage.8 */,
FCAC6D7410AB34C9008DEAC9 /* ShellScript */,
- 2D30D27D1AE6BBA000673818 /* Copy CacheDelete plist */,
);
buildRules = (
);
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 8FBD22362241ED0000CEBA6A /* asl_mt_shim.c in Sources */,
2D31F3CD17E77F8800F2A60C /* asl_client.c in Sources */,
3F6F43FB1613A8E300CA9ADB /* asl.c in Sources */,
3F6F43FC1613A8E300CA9ADB /* asl_core.c in Sources */,
files = (
2D30D2811AE6C84200673818 /* daemon.c in Sources */,
5039176F1091408B0001165E /* aslmanager.c in Sources */,
- 2DEE8C461AE5798B007B5CBE /* cache_delete.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
return -1;
}
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
if (chown(dstpath, r->dst->uid[0], r->dst->gid[0]) != 0)
{
asldebug("_asl_dir_storedata_open: chown %d %d new %s: %s\n", dstpath, r->dst->uid[0], r->dst->gid[0], strerror(errno));
_act_checkpoint(asl_out_rule_t *r, uint32_t force)
{
char tmpcurrent_name[MAXPATHLEN], *fn;
+ bool size_only = false;
if (r == NULL) return 0;
if (r->dst == NULL) return 0;
fn = tmpcurrent_name;
}
- if ((force == CHECKPOINT_TEST) && (r->dst->file_max == 0)) return 0;
+ if ((force == CHECKPOINT_TEST) || (r->dst->flags & MODULE_FLAG_SIZE_ONLY))
+ {
+ size_only = true;
+ }
+
+ if (size_only && (r->dst->file_max == 0)) return 0;
if ((r->dst->size == 0) || (r->dst->timestamp == 0))
{
r->dst->size = sb.st_size;
}
- if ((force == CHECKPOINT_TEST) && (r->dst->size < r->dst->file_max)) return 0;
+ if (size_only && (r->dst->size < r->dst->file_max)) return 0;
if (r->dst->flags & MODULE_FLAG_BASESTAMP)
{
return -1;
}
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
uid_t uid = -1;
gid_t gid = -1;
#else
if (m == NULL) return 0;
-
for (r = m->ruleset; r != NULL; r = r->next)
{
if ((r->action == ACTION_FILE) || (r->action == ACTION_ASL_FILE))
{
if (_act_file_equal(r->dst->path, path))
{
- if (force & CHECKPOINT_CRASH)
+ if (_act_checkpoint(r, force) > 0)
{
- if (r->dst->flags & MODULE_FLAG_CRASHLOG)
- {
- if (_act_checkpoint(r, CHECKPOINT_FORCE) > 0)
- {
- did_checkpoint = 1;
- _act_dst_close(r, DST_CLOSE_CHECKPOINT);
- }
- }
- }
- else
- {
- if (_act_checkpoint(r, force) > 0)
- {
- did_checkpoint = 1;
- _act_dst_close(r, DST_CLOSE_CHECKPOINT);
- }
+ did_checkpoint = 1;
+ _act_dst_close(r, DST_CLOSE_CHECKPOINT);
}
}
}
if (p != NULL) asl_msg_set_key_val(msg, ASL_KEY_FREE_NOTE, p);
/* chain to the next output module (done this way to make queue size accounting easier */
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
if (global.bsd_out_enabled) bsd_out_message(msg, msize);
else OSAtomicAdd64(-1ll * msize, &global.memory_size);
#else
return 0;
}
-int
-asl_action_file_checkpoint(const char *module, const char *path)
-{
- /* Note this is synchronous on asl_action queue */
- dispatch_sync(asl_action_queue, ^{
- asl_out_module_t *m = _asl_action_module_with_name(module);
- _act_file_checkpoint(m, path, CHECKPOINT_FORCE);
- });
-
- return 0;
-}
-
void
asl_action_out_module_query(asl_msg_t *q, asl_msg_t *m, bool all)
{
launch_data_t sockets_dict, fd_array, fd_dict;
static dispatch_once_t once;
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
const char *_PATH_SYSLOG_IN = getenv("IOS_SIMULATOR_SYSLOG_SOCKET");
#endif
#include <TargetConditionals.h>
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
struct _not_empty;
#else
return 0;
}
-#endif /* !TARGET_IPHONE_SIMULATOR */
+#endif /* !TARGET_OS_SIMULATOR */
<dict>
<key>Label</key>
<string>com.apple.syslogd</string>
- <key>OnDemand</key>
- <false/>
- <key>JetsamProperties</key>
- <dict>
- <key>JetsamPriority</key>
- <integer>-49</integer>
- <key>JetsamMemoryLimit</key>
- <integer>300</integer>
- </dict>
- <key>HopefullyExitsLast</key>
+ <key>KeepAlive</key>
<true/>
<key>EnableTransactions</key>
<true/>
- <key>POSIXSpawnType</key>
- <string>Adaptive</string>
+ <key>EnablePressuredExit</key>
+ <false/>
+ <key>POSIXSpawnType</key>
+ <string>Adaptive</string>
<key>ProgramArguments</key>
<array>
<!--
<dict>
<key>Label</key>
<string>com.apple.syslogd</string>
- <key>OnDemand</key>
- <false/>
+ <key>KeepAlive</key>
+ <true/>
<key>EnableTransactions</key>
<true/>
- <key>POSIXSpawnType</key>
- <string>Interactive</string>
+ <key>EnablePressuredExit</key>
+ <false/>
+ <key>POSIXSpawnType</key>
+ <string>Interactive</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/syslogd</string>
#define SYSLOG_NAMES
#include <syslog.h>
#include <sys/fslog.h>
-#include <vproc.h>
#include <pthread.h>
-#include <vproc_priv.h>
#include <mach/mach.h>
#include <libkern/OSAtomic.h>
#include <libproc.h>
#include <uuid/uuid.h>
#include <asl_private.h>
+#include <os/transaction_private.h>
#include "daemon.h"
#define LIST_SIZE_DELTA 256
static OSSpinLock count_lock = 0;
#if !TARGET_OS_EMBEDDED
-static vproc_transaction_t vproc_trans = {0};
+static os_transaction_t main_transaction;
#endif
#define DEFAULT_MEMORY_MAX SYSLOGD_WORK_QUEUE_MEMORY
OSSpinLockLock(&count_lock);
#if !TARGET_OS_EMBEDDED
- if (global.client_count == 0) vproc_trans = vproc_transaction_begin(NULL);
+ if (global.client_count == 0) main_transaction = os_transaction_create("com.apple.syslogd");
#endif
global.client_count++;
if (global.client_count > 0) global.client_count--;
#if !TARGET_OS_EMBEDDED
- if (global.client_count == 0) vproc_transaction_end(NULL, vproc_trans);
+ if (global.client_count == 0) os_release(main_transaction);
#endif
OSSpinLockUnlock(&count_lock);
}
}
- __block vproc_transaction_t vt = vproc_transaction_begin(NULL);
+ os_transaction_t transaction = os_transaction_create("com.apple.syslogd.message");
for (x = msg; x != NULL; x = x->next) msize += x->mem_size;
asl_msg_release(msg);
OSAtomicDecrement32(&global.work_queue_count);
- vproc_transaction_end(NULL, vt);
+ os_release(transaction);
});
}
return msg;
}
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
void
launchd_callback(struct timeval *when, pid_t from_pid, pid_t about_pid, uid_t sender_uid, gid_t sender_gid, int priority, const char *from_name, const char *about_name, const char *session_name, const char *msg)
{
#define ASL_OPT_DB_FILE "asl_db_file"
#define ASL_OPT_DB_MEMORY "asl_db_memory"
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
/* These paths are appropriately prefixed in the simulator */
extern const char *_path_pidfile;
extern const char *_path_syslogd_log;
void send_to_direct_watchers(asl_msg_t *msg);
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
void launchd_callback();
#endif
return ASL_STATUS_OK;
}
-static kern_return_t
+static void
_server_message_processing(asl_request_msg *request)
{
const uint32_t sbits = MACH_SEND_MSG | MACH_SEND_TIMEOUT;;
continue;
}
- int64_t msize = 0;
if (request->head.msgh_id == asl_server_message_num)
{
_server_message_processing(request);
}
static void
-caller_get_read_entitlement(pid_t pid, uid_t *uid, gid_t *gid)
+caller_get_read_entitlement(audit_token_t *token, uid_t *uid, gid_t *gid)
{
#if TARGET_OS_EMBEDDED
- xpc_object_t edata, entitlements, val;
+ xpc_object_t entitlements, val;
bool bval = false;
int64_t ival = -2;
- size_t len;
- const void *ptr;
-
- edata = xpc_copy_entitlements_for_pid(pid);
- if (edata == NULL) return;
- ptr = xpc_data_get_bytes_ptr(edata);
- len = xpc_data_get_length(edata);
-
- entitlements = xpc_create_from_plist(ptr, len);
- xpc_release(edata);
+ entitlements = xpc_copy_entitlement_for_token(NULL, token);
if (entitlements == NULL) return;
- if (xpc_get_type(entitlements) != XPC_TYPE_DICTIONARY)
- {
- asldebug("xpc_copy_entitlements_for_pid has non-dictionary data for pid %d\n", pid);
- return;
- }
-
bval = xpc_dictionary_get_bool(entitlements, ASL_ENTITLEMENT_KEY);
if (bval && (uid != NULL))
{
mach_msg_type_number_t *replyCnt,
uint64_t *lastid,
int *status,
- uid_t uid,
- gid_t gid,
- pid_t pid
+ audit_token_t *token
)
{
asl_msg_list_t *query;
if (request != NULL) vm_deallocate(mach_task_self(), (vm_address_t)request, requestCnt);
res = NULL;
+ uid_t uid = (uid_t)-1;
+ gid_t gid = (gid_t)-1;
+ pid_t pid = (pid_t)-1;
+ audit_token_to_au32(*token, NULL, &uid, &gid, NULL, NULL, &pid, NULL, NULL);
+
/* A query list containing a single query, which itself contains
* [ASLOption control] is an internal state query */
if ((query != NULL) && (query->count == 1) && asl_check_option(query->msg[0], ASL_OPT_CONTROL))
if (pid > 0)
{
- caller_get_read_entitlement(pid, &uid, &gid);
+ caller_get_read_entitlement(token, &uid, &gid);
if (uid == 0) x = 0;
}
audit_token_t token
)
{
- uid_t uid = (uid_t)-1;
- gid_t gid = (gid_t)-1;
- pid_t pid = (pid_t)-1;
-
- int direction = SEARCH_FORWARD;
- if (flags & QUERY_FLAG_SEARCH_REVERSE) direction = SEARCH_BACKWARD;
-
- audit_token_to_au32(token, NULL, &uid, &gid, NULL, NULL, &pid, NULL, NULL);
-
- return __asl_server_query_internal(server, request, requestCnt, startid, count, QUERY_DURATION_UNLIMITED, direction, reply, replyCnt, lastid, status, uid, gid, pid);
-}
-
-kern_return_t
-__asl_server_query
-(
- mach_port_t server,
- caddr_t request,
- mach_msg_type_number_t requestCnt,
- uint64_t startid,
- int count,
- int flags,
- caddr_t *reply,
- mach_msg_type_number_t *replyCnt,
- uint64_t *lastid,
- int *status,
- security_token_t *token
-)
-{
- int direction = SEARCH_FORWARD;
- if (flags & QUERY_FLAG_SEARCH_REVERSE) direction = SEARCH_BACKWARD;
-
- return __asl_server_query_internal(server, request, requestCnt, startid, count, QUERY_DURATION_UNLIMITED, direction, reply, replyCnt, lastid, status, (uid_t)token->val[0], (gid_t)token->val[1], (pid_t)-1);
-}
-
-kern_return_t
-__asl_server_query_timeout
-(
- mach_port_t server,
- caddr_t request,
- mach_msg_type_number_t requestCnt,
- uint64_t startid,
- int count,
- int flags,
- caddr_t *reply,
- mach_msg_type_number_t *replyCnt,
- uint64_t *lastid,
- int *status,
- audit_token_t token
-)
-{
- uid_t uid = (uid_t)-1;
- gid_t gid = (gid_t)-1;
- pid_t pid = (pid_t)-1;
int direction = SEARCH_FORWARD;
if (flags & QUERY_FLAG_SEARCH_REVERSE) direction = SEARCH_BACKWARD;
- audit_token_to_au32(token, NULL, &uid, &gid, NULL, NULL, &pid, NULL, NULL);
-
- return __asl_server_query_internal(server, request, requestCnt, startid, count, QUERY_DURATION_UNLIMITED, direction, reply, replyCnt, lastid, status, uid, gid, pid);
+ return __asl_server_query_internal(server, request, requestCnt, startid, count, QUERY_DURATION_UNLIMITED, direction, reply, replyCnt, lastid, status, &token);
}
kern_return_t
audit_token_t token
)
{
- uid_t uid = (uid_t)-1;
- gid_t gid = (gid_t)-1;
- pid_t pid = (pid_t)-1;
-
- audit_token_to_au32(token, NULL, &uid, &gid, NULL, NULL, &pid, NULL, NULL);
-
- return __asl_server_query_internal(server, request, requestCnt, startid, count, duration, direction, reply, replyCnt, lastid, status, uid, gid, pid);
-}
-
-kern_return_t
-__asl_server_prune
-(
- mach_port_t server,
- caddr_t request,
- mach_msg_type_number_t requestCnt,
- int *status,
- security_token_t *token
-)
-{
- return KERN_FAILURE;
+ return __asl_server_query_internal(server, request, requestCnt, startid, count, duration, direction, reply, replyCnt, lastid, status, &token);
}
/*
#include <TargetConditionals.h>
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
struct _not_empty;
#else
return 0;
}
-#endif /* !TARGET_IPHONE_SIMULATOR */
+#endif /* !TARGET_OS_SIMULATOR */
#include <TargetConditionals.h>
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
struct _not_empty;
#else
return remote_init();
}
-#endif /* !TARGET_IPHONE_SIMULATOR */
+#endif /* !TARGET_OS_SIMULATOR */
extern int _malloc_no_asl_log;
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
const char *_path_pidfile;
const char *_path_syslogd_log;
#endif
/* global */
struct global_s global;
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
/* Input Modules */
int klog_in_init(void);
int klog_in_reset(void);
int bsd_in_close(void);
static int activate_bsd_in = 1;
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
int udp_in_init(void);
int udp_in_reset(void);
int udp_in_close(void);
int asl_action_close(void);
static int activate_asl_action = 1;
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
/* Interactive Module */
int remote_init(void);
int remote_reset(void);
static void
init_modules()
{
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
module_t *m_klog_in, *m_bsd_out, *m_udp_in, *m_remote;
#endif
module_t *m_asl, *m_bsd_in;
if (m_asl->enabled) m_asl->init();
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
/* BSD output module (configured by /etc/syslog.conf) */
m_bsd_out = (module_t *)calloc(1, sizeof(module_t));
if (m_bsd_out == NULL)
if (m_bsd_in->enabled) m_bsd_in->init();
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
/* network (syslog protocol) input module */
m_udp_in = (module_t *)calloc(1, sizeof(module_t));
if (m_udp_in == NULL)
m_remote->close = remote_close;
if (m_remote->enabled) m_remote->init();
-#endif /* TARGET_IPHONE_SIMULATOR */
+#endif
/* save modules in global.module array */
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
global.module_count = 2;
#else
global.module_count = 6;
global.module[m++] = m_asl;
global.module[m++] = m_bsd_in;
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
global.module[m++] = m_bsd_out;
global.module[m++] = m_klog_in;
global.module[m++] = m_udp_in;
{
int32_t i;
uint64_t master_val;
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
int network_change_token;
#endif
int quota_file_token, asl_db_token, master_token;
time_t now;
int first_syslogd_start = 1;
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
const char *sim_log_dir = getenv("SIMULATOR_LOG_ROOT");
const char *sim_resource_dir = getenv("SIMULATOR_SHARED_RESOURCES_DIRECTORY");
char *p;
}
else if (streq(argv[i], "iphone"))
{
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
global.dbtype = DB_TYPE_FILE;
global.db_file_max = 25600000;
#else
{
if ((i + 1) < argc) global.bsd_max_dup_time = atoll(argv[++i]);
}
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
else if (streq(argv[i], "-klog_in"))
{
if ((i + 1) < argc) activate_klog_in = atoi(argv[++i]);
{
if ((i + 1) < argc) global.launchd_enabled = atoi(argv[++i]);
}
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
else if (streq(argv[i], "-bsd_out"))
{
if ((i + 1) < argc) activate_bsd_out = atoi(argv[++i]);
asldebug("initializing modules\n");
init_modules();
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
asldebug("setting up network change notification handler\n");
/* network change notification resets UDP and BSD modules */
#include <TargetConditionals.h>
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
struct _not_empty;
#else
return udp_in_init();
}
-#endif /* TARGET_IPHONE_SIMULATOR */
+#endif /* !TARGET_OS_SIMULATOR */