File tree Expand file tree Collapse file tree 10 files changed +98
-0
lines changed Expand file tree Collapse file tree 10 files changed +98
-0
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,7 @@ set(TARGET_LIBC_ENTRYPOINTS
341
341
libc.src.unistd.readlink
342
342
libc.src.unistd.readlinkat
343
343
libc.src.unistd.rmdir
344
+ libc.src.unistd.setsid
344
345
libc.src.unistd.symlink
345
346
libc.src.unistd.symlinkat
346
347
libc.src.unistd.sysconf
Original file line number Diff line number Diff line change @@ -337,6 +337,7 @@ set(TARGET_LIBC_ENTRYPOINTS
337
337
libc.src.unistd.readlink
338
338
libc.src.unistd.readlinkat
339
339
libc.src.unistd.rmdir
340
+ libc.src.unistd.setsid
340
341
libc.src.unistd.symlink
341
342
libc.src.unistd.symlinkat
342
343
libc.src.unistd.sysconf
Original file line number Diff line number Diff line change @@ -340,6 +340,7 @@ set(TARGET_LIBC_ENTRYPOINTS
340
340
libc.src.unistd.readlink
341
341
libc.src.unistd.readlinkat
342
342
libc.src.unistd.rmdir
343
+ libc.src.unistd.setsid
343
344
libc.src.unistd.symlink
344
345
libc.src.unistd.symlinkat
345
346
libc.src.unistd.sysconf
Original file line number Diff line number Diff line change @@ -275,6 +275,12 @@ functions:
275
275
- type : const void *__restrict
276
276
- type : void *
277
277
- type : ssize_t
278
+ - name : setsid
279
+ standards :
280
+ - POSIX
281
+ return_type : pid_t
282
+ arguments :
283
+ - type : void
278
284
- name : symlink
279
285
standards :
280
286
- POSIX
Original file line number Diff line number Diff line change @@ -231,6 +231,13 @@ add_entrypoint_object(
231
231
.${LIBC_TARGET_OS}.rmdir
232
232
)
233
233
234
+ add_entrypoint_object (
235
+ setsid
236
+ ALIAS
237
+ DEPENDS
238
+ .${LIBC_TARGET_OS}.setsid
239
+ )
240
+
234
241
add_entrypoint_object (
235
242
symlink
236
243
ALIAS
Original file line number Diff line number Diff line change @@ -459,6 +459,18 @@ add_entrypoint_object(
459
459
libc.src.errno.errno
460
460
)
461
461
462
+ add_entrypoint_object (
463
+ setsid
464
+ SRCS
465
+ setsid.cpp
466
+ HDRS
467
+ ../setsid.h
468
+ DEPENDS
469
+ libc.hdr.types.pid_t
470
+ libc.include.sys_syscall
471
+ libc.src.__support.OSUtil.osutil
472
+ )
473
+
462
474
add_entrypoint_object (
463
475
symlink
464
476
SRCS
Original file line number Diff line number Diff line change
1
+ // ===-- Linux implementation of setsid-------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ #include " src/unistd/setsid.h"
10
+
11
+ #include " hdr/types/pid_t.h"
12
+ #include " src/__support/OSUtil/syscall.h" // For internal syscall function.
13
+ #include " src/__support/common.h"
14
+ #include " src/__support/macros/config.h"
15
+
16
+ #include < sys/syscall.h> // For syscall numbers.
17
+
18
+ namespace LIBC_NAMESPACE_DECL {
19
+
20
+ LLVM_LIBC_FUNCTION (pid_t , setsid, ()) {
21
+ return LIBC_NAMESPACE::syscall_impl<pid_t >(SYS_setsid);
22
+ }
23
+
24
+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header for setsid ------------------------*- C++ -*-===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ #ifndef LLVM_LIBC_SRC_UNISTD_GETPID_H
10
+ #define LLVM_LIBC_SRC_UNISTD_GETPID_H
11
+
12
+ #include " hdr/types/pid_t.h"
13
+ #include " src/__support/macros/config.h"
14
+
15
+ namespace LIBC_NAMESPACE_DECL {
16
+
17
+ pid_t setsid ();
18
+
19
+ } // namespace LIBC_NAMESPACE_DECL
20
+
21
+ #endif // LLVM_LIBC_SRC_UNISTD_GETPID_H
Original file line number Diff line number Diff line change @@ -287,6 +287,16 @@ add_libc_unittest(
287
287
libc.src.__support.CPP.string_view
288
288
)
289
289
290
+ add_libc_unittest (
291
+ setsid_test
292
+ SUITE
293
+ libc_unistd_unittests
294
+ SRCS
295
+ setsid_test.cpp
296
+ DEPENDS
297
+ libc.src.unistd.setsid
298
+ )
299
+
290
300
add_libc_unittest (
291
301
symlink_test
292
302
SUITE
Original file line number Diff line number Diff line change
1
+ // ===-- Unittests for setsid ----------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ #include " src/unistd/setsid.h"
10
+ #include " test/UnitTest/Test.h"
11
+
12
+ TEST (LlvmLibcGetPidTest, SmokeTest) {
13
+ // setsid always succeeds. So, we just call it as a smoke test.
14
+ LIBC_NAMESPACE::setsid ();
15
+ }
You can’t perform that action at this time.
0 commit comments