Clisp 如何从操作系统错误中检索errno?

Clisp 如何从操作系统错误中检索errno?,clisp,Clisp,这个问题分为两部分 第一部分: 我运行这个 1 (handler-case (posix:kill 1 0) 2 (error (the-condition) (prin1 (type-of the-condition)) (terpri) 3 (princ the-condition) (terpri))) 。。。并获得以下输出: SYSTEM::SIMPLE-OS-ERROR UNIX error 1 (EPERM): Opera

这个问题分为两部分

第一部分:

我运行这个

 1 (handler-case (posix:kill 1 0)
 2   (error (the-condition) (prin1 (type-of the-condition)) (terpri)
 3                          (princ the-condition) (terpri)))
。。。并获得以下输出:

SYSTEM::SIMPLE-OS-ERROR
UNIX error 1 (EPERM): Operation not permitted
我可以使用
#“princ-to-string
解析字符串以获取错误号。但是有没有更直接的方法来检索
errno
?类似于
#'file-error-pathname
,但是否改为
errno

第二部分:

在文档中的什么地方可以找到第一部分的答案?

发布版本 发布的版本2.49没有errno的访问器。 然而,你可以得到它:

[4]> (setq c (nth-value 1 (ignore-errors (posix:kill 1 0))))
#<SYSTEM::SIMPLE-OS-ERROR #x00000002002634A1>
[5]> (describe c)

#<SYSTEM::SIMPLE-OS-ERROR #x000000020021AF69> is an instance of the CLOS class #1=#<STANDARD-CLASS SYSTEM::SIMPLE-OS-ERROR>.
Slots:
  SYSTEM::$FORMAT-CONTROL     = 
"UNIX error ~S (EPERM): Operation not permitted
"
  SYSTEM::$FORMAT-ARGUMENTS   = (1)

 "UNIX error ~S (EPERM): Operation not permitted
" is a simple 1 dimensional array (vector) of CHARACTERs, of size 47 (a ISO-8859-1 string).

 (1) is a list of length 1.

[6]> (car (slot-value c 'SYSTEM::$FORMAT-ARGUMENTS))
1
[1]> (setq c (nth-value 1 (ignore-errors (posix:kill 1 0))))
#<OS-ERROR #x0000000200253301>
[2]> (describe c)

#<OS-ERROR #x0000000200253301> is an instance of the CLOS class #1=#<STANDARD-CLASS OS-ERROR>.
Slots:
  SYSTEM::$CODE   = 1

 1 is an integer, uses 1 bit, is represented as a fixnum.

[6]> (apropos "os-error")
OS-ERROR                                   class
OS-ERROR-CODE                              function
EXT::OS-ERROR-CODE-1                    

[10]> (os-error-code c)
1