Re: [perfmon] Re: [perfmon2] perfmon2 merge news



From: Paul Mackerras <paulus@xxxxxxxxx>
Date: Wed, 14 Nov 2007 22:44:56 +1100

For instance, if you have something that kind-of looks like

read_pmds(int n, int *pmd_numbers, u64 *pmd_values);

where the caller supplies an array of PMD numbers and the function
returns their values (and you want that reading to be done atomically
in some sense), how would you do that using special files and fops?

The same way we handle some of the multicast "getsockopt()"
calls. The parameters passed in are both inputs and outputs.

For the above example:

struct pmd_info {
int *pmd_numbers;
u64 *pmd_values;
int n;
} *p;

buffer_size = N;
p = malloc(buffer_size);
p->pmd_numbers = p + foo;
p->pmd_values = p + bar;
p->n = whatever(N);
err = read(fd, p, N);

It's definitely doable, use your imagination.

You can encode all kinds of operation types into the
header as well.

Another alternative is to use generic netlink.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Search through a (large) binary file.
    ... If you're only ever going to read the plain bytes, just read them directly from the FileStream you're working with. ... You can use the Position property to adjust from where you're reading in the file; save the current position, set the current position to 4 bytes earlier than the offset of the found string, read the 4 bytes of interest, then restore the current position to the previously saved value. ... If you have 4 bytes in an array, it would seem that you ought to just be using BitConverter to convert those directly to a 32-bit int, rather than doing all that stuff with the string. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: "PORTING C" > Viewing an array in wathc window fails!
    ... This also tells anyone reading the code that the function expects an array ... the Watch window. ... int addNumbers; ...
    (microsoft.public.vc.language)
  • [MC++] __nogc arrays of __value classes
    ... I have been reading through the ManagedExtensionsSpec.doc file and I ... make a difference) and I want a non-variable-size array of them, ... __value struct Contours { ... int num_contours; ...
    (microsoft.public.dotnet.languages.vc)
  • Re: [C] functions and 2D arrays?
    ... >to arrays of arrays of int, when you could be passing pointers ... >to arrays of int. ... to array" is rather out of the ordinary. ... feels more "natural" after you've been reading and writing C and C++ ...
    (alt.comp.lang.learn.c-cpp)
  • (patch for Bash) regex case statement
    ... Following up on my previous patch for regex conditional tests, ... /* Return an array of strings; ... int dollarflag, zeropad, compareflag; ... SHELL_VAR *var; ...
    (comp.unix.shell)