mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-14 06:59:10 +00:00
Make minor improvements
This commit is contained in:
parent
1fc91f3580
commit
b562d6fdb3
41 changed files with 1948 additions and 92 deletions
28
libc/calls/getsid.c
Normal file
28
libc/calls/getsid.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program 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 │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
|
||||
/**
|
||||
* Creates session and sets the process group id.
|
||||
*/
|
||||
uint32_t getsid(int pid) {
|
||||
return getsid$sysv(pid);
|
||||
}
|
|
@ -180,8 +180,10 @@ i64 write$sysv(i32, const void *, u64) hidden;
|
|||
int getitimer$sysv(i32, struct itimerval *) hidden;
|
||||
int setresgid$sysv(uint32_t, uint32_t, uint32_t) hidden;
|
||||
int setresuid$sysv(uint32_t, uint32_t, uint32_t) hidden;
|
||||
int setsid$sysv(void) hidden;
|
||||
u32 getgid$sysv(void) hidden;
|
||||
u32 getpid$sysv(void) hidden;
|
||||
u32 getsid$sysv(int) hidden;
|
||||
u32 gettid$sysv(void) hidden;
|
||||
u32 getuid$sysv(void) hidden;
|
||||
void *mmap$sysv(void *, u64, u32, u32, i64, i64) hidden;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
/ @see setgid(), getauxval(AT_SECURE)
|
||||
setegid:push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov %edi,%esi
|
||||
mov $-1,%edi
|
||||
call setregid
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
/ @see setuid(), getauxval(AT_SECURE)
|
||||
seteuid:push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov %edi,%esi
|
||||
mov $-1,%edi
|
||||
call setreuid
|
||||
|
|
28
libc/calls/setsid.c
Normal file
28
libc/calls/setsid.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program 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 │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
|
||||
/**
|
||||
* Creates session and sets the process group id.
|
||||
*/
|
||||
int setsid(void) {
|
||||
return setsid$sysv();
|
||||
}
|
|
@ -34,20 +34,15 @@
|
|||
__sigenter:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
push %rbx
|
||||
push %rbx
|
||||
ezlea _base,bx
|
||||
.profilable
|
||||
ezlea g_sighandrvas,ax
|
||||
and $NSIG-1,%edi
|
||||
mov (%rax,%rdi,4),%eax
|
||||
mov g_sighandrvas(,%rdi,4),%eax
|
||||
cmp $kSigactionMinRva,%eax
|
||||
jl 2f
|
||||
add %rbx,%rax
|
||||
lea _base(%rax),%eax
|
||||
call *%rax
|
||||
mov $1,%eax
|
||||
1: pop %rbx
|
||||
leave
|
||||
1: leave
|
||||
ret
|
||||
2: xor %eax,%eax
|
||||
jmp 1b
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue