-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Restore 'struct ld_info' and related types for AIX #4578
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
Conversation
82912ea
to
24405fa
Compare
src/unix/aix/powerpc64.rs
Outdated
@@ -327,6 +394,127 @@ cfg_if! { | |||
self.__si_flags.hash(state); | |||
} | |||
} | |||
|
|||
impl PartialEq for _kernel_simple_lock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We aren't adding PartialEq
traits anymore, since they are planned to be remove in 1.0 (trivial unsoundness). These can just be dropped.
Some more info at #3880
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed them, thanks!
Are these PartialEq
s needed when cherry-picking this patch to the stable branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I missed part of my sentence; we aren't doing PartialEq
or the other traits (Eq
, Hash
) so they can all be removed. (Does this actually build in its current state with Eq
but not PartialEq
?)
Are these
PartialEq
s needed when cherry-picking this patch to the stable branch?
They aren't, basically everything new should follow the 1.0 rules so this is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, and thanks for the clarification! I’ve removed Eq
and Hash
as well. The code builds with Eq
and Hash
without PartialEq
, but having Debug
fails the build.
src/unix/aix/powerpc64.rs
Outdated
pub struct fileops_t { | ||
pub fo_rw: extern "C" fn( | ||
file: *mut file, | ||
rw: crate::uio_rw, | ||
io: *mut c_void, | ||
ext: c_long, | ||
secattr: *mut c_void, | ||
) -> c_int, | ||
pub fo_ioctl: extern "C" fn( | ||
file: *mut file, | ||
a: c_long, | ||
b: crate::caddr_t, | ||
c: c_long, | ||
d: c_long, | ||
) -> c_int, | ||
pub fo_select: | ||
extern "C" fn(file: *mut file, a: c_int, b: *mut c_ushort, c: extern "C" fn()) -> c_int, | ||
pub fo_close: extern "C" fn(file: *mut file) -> c_int, | ||
pub fo_fstat: extern "C" fn(file: *mut file, sstat: *mut crate::stat) -> c_int, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the function pointers here ever null? They may need to be Option<fn(...)>
Also, are the headers/docs for any of these structs public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find the sys/file.h
header file online. It’s only mentioned in the AIX 7.3 documentation under t List of Major Control Block Header Files. The header is installed by default on AIX systems.
It seems that struct fileops
defines the file operations for an open file or pipe. I'm not completely sure whether its function pointers can ever be NULL, but I suppose using Option<fn(...)>
in Rust is a safe choice. Thanks for the guidance!
struct fileops
and struct file
are guarded under macro _KERNEL
.
typedef struct fileops
{
int (*fo_rw)(struct file *, enum uio_rw, struct uio *,
ext_t, file_secattr_t *);
int (*fo_ioctl)(struct file *, long, caddr_t, ext_t, long);
int (*fo_select)(struct file *, int, ushort, ushort *, void (*)());
int (*fo_close)(struct file *);
int (*fo_fstat)(struct file *, struct stat *);
} fileops_t;
...
/* One file structure is allocated for each open/creat/pipe call. Main use is
* to hold the read/write pointer associated with each open file.
*
* Portions of this structure are overlaid when placed on the freelist.
* Binary compatibility concerns require that fields *not* be rearranged for
* sanity.
*/
__align(256) struct file {
long f_flag; /* see fcntl.h for definitions */
int f_count; /* reference count */
short f_options; /* file flags not passed through vnode layer */
short f_type; /* descriptor type */
/* The following fields are overloaded when the file struct is freed,
* except for the locks which must remain static. See struct freefile.
*/
struct vnode *f_data; /* pointer to vnode struct */
#define f_vnode f_data
offset_t f_offset; /* read/write character pointer */
off_t f_dir_off; /* BSD style dir offsets */
struct ucred *f_cred; /* process cred at open */
Simple_lock f_lock; /* file structure fields lock */
Simple_lock f_offset_lock; /* file structure offset field lock */
caddr_t f_vinfo; /* any info vfs needs */
fileops_t *f_ops; /* operations vector */
caddr_t f_parentp; /* the file's parent vnode or fid */
caddr_t f_fnamep; /* fname pointer, may be embedded */
char f_fdata[F_FDATASZ];/* embedded file data, pad to 256 */
};
There is a description of struct ld_info
.
95ed722
to
c10873a
Compare
One more request at #4578 (comment) then lgtm |
(backport <rust-lang#4578>) (cherry picked from commit 925eb0c)
Description
struct ld_info
and related types are used by the AIX system callloadquery()
. This patch reintroduces them with adjustments to pass CI.Sources
Checklist
libc-test/semver
have been updated*LAST
or*MAX
areincluded (see #3131)
cd libc-test && cargo test --target mytarget
);especially relevant for platforms that may not be checked in CI