Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IPC/SHM to systems #1132

Merged
merged 10 commits into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Include `sys/ipc.h` and `sys/shm.h` for system APIs of Linux and Mac OS X ([pull #1132](https://github.com/bytedeco/javacpp-presets/pull/1132))
* Map `c10::ArrayRef<at::Tensor>(std::vector<at::Tensor>&)` constructor from PyTorch for convenience ([discussion #1128](https://github.com/bytedeco/javacpp-presets/discussions/1128))
* Add `long rs2_get_frame_data_address()` to reduce garbage for real-time applications using librealsense2 ([discussion bytedeco/javacpp#532](https://github.com/bytedeco/javacpp/discussions/532))
* Add to `torch.Tensor` convenient `create()`, `createBuffer()`, and `createIndexer()` factory methods for PyTorch
Expand Down
318 changes: 248 additions & 70 deletions systems/src/gen/java/org/bytedeco/systems/global/linux.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class linux extends org.bytedeco.systems.presets.linux {
// Parsed from cpuid.h

/*
* Copyright (C) 2007-2017 Free Software Foundation, Inc.
* Copyright (C) 2007-2018 Free Software Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down Expand Up @@ -84,6 +84,7 @@ public class linux extends org.bytedeco.systems.presets.linux {

/* %ebx */
public static final int bit_CLZERO = (1 << 0);
public static final int bit_WBNOINVD = (1 << 9);

/* Extended Features (%eax == 7) */
/* %ebx */
Expand Down Expand Up @@ -114,13 +115,23 @@ public class linux extends org.bytedeco.systems.presets.linux {
public static final int bit_AVX512VBMI = (1 << 1);
public static final int bit_PKU = (1 << 3);
public static final int bit_OSPKE = (1 << 4);
public static final int bit_AVX512VBMI2 = (1 << 6);
public static final int bit_SHSTK = (1 << 7);
public static final int bit_GFNI = (1 << 8);
public static final int bit_VAES = (1 << 9);
public static final int bit_AVX512VNNI = (1 << 11);
public static final int bit_VPCLMULQDQ = (1 << 10);
public static final int bit_AVX512BITALG = (1 << 12);
public static final int bit_AVX512VPOPCNTDQ = (1 << 14);
public static final int bit_RDPID = (1 << 22);
public static final int bit_MOVDIRI = (1 << 27);
public static final int bit_MOVDIR64B = (1 << 28);

/* %edx */
public static final int bit_AVX5124VNNIW = (1 << 2);
public static final int bit_AVX5124FMAPS = (1 << 3);

public static final int bit_IBT = (1 << 20);
public static final int bit_PCONFIG = (1 << 18);
/* XFEATURE_ENABLED_MASK register bits (%eax == 13, %ecx == 0) */
public static final int bit_BNDREGS = (1 << 3);
public static final int bit_BNDCSR = (1 << 4);
Expand Down Expand Up @@ -10359,74 +10370,6 @@ priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */
// #endif /* sys/resource.h */


// Parsed from sys/sysctl.h

/* Copyright (C) 1996, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

// #ifndef _SYS_SYSCTL_H
public static final int _SYS_SYSCTL_H = 1;

// #include <features.h>
// #define __need_size_t
// #include <stddef.h>
/* Prevent more kernel headers than necessary to be included. */
// #ifndef _LINUX_KERNEL_H
// # define _LINUX_KERNEL_H 1
// # define __undef_LINUX_KERNEL_H
// #endif
// #ifndef _LINUX_TYPES_H
public static final int _LINUX_TYPES_H = 1;
// # define __undef_LINUX_TYPES_H
// #endif
// #ifndef _LINUX_LIST_H
public static final int _LINUX_LIST_H = 1;
// # define __undef_LINUX_LIST_H
// #endif
// #ifndef __LINUX_COMPILER_H
public static final int __LINUX_COMPILER_H = 1;
// # define __user
// # define __undef__LINUX_COMPILER_H
// #endif

// #include <linux/sysctl.h>

// #ifdef __undef_LINUX_KERNEL_H
// #endif
// #ifdef __undef_LINUX_TYPES_H
// #endif
// #ifdef __undef_LINUX_LIST_H
// #endif
// #ifdef __undef__LINUX_COMPILER_H
// #endif

// #include <bits/sysctl.h>

/* Read or write system parameters. */
public static native int sysctl(@Cast("int*") IntPointer __name, int __nlen, Pointer __oldval,
@Cast("size_t*") SizeTPointer __oldlenp, Pointer __newval, @Cast("size_t") long __newlen);
public static native int sysctl(@Cast("int*") IntBuffer __name, int __nlen, Pointer __oldval,
@Cast("size_t*") SizeTPointer __oldlenp, Pointer __newval, @Cast("size_t") long __newlen);
public static native int sysctl(@Cast("int*") int[] __name, int __nlen, Pointer __oldval,
@Cast("size_t*") SizeTPointer __oldlenp, Pointer __newval, @Cast("size_t") long __newlen);

// #endif /* _SYS_SYSCTL_H */


// Parsed from bits/waitflags.h

/* Definitions of flag bits for `waitpid' et al.
Expand Down Expand Up @@ -10644,6 +10587,241 @@ public static native int waitid(@Cast("idtype_t") int __idtype, @Cast("__id_t")
// #endif /* sys/wait.h */


// Parsed from bits/ipc.h

/* Copyright (C) 1995-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

// #ifndef _SYS_IPC_H
// # error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
// #endif

// #include <bits/types.h>

/* Mode bits for `msgget', `semget', and `shmget'. */
public static final int IPC_CREAT = 01000; /* Create key if key does not exist. */
public static final int IPC_EXCL = 02000; /* Fail if key exists. */
public static final int IPC_NOWAIT = 04000; /* Return error on wait. */

/* Control commands for `msgctl', `semctl', and `shmctl'. */
public static final int IPC_RMID = 0; /* Remove identifier. */
public static final int IPC_SET = 1; /* Set `ipc_perm' options. */
public static final int IPC_STAT = 2; /* Get `ipc_perm' options. */
// #ifdef __USE_GNU
public static final int IPC_INFO = 3; /* See ipcs. */
// #endif

/* Special key values. */
public static final int IPC_PRIVATE = ((int) 0);
// Targeting ../linux/ipc_perm.java




// Parsed from sys/ipc.h

/* Copyright (C) 1995,1996,1997,1999,2002,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

// #ifndef _SYS_IPC_H
public static final int _SYS_IPC_H = 1;

// #include <features.h>

// #if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2
// # warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE"
// #endif

/* Get system dependent definition of `struct ipc_perm' and more. */
// #include <bits/ipctypes.h>
// #include <bits/ipc.h>

// #ifndef __uid_t_defined
// # define __uid_t_defined
// #endif

// #ifndef __gid_t_defined
// # define __gid_t_defined
// #endif

// #ifndef __mode_t_defined
// # define __mode_t_defined
// #endif

// #ifndef __key_t_defined
// # define __key_t_defined
// #endif

/* Generates key for System V style IPC. */
public static native @Cast("key_t") int ftok(@Cast("const char*") BytePointer __pathname, int __proj_id);
public static native @Cast("key_t") int ftok(String __pathname, int __proj_id);

// #endif /* sys/ipc.h */


// Parsed from bits/shm.h

/* Copyright (C) 1995-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

// #ifndef _SYS_SHM_H
// # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
// #endif

// #include <bits/types.h>

/* Permission flag for shmget. */
public static final int SHM_R = 0400; /* or S_IRUGO from <linux/stat.h> */
public static final int SHM_W = 0200; /* or S_IWUGO from <linux/stat.h> */

/* Flags for `shmat'. */
public static final int SHM_RDONLY = 010000; /* attach read-only else read-write */
public static final int SHM_RND = 020000; /* round attach address to SHMLBA */
public static final int SHM_REMAP = 040000; /* take-over region on attach */
public static final int SHM_EXEC = 0100000; /* execution access */

/* Commands for `shmctl'. */
public static final int SHM_LOCK = 11; /* lock segment (root only) */
public static final int SHM_UNLOCK = 12; /* unlock segment (root only) */

/* Segment low boundary address multiple. */
public static native @MemberGetter int SHMLBA();
public static final int SHMLBA = SHMLBA();
public static native int __getpagesize();


/* Type to count number of attaches. */
// Targeting ../linux/shmid_ds.java



// #ifdef __USE_MISC

/* ipcs ctl commands */
public static final int SHM_STAT = 13;
public static final int SHM_INFO = 14;
public static final int SHM_STAT_ANY = 15;

/* shm_mode upper byte flags */
public static final int SHM_DEST = 01000; /* segment will be destroyed on last detach */
public static final int SHM_LOCKED = 02000; /* segment will not be swapped */
public static final int SHM_HUGETLB = 04000; /* segment is mapped via hugetlb */
public static final int SHM_NORESERVE = 010000;
// Targeting ../linux/shminfo.java


// Targeting ../linux/shm_info.java



// #endif /* __USE_MISC */



// Parsed from sys/shm.h

/* Copyright (C) 1995-1999, 2000, 2002, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

// #ifndef _SYS_SHM_H
public static final int _SYS_SHM_H = 1;

// #include <features.h>

// #define __need_size_t
// #include <stddef.h>

/* Get common definition of System V style IPC. */
// #include <sys/ipc.h>

/* Get system dependent definition of `struct shmid_ds' and more. */
// #include <bits/shm.h>

/* Define types required by the standard. */
// #define __need_time_t
// #include <time.h>

// #ifdef __USE_XOPEN
// # ifndef __pid_t_defined
// # define __pid_t_defined
// # endif
// #endif /* X/Open */


/* The following System V style IPC functions implement a shared memory
facility. The definition is found in XPG4.2. */

/* Shared memory control operation. */
public static native int shmctl(int __shmid, int __cmd, shmid_ds __buf);

/* Get shared memory segment. */
public static native int shmget(@Cast("key_t") int __key, @Cast("size_t") long __size, int __shmflg);

/* Attach shared memory segment. */
public static native Pointer shmat(int __shmid, @Const Pointer __shmaddr, int __shmflg);

/* Detach shared memory segment. */
public static native int shmdt(@Const Pointer __shmaddr);

// #endif /* sys/shm.h */


// Parsed from linux/sysinfo.h

// #ifndef _LINUX_SYSINFO_H
Expand Down
Loading