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

feat: add openharmony header #22109

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ zig-out/
/build/
/build-*/
/docgen_tmp/
.DS_Store
richerfu marked this conversation as resolved.
Show resolved Hide resolved

# Although this was renamed to .zig-cache, let's leave it here for a few
# releases to make it less annoying to work with multiple branches.
Expand Down
18 changes: 18 additions & 0 deletions lib/libc/include/aarch64-linux-ohos/bits/stat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
unsigned long __pad;
off_t st_size;
blksize_t st_blksize;
int __pad2;
blkcnt_t st_blocks;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
unsigned __unused1[2];
};
51 changes: 51 additions & 0 deletions lib/libc/include/generic-ohos/aio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef _AIO_H
#define _AIO_H

#ifdef __cplusplus
extern "C" {
#endif

#include <features.h>
#include <signal.h>
#include <time.h>

#define __NEED_ssize_t
#define __NEED_off_t

#include <bits/alltypes.h>

struct aiocb {
int aio_fildes, aio_lio_opcode, aio_reqprio;
volatile void *aio_buf;
size_t aio_nbytes;
struct sigevent aio_sigevent;
void *__td;
int __lock[2];
volatile int __err;
ssize_t __ret;
off_t aio_offset;
void *__next, *__prev;
char __dummy4[32-2*sizeof(void *)];
};

#define AIO_CANCELED 0
#define AIO_NOTCANCELED 1
#define AIO_ALLDONE 2

#define LIO_READ 0
#define LIO_WRITE 1
#define LIO_NOP 2

#define LIO_WAIT 0
#define LIO_NOWAIT 1

#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define aiocb64 aiocb
#define off64_t off_t
#endif

#ifdef __cplusplus
}
#endif

#endif
17 changes: 17 additions & 0 deletions lib/libc/include/generic-ohos/alloca.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef _ALLOCA_H
#define _ALLOCA_H

#ifdef __cplusplus
extern "C" {
#endif

#define __NEED_size_t
#include <bits/alltypes.h>

#define alloca __builtin_alloca

#ifdef __cplusplus
}
#endif

#endif
36 changes: 36 additions & 0 deletions lib/libc/include/generic-ohos/arpa/inet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef _ARPA_INET_H
#define _ARPA_INET_H

#ifdef __cplusplus
extern "C" {
#endif

#include <features.h>
#include <netinet/in.h>

uint32_t htonl(uint32_t);
uint16_t htons(uint16_t);
uint32_t ntohl(uint32_t);
uint16_t ntohs(uint16_t);

in_addr_t inet_addr (const char *);
in_addr_t inet_network (const char *);
char *inet_ntoa (struct in_addr);
int inet_pton (int, const char *__restrict, void *__restrict);
const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);

int inet_aton (const char *, struct in_addr *);
struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
in_addr_t inet_lnaof(struct in_addr);
in_addr_t inet_netof(struct in_addr);

#undef INET_ADDRSTRLEN
#undef INET6_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46

#ifdef __cplusplus
}
#endif

#endif
Loading