PERFORCE change 96235 for review
John Birrell
jb at FreeBSD.org
Thu Apr 27 20:39:57 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=96235
Change 96235 by jb at jb_freebsd2 on 2006/04/27 20:39:03
SysV -> BSD ioctl changes for the last two ioctl values.
This achieves another milestone:
$dtrace -n "BEGIN { @[\"hello world\"] = count(); exit(0); }" -n "END { printa(\"%s, %@d!\", @); }"
Output:
CPU ID FUNCTION:NAME
0 1 :BEGIN
0 2 :END hello world, 1!
Affected files ...
.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_ioctl.c#11 edit
Differences ...
==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_ioctl.c#11 (text+ko) ====
@@ -33,11 +33,8 @@
return (EINVAL);
switch (cmd) {
- case DTRACEIOC_AGGDESC:
-printf("DTRACEIOC_AGGDESC:\n");
-error = EINVAL;
-#ifdef DOODAD
- {
+ case DTRACEIOC_AGGDESC: {
+ dtrace_aggdesc_t **paggdesc = (dtrace_aggdesc_t **) addr;
dtrace_aggdesc_t aggdesc;
dtrace_action_t *act;
dtrace_aggregation_t *agg;
@@ -48,7 +45,7 @@
size_t size;
uintptr_t dest;
- if (copyin((void *)arg, &aggdesc, sizeof (aggdesc)) != 0)
+ if (copyin((void *) *paggdesc, &aggdesc, sizeof (aggdesc)) != 0)
return (EFAULT);
mutex_enter(&dtrace_lock);
@@ -130,7 +127,7 @@
mutex_exit(&dtrace_lock);
- if (copyout(buf, (void *)arg, dest - (uintptr_t)buf) != 0) {
+ if (copyout(buf, (void *) *paggdesc, dest - (uintptr_t)buf) != 0) {
kmem_free(buf, size);
return (EFAULT);
}
@@ -138,8 +135,6 @@
kmem_free(buf, size);
return (0);
}
-#endif
- break;
case DTRACEIOC_AGGSNAP:
case DTRACEIOC_BUFSNAP: {
dtrace_bufdesc_t **pdesc = (dtrace_bufdesc_t **) addr;
@@ -439,22 +434,15 @@
kmem_free(buf, size);
return (0);
}
- case DTRACEIOC_FORMAT:
-printf("DTRACEIOC_FORMAT:\n");
-error = EINVAL;
-#ifdef DOODAD
- {
- dtrace_fmtdesc_t fmt;
+ case DTRACEIOC_FORMAT: {
+ dtrace_fmtdesc_t *fmt = (dtrace_fmtdesc_t *) addr;
char *str;
int len;
- if (copyin((void *)arg, &fmt, sizeof (fmt)) != 0)
- return (EFAULT);
-
mutex_enter(&dtrace_lock);
- if (fmt.dtfd_format == 0 ||
- fmt.dtfd_format > state->dts_nformats) {
+ if (fmt->dtfd_format == 0 ||
+ fmt->dtfd_format > state->dts_nformats) {
mutex_exit(&dtrace_lock);
return (EINVAL);
}
@@ -466,20 +454,15 @@
* and that the format for the specified index is non-NULL.
*/
ASSERT(state->dts_formats != NULL);
- str = state->dts_formats[fmt.dtfd_format - 1];
+ str = state->dts_formats[fmt->dtfd_format - 1];
ASSERT(str != NULL);
len = strlen(str) + 1;
- if (len > fmt.dtfd_length) {
- fmt.dtfd_length = len;
-
- if (copyout(&fmt, (void *)arg, sizeof (fmt)) != 0) {
- mutex_exit(&dtrace_lock);
- return (EINVAL);
- }
+ if (len > fmt->dtfd_length) {
+ fmt->dtfd_length = len;
} else {
- if (copyout(str, fmt.dtfd_string, len) != 0) {
+ if (copyout(str, fmt->dtfd_string, len) != 0) {
mutex_exit(&dtrace_lock);
return (EINVAL);
}
@@ -488,8 +471,6 @@
mutex_exit(&dtrace_lock);
return (0);
}
-#endif
- break;
case DTRACEIOC_GO: {
int rval;
processorid_t *cpuid = (processorid_t *) addr;
@@ -646,7 +627,6 @@
dtrace_probedesc_t *create = &desc->dtrpd_create;
int err;
-printf("DTRACEIOC_REPLICATE:\n");
match->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
match->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
match->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
More information about the p4-projects
mailing list