Commit Graph

52 Commits

Author SHA1 Message Date
Dan Gohman 9ea366f5d4 Add a new ioctl module, and populate it with lots of ioctl codes. (#18)
We've been collecting manual definitions of ioctl codes for a while, and
it looks like we're going to be collecting more over time, so start trying
a different strategy: use a script and a C program to extract ioctl values
from the headers semi-automatically.

The script itself isn't very easy to run, and I'm open to ideas for how
to do it better. However, this should cover most of Linux's existing ioctls,
so hopefully we won't need to run it very often.
2022-01-26 11:35:51 -08:00
Dan Gohman 39534e6677 Update to bindgen 0.59.2. 2022-01-25 12:00:58 -08:00
Dan Gohman 7ed63a24c8 Define TIOCGWINSZ, FIONBIO, FIONREAD, and TCGETS on powerpc64le.
Linux's macro definitions for these are too complex for bindgen, so
define these manually.
2022-01-25 11:52:57 -08:00
Dan Gohman 657f24330d Add bindings for linux/userfaultfd.h. 2022-01-25 11:50:14 -08:00
Dan Gohman f3a1d49170 Document the purpose of the code in gen/modules/general.h.
Code in general.h should contain just what's needed for interoperability
with the Linux kernel ABI. Add a comment explaining this, and tidy up
a few parts of the code to follow this advice.
2022-01-10 12:17:09 -08:00
Friedel Ziegelmayer f913f2ceb2 feat: add msghdr (#13)
* feat: add msghdr

* regen

* add ip.h and ipv6.h

* include more from socket.h

* cleanup

* cleanup types and add mmsghdr
2022-01-10 12:16:43 -08:00
Mek101 279e8c04f5 Pin bindgen patch version 2022-01-03 12:58:22 -06:00
Mek101 ee0ab18f98 Fix BLKSSZGET and BLKPBSZGET for mips and powerpc 2022-01-03 12:58:22 -06:00
Dan Gohman 2f00e54a01 rustfmt 2021-11-05 06:09:54 -07:00
Dan Gohman a782f144f4 Rename rustc-std-workspace-core to core in Cargo.toml instead of lib.rs. 2021-11-04 08:37:34 -07:00
Dan Gohman a54935c9e0 Use rustc-std-workspace-core like libc does. 2021-11-03 16:03:54 -07:00
Dan Gohman c667510274 Add a compiler_builtins dependency in rustc-dep-of-std mode. 2021-11-03 14:37:50 -07:00
Dan Gohman cee7ab90b9 Name the rustc-std-workspace-core dependency 'core'. 2021-11-03 14:25:44 -07:00
Dan Gohman 951eae2802 Fix the auto-generated rustc-dep-of-std to depend on no_std. 2021-11-03 13:55:52 -07:00
Dan Gohman e16e143b1c Add rustc-dep-of-std support. 2021-11-03 13:48:17 -07:00
Dan Gohman 28f73e9cc8 Define ctypes manually instead of depending on cty.
In `no_std` builds, define `ctypes` types manually instead of depending
on the `cty` crate. These types are straightforward to define for all
Linux targets.
2021-11-03 13:44:08 -07:00
Mek101 7e84e621ca Add BLKSSZGET and BLKPBSZGET ioctl arguments (#8)
* Add BLKPBSZGET for x86_64

* Add BLKPBSZGET for everyone but sparc

* Add BLKSSZGET for everyone but sparc

* Update reference bindings

* Fix BLKSSZGET and BLKPBSZGET included in sparc bindings

* Add BLKSSZGET and BLKPBSZGET to sparc
2021-11-02 07:19:02 -07:00
Dan Gohman bb4f3f3b9c Add <linux/sched.h>. 2021-10-04 06:09:02 -07:00
Dan Gohman eb27d30ad4 Define ARCH_SET_FS for x86 and x86_64. 2021-09-20 05:51:48 -07:00
Dan Gohman b9a73148b4 Define the user_desc struct. 2021-09-20 05:20:29 -07:00
Dan Gohman 53337176d3 Define struct linger. 2021-09-18 07:07:43 -07:00
Dan Gohman e077e6072a Add <linux/tcp.h>. 2021-09-18 05:16:05 -07:00
Dan Gohman 472b66818e Add the membarrier constants. 2021-09-16 08:06:42 -07:00
Dan Gohman 0fd4139b03 Add the Linux uname types. 2021-09-01 11:18:11 -07:00
Dan Gohman 244ed8f93e Add the Linux auxval constants. 2021-09-01 08:23:25 -07:00
Dan Gohman dce54115af Add a "std" feature to be friendlier for cargo nono. 2021-08-25 10:37:48 -07:00
bjorn3 b110a1900a Use cty instead of libc for c types 2021-08-23 04:31:59 -07:00
bjorn3 963b82965b Add #![no_std] support 2021-08-23 04:31:59 -07:00
bjorn3 ac00127984 Use #[cfg(any())] in lib.rs 2021-08-23 04:31:59 -07:00
bjorn3 181585dc3a Add CI (#3)
* Do a partial clone of linux

This saves a lot of disk space. The git dir for the partial clone after
all relevant versions have been checked out is 1.7GB.

* Do a sparse checkout of linux

This saves a lot of disk space. The git dir for the partial clone after all relevant versions have been checked out is <800MB.

* Fix typo

* Fix checkout on CI

* Add CI

* Make generation deterministic

Directory iteration order is non-deterministic. In practice it depends
on the exact order in which dir entries have been created. Sort the
output of fs::read_dir to ensure that generation is deterministic across
systems.

* Check for linux/.git

* Build generator in release mode

* Switch to cargo check
2021-08-22 07:47:08 -07:00
Dan Gohman 13a9b81c9c Update to bindgen 0.59. 2021-08-10 17:29:07 -07:00
Dan Gohman df8888be8b Add defines for use with timerfd_create. 2021-07-30 13:55:02 -05:00
Dan Gohman 306d936d0f Define EPOLLET and EPOLLONESHOT. 2021-07-19 09:44:20 -07:00
Dan Gohman d78c7ace07 Define EPOLLEXCLUSIVE and EPOLLWAKEUP. 2021-07-12 14:18:44 -07:00
Dan Gohman 74da544831 Add the EPOLL event flag constants. 2021-07-12 13:47:16 -07:00
Dan Gohman 1a943d273f Add eventfd defines to the general module. 2021-07-12 12:09:40 -07:00
Dan Gohman 4861fc1c5c Add <linux/eventpoll.h> to the general module. 2021-07-12 11:03:08 -07:00
Dan Gohman f3356d8a08 Increase the Linux kernel version where we need to define __kernel_timespec. 2021-06-29 14:41:29 -07:00
Dan Gohman 0c59a6648a Suppress uninteresting warnings. 2021-06-29 14:15:30 -07:00
Dan Gohman 0971d7a236 Add support for per-architecture base Linux versions. 2021-06-29 14:15:30 -07:00
Dan Gohman e53add6649 Add <linux/falloc.h> to general. 2021-06-29 05:38:02 -07:00
Dan Gohman 4c665f03d9 Define __kernel_timespec and __kernel_time64_t on 2.6.32. 2021-06-21 16:00:57 -07:00
Dan Gohman 8a4ce78038 Declare AF_UNIX instead of AF_LOCAL, and declare __kernel_sa_family_t. 2021-06-21 15:48:12 -07:00
Dan Gohman 9dc33debe7 Fix the layout of struct statfs64 on 64-bit targets.
Linux's definitions for statfs and statfs64 depend on BITS_PER_LONG
being defined, so manually predefine it.

Also, remove some redundant definitions from general.h.
2021-06-19 05:49:13 -07:00
Dan Gohman 45c5c0f430 Define sockaddr_in6. 2021-06-17 05:51:14 -07:00
Dan Gohman d7f9fdd71e rustfmt 2021-06-16 21:01:50 -07:00
Dan Gohman c71951ee19 Define MSG_CMSG_CLOEXEC too. 2021-06-16 07:37:27 -07:00
Dan Gohman 64e5683709 Define the MSG_* constants. 2021-06-16 07:24:21 -07:00
Dan Gohman 74800897cd Define STD{IN,OUT,ERR}_FILENO and the RWF_* flags. 2021-06-15 19:39:08 -07:00
Dan Gohman 02be122bbe Add whitespace for tidiness. 2021-06-15 19:38:39 -07:00