Skip to content

Commit

Permalink
support cosmocc
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Aug 20, 2024
1 parent 5672fa9 commit f1afce7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/tbox/platform/posix/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,11 @@ tb_long_t tb_file_preadv(tb_file_ref_t file, tb_iovec_t const* list, tb_size_t s

// read it
#ifdef TB_CONFIG_POSIX_HAVE_PREADV
# ifdef __COSMOPOLITAN__
return preadv(tb_file2fd(file), (struct iovec*)list, size, offset);
# else
return preadv(tb_file2fd(file), (struct iovec const*)list, size, offset);
# endif
#else

// FIXME: lock it
Expand Down
2 changes: 1 addition & 1 deletion src/tbox/platform/posix/poller_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <poll.h>
#include <fcntl.h>
#include <errno.h>
#if defined(TB_CONFIG_OS_HAIKU)
#if defined(TB_CONFIG_OS_HAIKU) || defined(__COSMOPOLITAN__)
# include <unistd.h>
#elif !defined(TB_CONFIG_OS_ANDROID)
# include <sys/unistd.h>
Expand Down
2 changes: 2 additions & 0 deletions src/tbox/platform/posix/sockaddr.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ static __tb_inline__ tb_size_t tb_sockaddr_save(tb_ipaddr_ref_t ipaddr, struct
size = sizeof(struct sockaddr_in);
}
break;
#ifndef __COSMOPOLITAN__
case AF_INET6:
{
// the ipv6 ipaddr
Expand Down Expand Up @@ -127,6 +128,7 @@ static __tb_inline__ tb_size_t tb_sockaddr_save(tb_ipaddr_ref_t ipaddr, struct
size = sizeof(struct sockaddr_in6);
}
break;
#endif
case AF_UNIX:
{
tb_sockaddr_un_ref_t addru = (tb_sockaddr_un_ref_t)saddr;
Expand Down

0 comments on commit f1afce7

Please sign in to comment.