changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/ffi/uring/util.lisp

changeset 529: f08ae719ab2a
parent: 1c2f32044816
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 08 Jul 2024 12:23:20 -0400
permissions: -rw-r--r--
description: more alpine cope
1 ;;; uring/types.lisp --- concrete types
2 
3 ;; args,flags,etc
4 
5 ;;; Code:
6 
7 (in-package :uring)
8 
9 (define-alien-type nil
10  (struct sigset-t
11  (val (array unsigned-long #.+sigset-nwords+))))
12 
13 (define-alien-type cpu-mask-t unsigned-long)
14 
15 (define-alien-type nil
16  (struct cpu-set-t
17  (bits (array cpu-mask-t #.(/ +cpu-setsize+ +ncpu-bits+)))))
18 
19 ;; statx epoll-event __kernel_rwf_t
20 
21 ;; target fd/u32
22 
23 ;; sb-posix:file-descriptor - not yet allocated by uring
24 ;; uring:fixed - file-descriptor that has been registered with uring
25 
26 ;;; Time
27 
28 ;; Default behavior is to treat the timespec C type as a relative time
29 ;; interval.
30 
31 ;; flags may contain ABS to indicate absolute time. When using
32 ;; absolute time, the kernel uses its monotonic clock unless flags
33 ;; contain BOOTTIME/REALTIME
34 
35 ;; ioring-msg -- enum
36 
37 ;; helper for parsing the result of a multishot
38 (defstruct recv-msg-out
39  (header (allocate-io-uring-recvmsg-out) :type (alien io-uring-recvmsg-out))
40  (msghdr-name-len 0 :type fixnum)
41  (name-data #() :type octet-vector)
42  (control-data #() :type octet-vector)
43  (payload-data #() :type octet-vector))
44 
45 ;; (defun parse-recv-msg-out (buf header) msghdr..)
46 
47 ;;; Cancel
48 (define-alien-type async-cancel-flags int)
49 (define-alien-type user-data unsigned-long)
50 
51 (defstruct cancel-builder
52  (flags 0 :type (alien async-cancel-flags))
53  (user-data (deref (make-alien user-data)) :type (alien user-data)))
54 
55 ;; any, user_data, fd, all
56 
57 (defstruct mmapped-region
58  (addr (deref (make-alien (* t))) :type (alien (* t))) ;; (sb-impl::dynamic-space-free-pointer) ;?
59  (len 0 :type fixnum))
60 
61 ;; do-mmap
62 ;; map len bytes starting from offset from file-descriptor in mmapped-region
63 
64 ;;; CPU Affinity
65 ;; it appears this actually crashes SBCL, receiving sig6 from foreign thread
66 ;; (define-alien-routine sched-setaffinity int (pid int) (cpusetsize size-t) (set (* (struct cpu-set-t))))
67 ;; (define-alien-routine sched-getaffinity int (pid int) (cpusetsize size-t) (set (* (struct cpu-set-t))))
68 ;; (sched-getaffinity 0 cpu-setsize (make-alien (struct cpu-set-t)))
69 ;; (sched-setaffinity 0 cpu-setsize (make-alien (struct cpu-set-t)))