#lang scheme/base ;; This library is only known to work on my Linux system. I have no idea ;; if it'll work anywhere else... (require scheme/foreign (prefix-in c: scheme/contract)) (unsafe!) (c:provide/contract [getpid (c:-> number?)]) (define current-runtime-lib (ffi-lib #f)) ;; _getpid: -> number ;; The raw getpid() function from the C standard library. (define _getpid (get-ffi-obj "getpid" current-runtime-lib (_fun -> _int))) ;; getpid: -> number ;; Returns the current process id. (define (getpid) (_getpid))