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 SYS_gettid #209

Merged
merged 1 commit into from
Mar 6, 2016
Merged

Add SYS_gettid #209

merged 1 commit into from
Mar 6, 2016

Conversation

dhylands
Copy link
Contributor

@dhylands dhylands commented Mar 5, 2016

I'm trying to get gettid added (either in libc or nix). We discussed things a bit over here:
nix-rust/nix#293 so I thought I would take a stab at adding the SYS_gettid constant into libc.

Should I also add a gettid function here? Or should that go in nix?

I wasn't sure which variant of MIPS was being used, so I didn't add the constant into the mips.rs. The constants are: 4222 for O32, 5178 for N64 and 6178 for N32. Since it seems to be used for OpenWRT, I'd guess O32.

Should this also be added to musl?

@dhylands dhylands force-pushed the SYS_gettid branch 2 times, most recently from 18895a3 to 32f3134 Compare March 6, 2016 06:10
@alexcrichton
Copy link
Member

Ah yeah feel free to add this to MUSL (it'll pass if it's defined in MUSL), and also feel free to add the gettid function itself (so long as it's in glibc everywhere). Other than that looks good to me, thanks!

@dhylands
Copy link
Contributor Author

dhylands commented Mar 6, 2016

gettid isn't present in glibc, but it is available in the linux kernel, which is the motivation behind adding SYS_gettid. Then it's possible to write:

pub fn gettid() -> pid_t {
    unsafe { syscall(SYS_gettid) }
}

but that needs to go someplace after syscall is defined.

So it would need to go in https://github.com/rust-lang/libc/blob/master/src/unix/notbsd/mod.rs which implies I'd need to do this in android as well.

Does android assume arm?

@alexcrichton
Copy link
Member

Ah yeah for now we don't define functions like this (just bind what's in libc), so let's avoid adding that function for now. Can you rebase this as well? (just merged something else)

@dhylands
Copy link
Contributor Author

dhylands commented Mar 6, 2016

OK - I'll just add SYS_gettid in libc and we can add the gettid function itself in nix.

I'll rebase.

@dhylands
Copy link
Contributor Author

dhylands commented Mar 6, 2016

ok - rebased and added to remaining linux modules. The travis failures I'm seeing don't seem to have anything to do with my commit.

alexcrichton added a commit that referenced this pull request Mar 6, 2016
@alexcrichton alexcrichton merged commit 88396ac into rust-lang:master Mar 6, 2016
@alexcrichton
Copy link
Member

Thanks!

@dhylands dhylands mentioned this pull request Mar 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants