cl_perror 例程

cl_perror 例程将一条描述所指定错误代码的消息写至标准错误。 cl_perror 将提供的错误字符串置于错误消息前面,并将一个冒号置于错误消息后面。

语法

void cl_perror (int status, char *message)

例如,指定:

cl_perror(CLE_IVNODENAME, "Can't service this request");

会生成以下输出:

Can't service this request:Illeagle Node Name.

cl_perror 例程对于根据 Clinfo 请求所返回的状态码生成错误消息很有用。 如果提供的状态不是有效的集群错误代码,那么 cl_perror 例程将写入以下字符串:

Error n

其中 n 是所指定状态码的值。

参数

项目 描述
status 集群错误代码。
消息 将位于状态描述前面的消息。

示例

struct cl_node nodebuf;
  int clusterid = 99999999;      /* invalid cluster id */
  int status;
  char nodename[CL_MAXNAMELEN];
 
  if ( (status = cl_getnode (clusterid, nodename, &nodebuf)) < 0 ) {
      cl_perror(status, "can't get node information");
  }