if ( subop == TMEMC_LIST && arg1 != 0 )
{
if ( buf == NULL )
- return -EINVAL;
+ {
+ errno = EINVAL;
+ return -1;
+ }
if ( xc_hypercall_bounce_pre(xch, buf) )
{
PERROR("Could not bounce buffer for tmem control hypercall");
- return -ENOMEM;
+ return -1;
}
}
if ( subop == TMEMC_LIST && arg1 != 0 )
{
if ( buf == NULL )
- return -EINVAL;
+ {
+ errno = EINVAL;
+ return -1;
+ }
if ( xc_hypercall_bounce_pre(xch, buf) )
{
PERROR("Could not bounce buffer for tmem control (OID) hypercall");
- return -ENOMEM;
+ return -1;
}
}
xc_domaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
int new_domains;
unsigned int i;
+ int rc;
/* Create the node */
node = (xenstat_node *) calloc(1, sizeof(xenstat_node));
node->free_mem = ((unsigned long long)physinfo.free_pages)
* handle->page_size;
- node->freeable_mb = (long)xc_tmem_control(handle->xc_handle, -1,
- TMEMC_QUERY_FREEABLE_MB, -1, 0, 0, 0, NULL);
-
+ rc = xc_tmem_control(handle->xc_handle, -1,
+ TMEMC_QUERY_FREEABLE_MB, -1, 0, 0, 0, NULL);
+ node->freeable_mb = (rc < 0) ? 0 : rc;
/* malloc(0) is not portable, so allocate a single domain. This will
* be resized below. */
node->domains = malloc(sizeof(xenstat_domain));