/*
* Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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 OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * 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@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
+#include <sys/systm.h>
#include <sys/types.h>
-#include <sys/vnode.h>
+#include <sys/proc_internal.h>
+#include <sys/vnode_internal.h>
#include <sys/fcntl.h>
#include <sys/filedesc.h>
#include <sys/sem.h>
AUE_SEMCTL, /* 254 = semctl */
AUE_SEMGET, /* 255 = semget */
AUE_SEMOP, /* 256 = semop */
- AUE_NULL, /* 257 = semconfig */
+ AUE_NULL, /* 257 = */
AUE_MSGCTL, /* 258 = msgctl */
AUE_MSGGET, /* 259 = msgget */
AUE_MSGSND, /* 260 = msgsnd */
AUE_NULL, /* 295 */
AUE_LOADSHFILE, /* 296 = load_shared_file */
AUE_RESETSHFILE, /* 297 = reset_shared_file */
- AUE_NEWSYSTEMSHREG, /* 298 = new_system_shared_regions */
+ AUE_NEWSYSTEMSHREG, /* 298 = new_system_shared_regions */
AUE_NULL, /* 299 */
AUE_NULL, /* 300 */
AUE_NULL, /* 301 */
AUE_NULL, /* 361 */
AUE_NULL, /* 362 = kqueue */
AUE_NULL, /* 363 = kevent */
- AUE_NULL, /* 364 */
+ AUE_LCHOWN, /* 364 = lchown */
AUE_NULL, /* 365 */
AUE_NULL, /* 366 */
AUE_NULL, /* 367 */
return (AU_NULL);
}
-/*
+ /*
* Insert a event to class mapping. If the event already exists in the
* mapping, then replace the mapping with the new one.
* XXX There is currently no constraints placed on the number of mappings.
* May want to either limit to a number, or in terms of memory usage.
- */
+ */
void au_evclassmap_insert(au_event_t event, au_class_t class)
{
struct evclass_list *evcl;
return;
}
}
- kmem_alloc(kernel_map, &evc, sizeof(*evc));
+ kmem_alloc(kernel_map, (vm_offset_t *)&evc, sizeof(*evc));
if (evc == NULL) {
return;
}
evc->event = event;
evc->class = class;
LIST_INSERT_HEAD(&evcl->head, evc, entry);
-
}
void au_evclassmap_init()
for (i = 0; i < nsys_au_event; i++) {
if (sys_au_event[i] != AUE_NULL) {
au_evclassmap_insert(sys_au_event[i], AU_NULL);
- }
+ }
}
/* Add the Mach system call events */
au_evclassmap_insert(AUE_TASKFORPID, AU_NULL);
au_evclassmap_insert(AUE_SWAPOFF, AU_NULL);
au_evclassmap_insert(AUE_MAPFD, AU_NULL);
au_evclassmap_insert(AUE_INITPROCESS, AU_NULL);
-
+
/* Add the specific open events to the mapping. */
au_evclassmap_insert(AUE_OPEN_R, AU_FREAD);
- au_evclassmap_insert(AUE_OPEN_RC, AU_FREAD|AU_FCREATE);
- au_evclassmap_insert(AUE_OPEN_RTC, AU_FREAD|AU_FCREATE|AU_FDELETE);
- au_evclassmap_insert(AUE_OPEN_RT, AU_FREAD|AU_FDELETE);
- au_evclassmap_insert(AUE_OPEN_RW, AU_FREAD|AU_FWRITE);
- au_evclassmap_insert(AUE_OPEN_RWC, AU_FREAD|AU_FWRITE|AU_FCREATE);
- au_evclassmap_insert(AUE_OPEN_RWTC, AU_FREAD|AU_FWRITE|AU_FCREATE|AU_FDELETE);
- au_evclassmap_insert(AUE_OPEN_RWT, AU_FREAD|AU_FWRITE|AU_FDELETE);
- au_evclassmap_insert(AUE_OPEN_W, AU_FWRITE);
- au_evclassmap_insert(AUE_OPEN_WC, AU_FWRITE|AU_FCREATE);
- au_evclassmap_insert(AUE_OPEN_WTC, AU_FWRITE|AU_FCREATE|AU_FDELETE);
- au_evclassmap_insert(AUE_OPEN_WT, AU_FWRITE|AU_FDELETE);
+ au_evclassmap_insert(AUE_OPEN_RC, AU_FREAD|AU_FCREATE);
+ au_evclassmap_insert(AUE_OPEN_RTC, AU_FREAD|AU_FCREATE|AU_FDELETE);
+ au_evclassmap_insert(AUE_OPEN_RT, AU_FREAD|AU_FDELETE);
+ au_evclassmap_insert(AUE_OPEN_RW, AU_FREAD|AU_FWRITE);
+ au_evclassmap_insert(AUE_OPEN_RWC, AU_FREAD|AU_FWRITE|AU_FCREATE);
+ au_evclassmap_insert(AUE_OPEN_RWTC, AU_FREAD|AU_FWRITE|AU_FCREATE|AU_FDELETE);
+ au_evclassmap_insert(AUE_OPEN_RWT, AU_FREAD|AU_FWRITE|AU_FDELETE);
+ au_evclassmap_insert(AUE_OPEN_W, AU_FWRITE);
+ au_evclassmap_insert(AUE_OPEN_WC, AU_FWRITE|AU_FCREATE);
+ au_evclassmap_insert(AUE_OPEN_WTC, AU_FWRITE|AU_FCREATE|AU_FDELETE);
+ au_evclassmap_insert(AUE_OPEN_WT, AU_FWRITE|AU_FDELETE);
}
-/*
+ /*
* Check whether an event is aditable by comparing the mask of classes this
* event is part of against the given mask.
- *
- */
+ */
int au_preselect(au_event_t event, au_mask_t *mask_p, int sorf)
{
au_class_t effmask = 0;
return (-1);
ae_class = au_event_class(event);
- /*
+ /*
* Perform the actual check of the masks against the event.
*/
- if (sorf & AU_PRS_SUCCESS) {
+ if(sorf & AU_PRS_SUCCESS) {
effmask |= (mask_p->am_success & ae_class);
}
case KERN_SAVED_IDS:
case KERN_NETBOOT:
case KERN_SYMFILE:
+ case KERN_SHREG_PRIVATIZABLE:
return AUE_SYSCTL_NONADMIN;
/* only treat the sets as admin */
default:
aevent = AUE_OPEN;
break;
- }
+}
- /*
+/*
* Convert chatty errors to better matching events.
* Failures to find a file are really just attribute
* events - so recast them as such.
- */
+*/
switch (aevent) {
case AUE_OPEN_R:
case AUE_OPEN_RT:
case AUE_OPEN_WT:
if (error == ENOENT)
aevent = AUE_OPEN;
- }
+}
return aevent;
}
/* Convert a MSGCTL command to a specific event. */
-int msgctl_to_event(int cmd)
+au_event_t msgctl_to_event(int cmd)
{
switch (cmd) {
case IPC_RMID:
}
/* Convert a SEMCTL command to a specific event. */
-int semctl_to_event(int cmd)
+au_event_t semctl_to_event(int cmd)
{
switch (cmd) {
case GETALL:
cpath[0] = '\0';
return (ret);
}
- /* The length returned by vn_getpath() is two greater than the
- * number of characters in the string.
- */
if (len < MAXPATHLEN)
- cpath[len-2] = '/';
- strncpy(cpath + len-1, bufp, MAXPATHLEN - len);
+ cpath[len-1] = '/';
+ strncpy(cpath + len, bufp, MAXPATHLEN - len);
} else {
strncpy(cpath, bufp, MAXPATHLEN);
}