vsql-node 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +203 -2
  3. package/binding.gyp +44 -0
  4. package/index.d.ts +133 -0
  5. package/internal/amalgamation/LICENSE +21 -0
  6. package/internal/amalgamation/LICENSE-V +21 -0
  7. package/internal/amalgamation/afunix.h +26 -0
  8. package/internal/amalgamation/atomic.h +571 -0
  9. package/internal/amalgamation/core_windows.c +25 -0
  10. package/internal/amalgamation/core_windows.h +9 -0
  11. package/internal/amalgamation/execute_capture_nix.c +7 -0
  12. package/internal/amalgamation/execute_capture_nix.h +266 -0
  13. package/internal/amalgamation/gc/cord.h +426 -0
  14. package/internal/amalgamation/gc/cord_pos.h +151 -0
  15. package/internal/amalgamation/gc/ec.h +91 -0
  16. package/internal/amalgamation/gc/gc.h +2826 -0
  17. package/internal/amalgamation/gc/gc_allocator.h +480 -0
  18. package/internal/amalgamation/gc/gc_backptr.h +109 -0
  19. package/internal/amalgamation/gc/gc_config_macros.h +548 -0
  20. package/internal/amalgamation/gc/gc_disclaim.h +85 -0
  21. package/internal/amalgamation/gc/gc_gcj.h +123 -0
  22. package/internal/amalgamation/gc/gc_inline.h +261 -0
  23. package/internal/amalgamation/gc/gc_mark.h +516 -0
  24. package/internal/amalgamation/gc/gc_pthread_redirects.h +140 -0
  25. package/internal/amalgamation/gc/gc_tiny_fl.h +107 -0
  26. package/internal/amalgamation/gc/gc_typed.h +196 -0
  27. package/internal/amalgamation/gc/gc_version.h +55 -0
  28. package/internal/amalgamation/gc/javaxfc.h +76 -0
  29. package/internal/amalgamation/gc/leak_detector.h +120 -0
  30. package/internal/amalgamation/gc.c +45932 -0
  31. package/internal/amalgamation/gc.h +4 -0
  32. package/internal/amalgamation/gc_boehm_helpers.c +64 -0
  33. package/internal/amalgamation/gc_debugger_linux.h +61 -0
  34. package/internal/amalgamation/getrandom_linux.h +33 -0
  35. package/internal/amalgamation/ipv6_v6only.h +5 -0
  36. package/internal/amalgamation/libvsql.c +27 -0
  37. package/internal/amalgamation/libvsql.h +1772 -0
  38. package/internal/amalgamation/libvsql_linux_amd64.c +106591 -0
  39. package/internal/amalgamation/libvsql_linux_arm64.c +106571 -0
  40. package/internal/amalgamation/libvsql_macos_amd64.c +106728 -0
  41. package/internal/amalgamation/libvsql_macos_arm64.c +106708 -0
  42. package/internal/amalgamation/libvsql_windows_amd64.c +108235 -0
  43. package/internal/amalgamation/segfault_handler_nix.c +56 -0
  44. package/internal/amalgamation/segfault_handler_nix.h +449 -0
  45. package/internal/amalgamation/segfault_handler_windows.h +52 -0
  46. package/internal/amalgamation/thread_helper.c +12 -0
  47. package/internal/amalgamation/thread_helper.h +96 -0
  48. package/internal/amalgamation/ticks_windows.c +3 -0
  49. package/internal/amalgamation/ticks_windows.h +31 -0
  50. package/internal/amalgamation/ticks_windows_api.h +6 -0
  51. package/internal/amalgamation/vsql_runtime.c +14 -0
  52. package/internal/amalgamation/vsql_runtime_linux.c +6 -0
  53. package/internal/amalgamation/vsql_runtime_macos.c +6 -0
  54. package/internal/amalgamation/vsql_runtime_windows.c +6 -0
  55. package/lib/binding.js +13 -0
  56. package/lib/connection.js +492 -0
  57. package/lib/convert.js +213 -0
  58. package/lib/errors.js +17 -0
  59. package/lib/index.js +41 -0
  60. package/libvsql_flags.gypi +30 -0
  61. package/package.json +45 -4
  62. package/src/binding.c +773 -0
  63. package/src/runtime.c +20 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Elliot Chance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,204 @@
1
- # Temporary Holding Version
1
+ # vsql-node
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Node.js driver for [vsql](https://github.com/elliotchance/vsql), a single
4
+ file or in-memory SQL database. libvsql (the vsql library) is compiled into the
5
+ package, so there's nothing else to install.
6
+
7
+ ```sh
8
+ npm install vsql-node
9
+ ```
10
+
11
+ ```js
12
+ const vsql = require('vsql-node');
13
+
14
+ const db = vsql.connect('test.vsql');
15
+ db.run('CREATE TABLE foo (x INTEGER)');
16
+ db.run('INSERT INTO foo (x) VALUES (?)', [123]);
17
+ console.log(db.all('SELECT x FROM foo')); // [ { X: 123 } ]
18
+ db.close();
19
+ ```
20
+
21
+ The database is the path of the file (it's created if it doesn't exist), or
22
+ `:memory:` for a database that only exists for the life of the connection.
23
+
24
+ See [example/main.js](example/main.js) for a complete program:
25
+
26
+ ```sh
27
+ node example/main.js
28
+ ```
29
+
30
+ ## API
31
+
32
+ The API is synchronous: each call runs vsql on the calling thread, and returns
33
+ when it's finished (like `node:sqlite` and better-sqlite3). To run queries at
34
+ the same time, use a connection in each
35
+ [worker thread](https://nodejs.org/api/worker_threads.html).
36
+
37
+ | Connection | Statement | |
38
+ |---------------------------------|---------------------------|-----------------------------------------------------|
39
+ | `db.prepare(sql)` | | Prepares a statement |
40
+ | `db.run(sql, params)` | `stmt.run(params)` | Executes a statement, returns `{ changes }` |
41
+ | `db.get(sql, params)` | `stmt.get(params)` | The first row of a query, or `undefined` |
42
+ | `db.all(sql, params)` | `stmt.all(params)` | All the rows of a query |
43
+ | `db.iterate(sql, params)` | `stmt.iterate(params)` | An iterator of the rows, fetched one at a time |
44
+ | | `stmt.columns()` | The name, type, nullability, length, precision and scale of each column |
45
+ | | `stmt.raw()` | Each row is an array instead of an object |
46
+ | `db.close()` | `stmt.close()` | Frees the connection or statement |
47
+
48
+ Each row is an object keyed by the column names, which vsql uppercases unless
49
+ they're quoted (`SELECT x` is `{ X: ... }`). Use `stmt.raw()` when columns have
50
+ the same name.
51
+
52
+ A statement that hasn't been closed is freed when it's garbage collected, as is
53
+ a connection (which rolls back its transaction). Both can be declared with
54
+ `using` (on Node 24 or later).
55
+
56
+ ## Transactions
57
+
58
+ Each statement is committed when it finishes, or when all the rows of a query
59
+ have been fetched (or the iterator is left). `db.begin()` starts a transaction,
60
+ which is ended by `db.commit()` or `db.rollback()` (closing the connection rolls
61
+ it back). `db.transaction(fn)` calls `fn` in a transaction, which is committed
62
+ when it returns, or rolled back if it throws:
63
+
64
+ ```js
65
+ const insert = db.prepare('INSERT INTO foo (x) VALUES (?)');
66
+ db.transaction(() => {
67
+ for (const x of [1, 2, 3]) {
68
+ insert.run([x]);
69
+ }
70
+ });
71
+ ```
72
+
73
+ Ending a transaction closes the rows of its queries, which finishes their
74
+ iterators. `START TRANSACTION`, `COMMIT` and `ROLLBACK` can't be executed as
75
+ statements.
76
+
77
+ vsql's transactions are `READ COMMITTED`.
78
+
79
+ ## Parameters
80
+
81
+ Parameters are `?`, given as an array. Each JavaScript type is sent as an SQL
82
+ type, which is cast to the type it's used as:
83
+
84
+ | JavaScript | SQL |
85
+ |--------------------------|--------------------------------------------------------|
86
+ | `null`, `undefined` | `NULL` |
87
+ | `boolean` | `BOOLEAN` |
88
+ | `number` | `BIGINT` if it's a safe integer, otherwise `DOUBLE PRECISION` |
89
+ | `bigint` | `BIGINT` (`NUMERIC` if it's out of range) |
90
+ | `string` | `CHARACTER VARYING` |
91
+ | `Date` | `TIMESTAMP(3) WITH TIME ZONE` (in UTC) |
92
+ | `vsql.numeric(value)` | `NUMERIC` |
93
+ | `vsql.date(value)` | `DATE` |
94
+ | `vsql.time(value)` | `TIME` (`WITH TIME ZONE` if it has an offset) |
95
+ | `vsql.timestamp(value)` | `TIMESTAMP` (`WITH TIME ZONE` if it has an offset) |
96
+
97
+ vsql doesn't cast a `CHARACTER VARYING` to a number, date or time, so a string
98
+ can't be a parameter for those types. Instead, use `vsql.numeric` (from a
99
+ string such as `"-12.50"`, a number or a bigint), `vsql.date`
100
+ (`"YYYY-MM-DD"`), `vsql.time` (`"HH:MM:SS"`) or `vsql.timestamp`
101
+ (`"YYYY-MM-DD HH:MM:SS"`), which take the strings that the columns of those
102
+ types are, so a value can be read and written back:
103
+
104
+ ```js
105
+ db.run('INSERT INTO events (at, price) VALUES (?, ?)', [
106
+ vsql.timestamp('2024-01-02 15:04:05.123456+05:30'),
107
+ vsql.numeric('9.99'),
108
+ ]);
109
+ ```
110
+
111
+ Times and timestamps have up to 6 fractional digits, and an optional offset
112
+ (`+05:30`, `+0530` or `Z`).
113
+
114
+ vsql doesn't have a binary type, so a `Buffer` can't be a parameter.
115
+
116
+ ## Columns
117
+
118
+ | SQL | JavaScript |
119
+ |-------------------------------------|----------------------------------------|
120
+ | `SMALLINT`, `INTEGER` | `number` |
121
+ | `BIGINT` | `number` (`bigint` with `{ bigint: true }`) |
122
+ | `REAL`, `DOUBLE PRECISION` | `number` |
123
+ | `DECIMAL`, `NUMERIC` | `string`, such as `"12.50"` |
124
+ | `CHARACTER`, `VARCHAR` | `string` |
125
+ | `BOOLEAN` | `boolean` |
126
+ | `DATE` | `string`, such as `"2024-01-02"` |
127
+ | `TIME` | `string`, such as `"15:04:05.123456"` |
128
+ | `TIME WITH TIME ZONE` | `string`, such as `"15:04:05+05:30"` |
129
+ | `TIMESTAMP` | `string`, such as `"2024-01-02T15:04:05.123456"` |
130
+ | `TIMESTAMP WITH TIME ZONE` | `string`, such as `"2024-01-02T15:04:05.123456+05:30"` |
131
+
132
+ A `NULL` is `null`. Decimals, dates and times are strings, so that no precision
133
+ is lost. A timestamp is in ISO 8601, so one `WITH TIME ZONE` can be given to
134
+ `new Date()`.
135
+
136
+ A `BIGINT` is a `number`, and a `RangeError` if it's out of the range that a
137
+ number can hold exactly (±2<sup>53</sup> - 1). With
138
+ `vsql.connect(..., { bigint: true })`, it's always a `bigint`.
139
+
140
+ ## Errors
141
+
142
+ An error from vsql is a `vsql.VsqlError`, with its SQLSTATE as `sqlstate` (and
143
+ `code`):
144
+
145
+ ```js
146
+ try {
147
+ db.all('SELECT * FROM nope');
148
+ } catch (e) {
149
+ if (e instanceof vsql.VsqlError) {
150
+ console.log(e.sqlstate); // 42P01
151
+ }
152
+ }
153
+ ```
154
+
155
+ An error from the driver itself (such as using a closed connection, or a value
156
+ that can't be a parameter) is a `TypeError` or `RangeError`.
157
+
158
+ ## Threads
159
+
160
+ Each connection has its own libvsql environment, so connections in different
161
+ worker threads can be used at the same time. Connections to the same file
162
+ share a lock.
163
+
164
+ On Linux, libvsql's garbage collector uses `SIGPWR` and `SIGXCPU` to stop
165
+ threads, so don't listen for them with `process.on`.
166
+
167
+ ## Requirements
168
+
169
+ Node 22 or later. The addon is prebuilt for macOS (ARM64 and x86-64), Linux
170
+ (ARM64 and x86-64, with glibc 2.29 or later) and Windows (x86-64), so npm
171
+ doesn't need to compile anything. It uses Node-API, so the same prebuild works
172
+ for every version of Node.
173
+
174
+ Otherwise (such as with musl, on Alpine), it's compiled when it's installed,
175
+ which needs Python and a C compiler (see
176
+ [node-gyp](https://github.com/nodejs/node-gyp#installation)), and takes about
177
+ 30 seconds. On Windows, it needs the "C++ Clang tools for Windows" component of
178
+ Visual Studio, since the C that V generates doesn't compile with MSVC.
179
+
180
+ ## Development
181
+
182
+ ```sh
183
+ npm install # compiles the addon into build/Release
184
+ npm test
185
+ ```
186
+
187
+ ### Updating vsql
188
+
189
+ `internal/amalgamation` is the libvsql C from a vsql release
190
+ (`vsql-VERSION-amalgamation.zip`). To update it to the latest release:
191
+
192
+ ```sh
193
+ scripts/update-amalgamation.sh
194
+ npm run build && npm test
195
+ ```
196
+
197
+ Or give a version (`scripts/update-amalgamation.sh v1.2.3`), or a zip that has
198
+ already been downloaded.
199
+
200
+ ### Releasing
201
+
202
+ Publishing a GitHub release (with a tag such as `v1.2.3`) publishes the
203
+ package to npm, with the prebuilds from
204
+ [release.yml](.github/workflows/release.yml).
package/binding.gyp ADDED
@@ -0,0 +1,44 @@
1
+ # binding.gyp builds the vsql addon (src/binding.c), which compiles libvsql from
2
+ # the amalgamation in internal/amalgamation (see scripts/update-amalgamation.sh)
3
+ # with the defines and libraries that V used for each OS and architecture
4
+ # (libvsql_flags.gypi).
5
+ {
6
+ 'includes': ['libvsql_flags.gypi'],
7
+ 'targets': [
8
+ {
9
+ 'target_name': 'vsql',
10
+ 'sources': [
11
+ 'src/binding.c',
12
+ 'src/runtime.c',
13
+ 'internal/amalgamation/libvsql.c',
14
+ ],
15
+ 'include_dirs': ['internal/amalgamation'],
16
+ 'defines': ['NAPI_VERSION=8'],
17
+ 'conditions': [
18
+ ['OS=="win"', {
19
+ # The C that V generates uses GNU C (such as statement expressions),
20
+ # which MSVC can't compile, so it's compiled with clang-cl instead.
21
+ # The rest of MSVC (the linker and the headers) is still used.
22
+ 'msbuild_toolset': 'ClangCL',
23
+ 'msvs_settings': {
24
+ 'VCCLCompilerTool': {
25
+ 'AdditionalOptions': ['/w'],
26
+ # Node's common.gypi gives the C++ standard to every file, which
27
+ # clang-cl doesn't allow for C.
28
+ 'AdditionalOptions/': [['exclude', '^[-/]std:c\\+\\+']],
29
+ },
30
+ },
31
+ }, {
32
+ # The C that V generates for Linux passes a pthread_t as a void*,
33
+ # which is an error from GCC 14 unless -Wno-int-conversion is given.
34
+ 'cflags': ['-w', '-Wno-int-conversion'],
35
+ 'cflags_c': ['-std=gnu11'],
36
+ 'xcode_settings': {
37
+ 'GCC_C_LANGUAGE_STANDARD': 'gnu11',
38
+ 'OTHER_CFLAGS': ['-w', '-Wno-int-conversion'],
39
+ },
40
+ }],
41
+ ],
42
+ },
43
+ ],
44
+ }
package/index.d.ts ADDED
@@ -0,0 +1,133 @@
1
+ // The types of vsql-node (lib/index.js). See the README for how each SQL type
2
+ // is converted.
3
+
4
+ /** A value that can be a parameter. */
5
+ export type Parameter =
6
+ | null
7
+ | undefined
8
+ | boolean
9
+ | number
10
+ | bigint
11
+ | string
12
+ | Date
13
+ | SqlValue;
14
+
15
+ /** A column's value. A BIGINT is a bigint with { bigint: true }. */
16
+ export type Value = null | boolean | number | bigint | string;
17
+
18
+ /** A row, keyed by the column names (or an array, see Statement.raw). */
19
+ export type Row = Record<string, Value>;
20
+
21
+ export interface ConnectOptions {
22
+ /** A BIGINT column is a bigint, instead of a number. */
23
+ bigint?: boolean;
24
+ }
25
+
26
+ export interface Column {
27
+ name: string;
28
+ /** The SQL type, such as "INTEGER" or "CHARACTER VARYING". */
29
+ type: string;
30
+ nullable: boolean;
31
+ /** The maximum length of a CHARACTER or CHARACTER VARYING. */
32
+ length: number | null;
33
+ /** The precision of a DECIMAL or NUMERIC. */
34
+ precision: number | null;
35
+ /** The scale of a DECIMAL or NUMERIC. */
36
+ scale: number | null;
37
+ }
38
+
39
+ export interface RunResult {
40
+ /** The number of rows that were inserted, updated or deleted. */
41
+ changes: number;
42
+ }
43
+
44
+ /**
45
+ * Opens a connection to a database file (which is created if it doesn't
46
+ * exist), or ":memory:" for a database that only exists for the life of the
47
+ * connection.
48
+ */
49
+ export function connect(database: string, options?: ConnectOptions): Connection;
50
+
51
+ export class Connection {
52
+ private constructor();
53
+
54
+ /** The database, as given to connect. */
55
+ readonly name: string;
56
+ readonly bigint: boolean;
57
+ readonly open: boolean;
58
+ readonly inTransaction: boolean;
59
+
60
+ /** Prepares a statement, with a "?" for each parameter. */
61
+ prepare<R = Row>(sql: string): Statement<R>;
62
+
63
+ run(sql: string, params?: Parameter[]): RunResult;
64
+ get<R = Row>(sql: string, params?: Parameter[]): R | undefined;
65
+ all<R = Row>(sql: string, params?: Parameter[]): R[];
66
+ iterate<R = Row>(sql: string, params?: Parameter[]): IterableIterator<R>;
67
+
68
+ /** Starts a transaction, which is ended by commit or rollback. */
69
+ begin(): void;
70
+ /** Commits the transaction, if there is one. */
71
+ commit(): void;
72
+ /** Rolls back the transaction, if there is one. */
73
+ rollback(): void;
74
+ /**
75
+ * Calls fn in a transaction, which is committed when it returns (and its
76
+ * value is returned), or rolled back if it throws.
77
+ */
78
+ transaction<T>(fn: () => T): T;
79
+
80
+ /** Closes the connection and its statements, rolling back a transaction. */
81
+ close(): void;
82
+ [Symbol.dispose](): void;
83
+ }
84
+
85
+ export class Statement<R = Row> {
86
+ private constructor();
87
+
88
+ readonly connection: Connection;
89
+ readonly sql: string;
90
+ /** Whether the statement returns rows (certain once it's executed). */
91
+ readonly reader: boolean;
92
+
93
+ columns(): Column[];
94
+ /** Makes each row an array, in the order of the columns. */
95
+ raw(on?: true): Statement<Value[]>;
96
+ raw(on: false): Statement<Row>;
97
+ raw(on?: boolean): Statement<Value[] | Row>;
98
+
99
+ run(params?: Parameter[]): RunResult;
100
+ get(params?: Parameter[]): R | undefined;
101
+ all(params?: Parameter[]): R[];
102
+ iterate(params?: Parameter[]): IterableIterator<R>;
103
+
104
+ close(): void;
105
+ [Symbol.dispose](): void;
106
+ }
107
+
108
+ /** An error from vsql. */
109
+ export class VsqlError extends Error {
110
+ readonly name: 'VsqlError';
111
+ /** The SQLSTATE, such as "42P01". */
112
+ readonly sqlstate: string;
113
+ /** The same as sqlstate. */
114
+ readonly code: string;
115
+ }
116
+
117
+ /** A parameter that's sent as a particular SQL type. */
118
+ export class SqlValue {
119
+ private constructor();
120
+
121
+ readonly type: string;
122
+ readonly value: string;
123
+ toString(): string;
124
+ }
125
+
126
+ /** A NUMERIC, from a string (such as "-12.50"), number or bigint. */
127
+ export function numeric(value: string | number | bigint): SqlValue;
128
+ /** A DATE, from "YYYY-MM-DD". */
129
+ export function date(value: string): SqlValue;
130
+ /** A TIME, from "HH:MM:SS[.ffffff][offset]". */
131
+ export function time(value: string): SqlValue;
132
+ /** A TIMESTAMP, from "YYYY-MM-DD HH:MM:SS[.ffffff][offset]" (or with a "T"). */
133
+ export function timestamp(value: string): SqlValue;
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Elliot Chance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019-2024 Alexander Medvednikov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file has no copyright assigned and is placed in the Public Domain.
3
+ * This file is part of the mingw-w64 runtime package.
4
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
+ */
6
+
7
+ #ifndef _AFUNIX_
8
+ #define _AFUNIX_
9
+
10
+ #define UNIX_PATH_MAX 108
11
+
12
+ #if !defined(ADDRESS_FAMILY)
13
+ #define UNDEF_ADDRESS_FAMILY
14
+ #define ADDRESS_FAMILY unsigned short
15
+ #endif
16
+
17
+ typedef struct sockaddr_un {
18
+ ADDRESS_FAMILY sun_family;
19
+ char sun_path[UNIX_PATH_MAX];
20
+ } SOCKADDR_UN, *PSOCKADDR_UN;
21
+
22
+ #if defined(UNDEF_ADDRESS_FAMILY)
23
+ #undef ADDRESS_FAMILY
24
+ #endif
25
+
26
+ #endif /* _AFUNIX_ */