[drmaa-wg] buffer length/size

Piotr Domagalski szalik at szalik.net
Thu Jun 15 05:24:32 CDT 2006


hello!

It is not clear for me when reading the specification (and it's even
worse when looking at the DRMAA implementation or example source code)
whether all the "length" parameters (e.g. error_diag_len, job_id_len)
are considered as the total size of the buffer (thus including '\0') or
only the maximum number of printable characters.

For example, from the specification:

job name
A job name SHALL comprise alphanumeric and _ characters.  The
drmaa-implementation SHALL NOT provide the client with a job name longer
than DRMAA_JOBNAME_BUFFER -1 (1023) characters.

but

The length of any output context-specific error string SHALL NOT exceed
DRMAA_ERROR_STRING_BUFFER.

The first implies that I could use:

char job_name[DRMAA_JOBNAME_BUFFER];

but for the second I must use:

char error_diag[DRMAA_ERROR_STRING_BUFFER + 1];

Please let me know what was your intentions, and for the future, it
would be great if you could clarify this issue in the documents. I think
you should use "buffer size" term, because "buffer length" is not that
clear (sizeof vs strlen).

I'm more convinced that the constants define the total buffer size, but
some DRMAA example source codes got me confused, e.g. they define
variables char foo[DRMAA_JOBNAME_BUFFER] but use DRMAA_JOBNAME_BUFFER -
1 as call arguments.

-- 
Piotr Domagalski





More information about the drmaa-wg mailing list