Reduce makefile dependencies by 10%

The includes in libc/calls/calls.h have now been refactored so that
functions with struct parameters are declared in libc/calls/struct/
This commit is contained in:
Justine Tunney 2022-06-08 20:01:28 -07:00
parent 4e7ce1538c
commit adac64a52b
202 changed files with 372 additions and 319 deletions

View file

@ -52,7 +52,7 @@ textwindows int sys_accept_nt(struct Fd *fd, void *addr, uint32_t *addrsize,
if ((!(flags & SOCK_NONBLOCK) ||
__sys_ioctlsocket_nt(h, FIONBIO, (uint32_t[]){1}) != -1) &&
(sockfd2 = calloc(1, sizeof(struct SockFd)))) {
_spinlock(&__fds_lock);
__fds_lock();
if ((client = __reservefd_unlocked(-1)) != -1) {
sockfd2->family = sockfd->family;
sockfd2->type = sockfd->type;
@ -62,10 +62,10 @@ textwindows int sys_accept_nt(struct Fd *fd, void *addr, uint32_t *addrsize,
g_fds.p[client].mode = 0140666;
g_fds.p[client].handle = h;
g_fds.p[client].extra = (uintptr_t)sockfd2;
_spunlock(&__fds_lock);
__fds_unlock();
return client;
}
_spunlock(&__fds_lock);
__fds_unlock();
free(sockfd2);
}
__sys_closesocket_nt(h);

View file

@ -1342,12 +1342,12 @@ static textwindows dontinline int sys_epoll_create1_nt(uint32_t flags) {
__releasefd(fd);
return -1;
}
_spinlock(&__fds_lock);
__fds_lock();
g_fds.p[fd].kind = kFdEpoll;
g_fds.p[fd].handle = ephnd;
g_fds.p[fd].flags = flags;
g_fds.p[fd].mode = 0140666;
_spunlock(&__fds_lock);
__fds_unlock();
return fd;
}

View file

@ -64,13 +64,13 @@ textwindows int sys_socket_nt(int family, int type, int protocol) {
sockfd->family = family;
sockfd->type = truetype;
sockfd->protocol = protocol;
_spinlock(&__fds_lock);
__fds_lock();
g_fds.p[fd].kind = kFdSocket;
g_fds.p[fd].flags = oflags;
g_fds.p[fd].mode = 0140666;
g_fds.p[fd].handle = h;
g_fds.p[fd].extra = (uintptr_t)sockfd;
_spunlock(&__fds_lock);
__fds_unlock();
return fd;
} else {
__releasefd(fd);

View file

@ -56,10 +56,10 @@ textwindows int sys_socketpair_nt(int family, int type, int proto, int sv[2]) {
}
CreatePipeName(pipename);
_spinlock(&__fds_lock);
__fds_lock();
reader = __reservefd_unlocked(-1);
writer = __reservefd_unlocked(-1);
_spunlock(&__fds_lock);
__fds_unlock();
if (reader == -1 || writer == -1) {
if (reader != -1) __releasefd(reader);
if (writer != -1) __releasefd(writer);
@ -76,7 +76,7 @@ textwindows int sys_socketpair_nt(int family, int type, int proto, int sv[2]) {
h1 = CreateFile(pipename, kNtGenericWrite | kNtGenericRead, 0,
&kNtIsInheritable, kNtOpenExisting, kNtFileFlagOverlapped, 0);
_spinlock(&__fds_lock);
__fds_lock();
if (h1 != -1) {
@ -101,7 +101,7 @@ textwindows int sys_socketpair_nt(int family, int type, int proto, int sv[2]) {
rc = -1;
}
_spunlock(&__fds_lock);
__fds_unlock();
return rc;
}

View file

@ -18,6 +18,7 @@
*/
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/dprintf.h"
#include "libc/calls/weirdtypes.h"
#include "libc/dce.h"
#include "libc/errno.h"
@ -229,7 +230,9 @@ void vsyslog(int priority, const char *message, va_list ap) {
++log_id;
}
if (log_opt & LOG_PERROR) dprintf(2, "%.*s", l - hlen, buf + hlen);
if (log_opt & LOG_PERROR) {
dprintf(2, "%.*s", l - hlen, buf + hlen);
}
}
}