From nobody Tue Nov 30 02:16:39 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1DFEB18B1B40; Tue, 30 Nov 2021 02:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J35SS0rnNz4Vjv; Tue, 30 Nov 2021 02:16:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CD835DCD; Tue, 30 Nov 2021 02:16:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AU2Gd2S008208; Tue, 30 Nov 2021 02:16:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AU2GdGw008207; Tue, 30 Nov 2021 02:16:39 GMT (envelope-from git) Date: Tue, 30 Nov 2021 02:16:39 GMT Message-Id: <202111300216.1AU2GdGw008207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: bd44dce5b317 - main - Document posix_spawn_file_actions_addchdir_np(3) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd44dce5b3176c19a9435a5e7e125fc06182fbc9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638238600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R9lrSUiCd77rU9Aleh8v6eL6tAph+FmXFg1wmV8vZNA=; b=dccxLedwQOjX6zNrTAH78W0I2zBcjfRnxjB0VM0X5EhVh0NgcNhzdrixEWnTkFStSv0rcW 9xKmCzN5JMFLaXrvNXhvwZM+lxAtx6YSNNrMZhgxZ8GoqCid0obZbP/mceFMUemV5fEp5J af+A41vdNqAJSwEQf1ByLSmbGhChZhgctcIzTbGQDF2ieVNf7qdG+Xl8faNX2F6uq2Hnb1 FnAm0Jqywmdorq8ekJV3NqYP98X298QJS3ubXy7Z2P+Jcw0nic4VxW5pkECgMs0pb3edok zJ2VXzGJYQIJbPZ3m78sPlSPuO2uaxIfVDEOIsDl3LzHevintiK8BnVOe6nEqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638238600; a=rsa-sha256; cv=none; b=XmMn8jVrxAcuenZXJDnSGfYe0NzgQIWfirAvuuYjanjlxNrsvLhb8fk8PoKt31r2EVn3B2 JktaXgvsTTwUAVtByOAtXWmojiQ6d0nTFl+lOBxX27HYeAeug9uIUHXDjvu1bxCa+Q08nX Ldk/hrhiemdS+nBl0T05s/7dcBeBwMlqJpiX9bXj2D7VMBtQjrQuTlSEPdVW1mi/l9IOBs S/svXetzKLyHABIMMy66+mrdAigHzKZ11N+lYRbvPKZ2Ojc/5iU9HnW3IK7TsV26c3tv2e gsnc9lJL93j4VoPRvZOg5y05jWhzugkgD8paaqLYoopxoAqMZdRbladl3XDCDQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd44dce5b3176c19a9435a5e7e125fc06182fbc9 commit bd44dce5b3176c19a9435a5e7e125fc06182fbc9 Author: Konstantin Belousov AuthorDate: 2021-11-28 00:11:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-30 01:43:54 +0000 Document posix_spawn_file_actions_addchdir_np(3) Reviewed by: kevans, ngie (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33143 --- lib/libc/gen/Makefile.inc | 2 + lib/libc/gen/posix_spawn.3 | 4 +- lib/libc/gen/posix_spawn_file_actions_addopen.3 | 49 ++++++++++++++++++++++++- lib/libc/gen/posix_spawn_file_actions_init.3 | 2 +- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 75bc30d70976..0b53a275e861 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -464,6 +464,8 @@ MLINKS+=popen.3 pclose.3 MLINKS+=posix_spawn.3 posix_spawnp.3 \ posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addclose.3 \ posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_adddup2.3 \ + posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addchdir_np.3 \ + posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addfchdir_np.3 \ posix_spawn_file_actions_init.3 posix_spawn_file_actions_destroy.3 \ posix_spawnattr_getflags.3 posix_spawnattr_setflags.3 \ posix_spawnattr_getpgroup.3 posix_spawnattr_setpgroup.3 \ diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3 index 12df7dc41875..848733a41a7d 100644 --- a/lib/libc/gen/posix_spawn.3 +++ b/lib/libc/gen/posix_spawn.3 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 5, 2016 +.Dd November 28, 2021 .Dt POSIX_SPAWN 3 .Os .Sh NAME @@ -436,6 +436,8 @@ including trying to close a descriptor that is not open. .Xr posix_spawn_file_actions_addclose 3 , .Xr posix_spawn_file_actions_adddup2 3 , .Xr posix_spawn_file_actions_addopen 3 , +.Xr posix_spawn_file_actions_addchdir_np 3 , +.Xr posix_spawn_file_actions_addfchdir_np 3 , .Xr posix_spawn_file_actions_destroy 3 , .Xr posix_spawn_file_actions_init 3 , .Xr posix_spawnattr_destroy 3 , diff --git a/lib/libc/gen/posix_spawn_file_actions_addopen.3 b/lib/libc/gen/posix_spawn_file_actions_addopen.3 index 5cecb49a614d..b364e92c18f8 100644 --- a/lib/libc/gen/posix_spawn_file_actions_addopen.3 +++ b/lib/libc/gen/posix_spawn_file_actions_addopen.3 @@ -40,8 +40,10 @@ .Sh NAME .Nm posix_spawn_file_actions_addopen , .Nm posix_spawn_file_actions_adddup2 , -.Nm posix_spawn_file_actions_addclose -.Nd "add open, dup2 or close action to spawn file actions object" +.Nm posix_spawn_file_actions_addclose , +.Nm posix_spawn_file_actions_addchdir_np , +.Nm posix_spawn_file_actions_addfchdir_np +.Nd "add open, dup2, close, or chdir/fchdir actions to spawn file actions object" .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -65,6 +67,16 @@ .Fa "posix_spawn_file_actions_t * file_actions" .Fa "int fildes" .Fc +.Ft int +.Fo posix_spawn_file_actions_addchdir_np +.Fa "posix_spawn_file_actions_t *restrict file_actions" +.Fa "const char *restrict path" +.Fc +.Ft int +.Fo posix_spawn_file_actions_addfchdir_np +.Fa "posix_spawn_file_actions_t * file_actions" +.Fa "int fildes" +.Fc .Sh DESCRIPTION These functions add an open, dup2 or close action to a spawn file actions object. @@ -163,6 +175,26 @@ close(fildes) .Pp had been called) when a new process is spawned using this file actions object. +.Pp +The +.Fn posix_spawn_file_actions_addchdir_np +and +.Fn posix_spawn_file_actions_addfchdir_np +functions add a change current directory action to the object +referenced by +.Fa file_actions +that affects actions (opens with relative path) performed after the operation, +in the order of insertion into the +.Fa file_actions +object. +It also sets the working directory for the spawned program. +The +.Fn posix_spawn_file_actions_addchdir_np +function takes the +.Fa path +to set as the working directory, while +.Fn posix_spawn_file_actions_addfchdir_np +takes the directory file descriptor. .Sh RETURN VALUES Upon successful completion, these functions return zero; otherwise, an error number is returned to indicate the error. @@ -204,6 +236,13 @@ is equal to (clearing .Dv FD_CLOEXEC ) . A future update of the Standard is expected to require this behavior. +.Pp +The +.Fn posix_spawn_file_actions_addchdir_np +and +.Fn posix_spawn_file_actions_addfchdir_np +functions are non-standard functions implemented after the similar +functionality provided by glibc. .Sh HISTORY The .Fn posix_spawn_file_actions_addopen , @@ -212,5 +251,11 @@ and .Fn posix_spawn_file_actions_addclose functions first appeared in .Fx 8.0 . +The +.Fn posix_spawn_file_actions_addchdir_np +and +.Fn posix_spawn_file_actions_addfchdir_np +functions first appeared in +.Fx 14.0 . .Sh AUTHORS .An \&Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/posix_spawn_file_actions_init.3 b/lib/libc/gen/posix_spawn_file_actions_init.3 index 380eed769003..31b62beed570 100644 --- a/lib/libc/gen/posix_spawn_file_actions_init.3 +++ b/lib/libc/gen/posix_spawn_file_actions_init.3 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 24, 2008 +.Dd November 28, 2021 .Dt POSIX_SPAWN_FILE_ACTIONS_INIT 3 .Os .Sh NAME