14 changes: 14 additions & 0 deletions libc/include/llvm-libc-types/__sighandler_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===-- Definition of struct __sighandler_t -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_SIGHANDLER_T_H__
#define __LLVM_LIBC_TYPES_SIGHANDLER_T_H__

typedef void (*__sighandler_t)(int);

#endif // __LLVM_LIBC_TYPES_SIGHANDLER_T_H__
21 changes: 21 additions & 0 deletions libc/include/llvm-libc-types/cnd_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Definition of cnd_t type ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_CND_T_H__
#define __LLVM_LIBC_TYPES_CND_T_H__

typedef struct {
void *__qfront;
void *__qback;
struct {
unsigned char __w[4];
int __t;
} __qmtx;
} cnd_t;

#endif // __LLVM_LIBC_TYPES_CND_T_H__
17 changes: 17 additions & 0 deletions libc/include/llvm-libc-types/div_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//===-- Definition of type div_t ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_DIV_T_H__
#define __LLVM_LIBC_TYPES_DIV_T_H__

typedef struct {
int quot;
int rem;
} div_t;

#endif // __LLVM_LIBC_TYPES_DIV_T_H__
25 changes: 25 additions & 0 deletions libc/include/llvm-libc-types/fenv_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//===-- Definition of type fenv_t -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_FENV_T_H__
#define __LLVM_LIBC_TYPES_FENV_T_H__

#ifdef __aarch64__
typedef struct {
unsigned char __control_word[4];
unsigned char __status_word[4];
} fenv_t;
#endif
#ifdef __x86_64__
typedef struct {
unsigned char __x86_status[28];
unsigned char __mxcsr[4];
} fenv_t;
#endif

#endif // __LLVM_LIBC_TYPES_FENV_T_H__
14 changes: 14 additions & 0 deletions libc/include/llvm-libc-types/fexcept_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===-- Definition of fexcept_t type --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_FEXCEPT_T_H__
#define __LLVM_LIBC_TYPES_FEXCEPT_T_H__

typedef int fexcept_t;

#endif // __LLVM_LIBC_TYPES_FEXCEPT_T_H__
17 changes: 17 additions & 0 deletions libc/include/llvm-libc-types/imaxdiv_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//===-- Definition of type imaxdiv_t --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_IMAXDIV_T_H__
#define __LLVM_LIBC_TYPES_IMAXDIV_T_H__

typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;

#endif // __LLVM_LIBC_TYPES_IMAXDIV_T_H__
17 changes: 17 additions & 0 deletions libc/include/llvm-libc-types/ldiv_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//===-- Definition of type ldiv_t -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_LDIV_T_H__
#define __LLVM_LIBC_TYPES_LDIV_T_H__

typedef struct {
long quot;
long rem;
} ldiv_t;

#endif // __LLVM_LIBC_TYPES_LDIV_T_H__
17 changes: 17 additions & 0 deletions libc/include/llvm-libc-types/lldiv_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//===-- Definition of type lldiv_t ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_LLDIV_T_H__
#define __LLVM_LIBC_TYPES_LLDIV_T_H__

typedef struct {
long long quot;
long long rem;
} lldiv_t;

#endif // __LLVM_LIBC_TYPES_LLDIV_T_H__
17 changes: 17 additions & 0 deletions libc/include/llvm-libc-types/mtx_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//===-- Definition of mtx_t type ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_MTX_T_H__
#define __LLVM_LIBC_TYPES_MTX_T_H__

typedef struct {
unsigned char __internal_data[4];
int __mtx_type;
} mtx_t;

#endif // __LLVM_LIBC_TYPES_MTX_T_H__
14 changes: 14 additions & 0 deletions libc/include/llvm-libc-types/once_flag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===-- Definition of once_flag type --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_ONCE_FLAG_H__
#define __LLVM_LIBC_TYPES_ONCE_FLAG_H__

typedef unsigned int once_flag;

#endif // __LLVM_LIBC_TYPES_ONCE_FLAg_H__
14 changes: 14 additions & 0 deletions libc/include/llvm-libc-types/thrd_start_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===-- Definition of thrd_start_t type -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_THRD_START_T_H__
#define __LLVM_LIBC_TYPES_THRD_START_T_H__

typedef int (*thrd_start_t)(void *);

#endif // __LLVM_LIBC_TYPES_THRD_START_T_H__
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//===-- Linux specific definitions of types from threads.h ----------------===//
//===-- Definition of thrd_t type -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

%%begin()
#ifndef __LLVM_LIBC_TYPES_THRD_T_H__
#define __LLVM_LIBC_TYPES_THRD_T_H__

typedef struct {
unsigned char __clear_tid[4];
Expand All @@ -15,3 +16,5 @@ typedef struct {
int __stack_size;
int __retval;
} thrd_t;

#endif // __LLVM_LIBC_TYPES_THRD_T_H__
14 changes: 14 additions & 0 deletions libc/include/llvm-libc-types/time_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===-- Definition of the type time_t -------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_TIME_T_H__
#define __LLVM_LIBC_TYPES_TIME_T_H__

typedef long time_t;

This comment has been minimized.

Copy link
@lygstate

lygstate Sep 18, 2022

Contributor

@michaelrj-google
This should be typedef int64_t time_t;

This comment has been minimized.

Copy link
@michaelrj-google

michaelrj-google Sep 19, 2022

Contributor

The standard doesn't specify the actual type of time_t, other than that it's some form of signed integer (usually 32 or 64 bits). If you have a specific reason to change this then I'm not particularly opposed, but you should probably bring it up on the discourse: https://discourse.llvm.org/.


#endif // __LLVM_LIBC_TYPES_TIME_T_H__
24 changes: 24 additions & 0 deletions libc/include/llvm-libc-types/tm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===-- Definition of struct tm -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_TYPES_TM_H__
#define __LLVM_LIBC_TYPES_TM_H__

struct tm {
int tm_sec; // seconds after the minute
int tm_min; // minutes after the hour
int tm_hour; // hours since midnight
int tm_mday; // day of the month
int tm_mon; // months since January
int tm_year; // years since 1900
int tm_wday; // days since Sunday
int tm_yday; // days since January
int tm_isdst; // Daylight Saving Time flag
};

#endif // __LLVM_LIBC_TYPES_TM_H__
2 changes: 0 additions & 2 deletions libc/include/threads.h.def
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

#include <__llvm-libc-common.h>

%%include_file(${platform_threads})

%%public_api()

#endif // LLVM_LIBC_THREADS_H