Determining a file's unix file descriptor int value from its pathname?

"Denis Papathanasiou" <[email protected]>
Newsgroups gmane.lisp.cmucl.general
Message-ID <[email protected]>
I'm experimenting with alien objects to get my lisp app to use the
unix native fcntl function for file locking.

Following the example in "Advanced Programming in the UNIX
Environment" book (http://apuebook.com/), I've built the lockfile.o
object file.

Its function call is: int lockfile(int fd) where fd is the integer
representation of the file, as the unix os knows it.

Inside my lisp code, I'm able load the object file by calling
(ext:load-foreign "lockfile.o") and I'm all set to invoke the lockfile
function with the (def-alien-routine) macro.

But now, I need to pass it an integer (fd) which represents the unix
file descriptor.

All I have, though, is the lisp pathname object.

Is there a way to convert pathname to the correct integer value?

I looked at all the pathname related functions in the hyperspec, but
there doesn't seem to be anything there that can do this.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.