Files
geramyloveless 953cf0149c mac_linuxgpu: upstream Linux amdgpu on macOS
Runs the unmodified upstream Linux amdgpu and amdkfd drivers on Apple
Silicon Macs inside a DriverKit system extension, for AMD GPUs attached
over Thunderbolt. The Linux sources come from a pinned submodule and are
compiled against linuxu, a userspace implementation of the Linux kernel
APIs they use. Includes the HSA runtime, the host installer app, the
setup and firmware fetch scripts, and the offline test suite.
2026-10-02 18:49:17 -07:00

35 lines
1.4 KiB
C

/* linuxu: SHIM (third_party/linux/include/linux/fdtable.h)
*
* Descriptor tables. Each linuxu process owns one files_struct, shared by
* its thread tasks through task->files; fget/fd_install/close_fd and
* friends act on current->files. A task without files (a kernel thread or
* a DriverKit thread outside any process) uses the kernel's own table.
* Runtime: linuxu/src/shims/fd.c.
*/
#ifndef __LINUX_FDTABLE_H
#define __LINUX_FDTABLE_H
#include <linux/types.h>
struct files_struct;
struct file;
/* Upper bound on one table's size (Linux's default RLIMIT_NOFILE soft limit
* is 1024; the hard sysctl_nr_open default is 1048576). */
#define LINUXU_NR_OPEN 4096
/* An empty table holding one reference. */
extern struct files_struct *linuxu_files_alloc(void);
extern struct files_struct *linuxu_files_get(struct files_struct *files);
/* Drop a reference; the last one closes every descriptor and frees. */
extern void linuxu_files_put(struct files_struct *files);
/* Close every installed descriptor (fput each file) and release reserved
* slots: the descriptor half of exit_files. Returns the number closed. */
extern unsigned int linuxu_files_close_all(struct files_struct *files);
/* Number of installed descriptors (diagnostics and tests). */
extern unsigned int linuxu_files_count(struct files_struct *files);
/* The table fget() and friends use for the calling task. */
extern struct files_struct *linuxu_current_files(void);
#endif /* __LINUX_FDTABLE_H */