summaryrefslogtreecommitdiff
path: root/src/runtime/amd64_darwin.h
blob: 45174cb42aed634328fdd2f589f60afd8b217665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright 2009 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

/*
 *  System structs for Darwin, amd64
 */

typedef uint32 dev_t;
typedef uint64 ino_t;
typedef uint16 mode_t;
typedef uint16 nlink_t;
typedef uint32 uid_t;
typedef uint32 gid_t;
typedef int64 off_t;
typedef int32 blksize_t;
typedef int64 blkcnt_t;
typedef int64 time_t;

struct timespec {
	time_t tv_sec;
	int64 tv_nsec;
};

struct timeval {
	time_t tv_sec;
	int64 tv_usec;
};

struct stat {	// really a stat64
	dev_t st_dev;
	mode_t st_mode;
	nlink_t st_nlink;
	ino_t st_ino;
	uid_t st_uid;
	gid_t st_gid;
	dev_t st_rdev;
	struct timespec st_atimespec;
	struct timespec st_mtimespec;
	struct timespec st_ctimespec;
	struct timespec st_birthtimespec;
	off_t st_size;
	blkcnt_t st_blocks;
	blksize_t st_blksize;
	uint32 st_flags;
	uint32 st_gen;
 	int64 st_qspare[2];
};

#define	O_CREAT	0x0200

void bsdthread_create(void*, M*, G*, void(*)(void));
void bsdthread_register(void);


// Mach calls

typedef int32 kern_return_t;
typedef uint32 mach_port_t;

mach_port_t semcreate(void);
void semacquire(mach_port_t);
void semrelease(mach_port_t);
void semreset(mach_port_t);
void semdestroy(mach_port_t);