summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2011-03-29 22:27:20 +0000
committerRichard Lowe <richlowe@richlowe.net>2011-03-29 22:27:20 +0000
commit6a5408e613dc0b372f722907d6c0b18e99c182dd (patch)
treef24e10b65bbb95c9edb6363c7a526a999c5ad765 /usr/src
parent686c0471389a2f92c1e43b38e1b97771bee482ab (diff)
downloadillumos-joyent-6a5408e613dc0b372f722907d6c0b18e99c182dd.tar.gz
850 system(3C) and similar could just use /bin/sh
Reviewed by: Gordon Ross <gwr@nexenta.com> Reviewed by: John Sonnenschein <johns@joyent.com> Approved by: Garrett D'Amore <garrett@nexenta.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/cron/at.c7
-rw-r--r--usr/src/cmd/ed/ed.c19
-rw-r--r--usr/src/lib/libc/port/gen/execvp.c20
-rw-r--r--usr/src/lib/libc/port/stdio/popen.c6
-rw-r--r--usr/src/lib/libc/port/stdio/system.c7
-rw-r--r--usr/src/lib/libc/port/threads/spawn.c9
-rw-r--r--usr/src/man/man1/at.17
-rw-r--r--usr/src/man/man1/ed.16
-rw-r--r--usr/src/man/man1/env.16
-rw-r--r--usr/src/man/man1/nice.16
-rw-r--r--usr/src/man/man3c/popen.3c14
-rw-r--r--usr/src/man/man3c/system.3c3
-rw-r--r--usr/src/man/man5/standards.523
13 files changed, 22 insertions, 111 deletions
diff --git a/usr/src/cmd/cron/at.c b/usr/src/cmd/cron/at.c
index c441b019e6..d6730beec5 100644
--- a/usr/src/cmd/cron/at.c
+++ b/usr/src/cmd/cron/at.c
@@ -48,6 +48,7 @@
#include <libintl.h>
#include <tzfile.h>
#include <project.h>
+#include <paths.h>
#include "cron.h"
@@ -606,11 +607,7 @@ copy(char *jobfile, FILE *inputfile, int when)
ulimit_flag = 1;
} else {
/* SHELL is NULL or unset, therefore use default */
-#ifdef XPG4
- Shell = shell = "/usr/xpg4/bin/sh";
-#else
- Shell = shell = "/bin/sh";
-#endif /* XPG4 */
+ Shell = shell = _PATH_BSHELL;
ulimit_flag = 1;
}
diff --git a/usr/src/cmd/ed/ed.c b/usr/src/cmd/ed/ed.c
index 06dde94ba2..e8a12eea0c 100644
--- a/usr/src/cmd/ed/ed.c
+++ b/usr/src/cmd/ed/ed.c
@@ -39,6 +39,7 @@
#include <regexpr.h>
#include <regex.h>
#include <errno.h>
+#include <paths.h>
static const char *msgtab[] =
{
@@ -263,8 +264,6 @@ static int save28 = 0; /* Flag whether buffer empty at start of read */
static long savtime;
static char *name = "SHELL";
static char *rshell = "/usr/lib/rsh";
-static char *shpath; /* pointer to correct shell for execution */
- /* of execlp() */
static char *val;
static char *home;
static int nodelim;
@@ -1581,13 +1580,7 @@ unixcom(void)
signal(SIGHUP, oldhup);
signal(SIGQUIT, oldquit);
close(tfile);
- if (__xpg4 == 0) { /* not XPG4 */
- shpath = "/usr/bin/sh";
- } else {
- /* XPG4 */
- shpath = "/usr/xpg4/bin/sh";
- }
- execlp((const char *)shpath, "sh", "-c", curcmd, (char *)0);
+ execlp(_PATH_BSHELL, "sh", "-c", curcmd, (char *)0);
exit(0100);
}
savint = signal(SIGINT, SIG_IGN);
@@ -2697,13 +2690,7 @@ xerr: (void) error(0);
close(w_or_r(0, 1));
dup(w_or_r(pf[0], pf[1]));
close(w_or_r(pf[0], pf[1]));
- if (__xpg4 == 0) { /* not XPG4 */
- shpath = "/usr/bin/sh";
- } else {
- /* XPG4 */
- shpath = "/usr/xpg4/bin/sh";
- }
- execlp((const char *)shpath, "sh", "-c", string, (char *)0);
+ execlp(_PATH_BSHELL, "sh", "-c", string, (char *)0);
exit(1);
}
if (i == (pid_t)-1)
diff --git a/usr/src/lib/libc/port/gen/execvp.c b/usr/src/lib/libc/port/gen/execvp.c
index e46308bc1d..5e63c7de41 100644
--- a/usr/src/lib/libc/port/gen/execvp.c
+++ b/usr/src/lib/libc/port/gen/execvp.c
@@ -27,8 +27,6 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* execlp(name, arg,...,0) (like execl, but does path search)
* execvp(name, argv) (like execv, but does path search)
@@ -46,6 +44,7 @@
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
+#include <paths.h>
static const char *execat(const char *, const char *, char *);
@@ -114,10 +113,6 @@ execvp(const char *name, char *const *argv)
const char *cp;
unsigned etxtbsy = 1;
int eacces = 0;
- char *shpath;
- static const char *sun_path = "/bin/sh";
- static const char *xpg4_path = "/usr/xpg4/bin/sh";
- static const char *shell = "sh";
if (*name == '\0') {
errno = ENOENT;
@@ -137,8 +132,8 @@ execvp(const char *name, char *const *argv)
if (__xpg4 == 0) { /* not XPG4 */
pathstr = "/usr/sbin:/usr/ccs/bin:/usr/bin";
} else { /* XPG4 (CSPATH + /usr/sbin) */
- pathstr = "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:"
- "/opt/SUNWspro/bin:/usr/sbin";
+ pathstr = "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:"
+ "/opt/SUNWspro/bin:/usr/sbin";
}
} else {
if (__xpg4 == 0) { /* not XPG4 */
@@ -172,12 +167,7 @@ execvp(const char *name, char *const *argv)
(void) execv(fname, argv);
switch (errno) {
case ENOEXEC:
- if (__xpg4 == 0) { /* not XPG4 */
- shpath = (char *)sun_path;
- } else { /* XPG4 */
- shpath = (char *)xpg4_path;
- }
- newargs[0] = (char *)shell;
+ newargs[0] = "sh";
newargs[1] = fname;
for (i = 1; (newargs[i + 1] = argv[i]) != NULL; ++i) {
if (i >= 254) {
@@ -185,7 +175,7 @@ execvp(const char *name, char *const *argv)
return (-1);
}
}
- (void) execv((const char *)shpath, newargs);
+ (void) execv(_PATH_BSHELL, newargs);
return (-1);
case ETXTBSY:
if (++etxtbsy > 5)
diff --git a/usr/src/lib/libc/port/stdio/popen.c b/usr/src/lib/libc/port/stdio/popen.c
index b18d29ea93..2a86d36141 100644
--- a/usr/src/lib/libc/port/stdio/popen.c
+++ b/usr/src/lib/libc/port/stdio/popen.c
@@ -45,6 +45,7 @@
#include <pthread.h>
#include <synch.h>
#include <spawn.h>
+#include <paths.h>
#include "stdiom.h"
#include "mse.h"
#include "libc.h"
@@ -95,7 +96,7 @@ popen(const char *cmd, const char *mode)
int myside;
int yourside;
int fd;
- const char *shpath;
+ const char *shpath = _PATH_BSHELL;
FILE *iop;
int stdio;
node_t *curr;
@@ -104,8 +105,6 @@ popen(const char *cmd, const char *mode)
posix_spawnattr_t attr;
posix_spawn_file_actions_t fact;
int error;
- static const char *sun_path = "/bin/sh";
- static const char *xpg4_path = "/usr/xpg4/bin/sh";
static const char *shell = "sh";
static const char *sh_flg = "-c";
@@ -131,7 +130,6 @@ popen(const char *cmd, const char *mode)
return (NULL);
}
- shpath = __xpg4? xpg4_path : sun_path;
if (access(shpath, X_OK)) /* XPG4 Requirement: */
shpath = ""; /* force child to fail immediately */
diff --git a/usr/src/lib/libc/port/stdio/system.c b/usr/src/lib/libc/port/stdio/system.c
index 90dc28e063..bc7e412d52 100644
--- a/usr/src/lib/libc/port/stdio/system.c
+++ b/usr/src/lib/libc/port/stdio/system.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <synch.h>
#include <spawn.h>
+#include <paths.h>
#include "libc.h"
extern const char **_environ;
@@ -124,15 +125,11 @@ system(const char *cmd)
int error;
sigset_t mask;
struct stat64 buf;
- const char *shpath;
+ const char *shpath = _PATH_BSHELL;
char *argv[4];
posix_spawnattr_t attr;
- static const char *sun_path = "/bin/sh";
- static const char *xpg4_path = "/usr/xpg4/bin/sh";
static const char *shell = "sh";
- shpath = __xpg4? xpg4_path : sun_path;
-
if (cmd == NULL) {
if (stat64(shpath, &buf) != 0) {
return (0);
diff --git a/usr/src/lib/libc/port/threads/spawn.c b/usr/src/lib/libc/port/threads/spawn.c
index 95c93c49c9..5ac0a1ab2a 100644
--- a/usr/src/lib/libc/port/threads/spawn.c
+++ b/usr/src/lib/libc/port/threads/spawn.c
@@ -32,6 +32,7 @@
#include <dirent.h>
#include <alloca.h>
#include <spawn.h>
+#include <paths.h>
#define ALL_POSIX_SPAWN_FLAGS \
(POSIX_SPAWN_RESETIDS | \
@@ -382,9 +383,6 @@ posix_spawnp(
char **newargs;
int argc;
int i;
- static const char *sun_path = "/bin/sh";
- static const char *xpg4_path = "/usr/xpg4/bin/sh";
- static const char *shell = "sh";
if (attrp != NULL && sap == NULL)
return (EINVAL);
@@ -483,13 +481,12 @@ posix_spawnp(
(void) set_error(&error, 0);
(void) execve(path, argv, envp);
if (set_error(&error, errno) == ENOEXEC) {
- newargs[0] = (char *)shell;
+ newargs[0] = "sh";
newargs[1] = path;
for (i = 1; i <= argc; i++)
newargs[i + 1] = argv[i];
(void) set_error(&error, 0);
- (void) execve(xpg4? xpg4_path : sun_path,
- newargs, envp);
+ (void) execve(_PATH_BSHELL, newargs, envp);
if (sap != NULL &&
(sap->sa_psflags & POSIX_SPAWN_NOEXECERR_NP))
_exit(127);
diff --git a/usr/src/man/man1/at.1 b/usr/src/man/man1/at.1
index 088d3d5ab7..0eeb6a2a0e 100644
--- a/usr/src/man/man1/at.1
+++ b/usr/src/man/man1/at.1
@@ -148,12 +148,7 @@ If the \fB-c\fR, \fB-k\fR, or \fB-s\fR options are not specified, the
\fBSHELL\fR environment variable by default determines which shell to use.
.sp
.LP
-For \fB/usr/xpg4/bin/at\fR and \fB/usr/xpg4/bin/batch\fR, if \fBSHELL\fR is
-unset or \fBNULL\fR, \fB/usr/xpg4/bin/sh\fR is used.
-.sp
-.LP
-For \fBusr/bin/at\fR and \fB/usr/bin/batch\fR, if \fBSHELL\fR is unset or
-\fBNULL\fR, \fB/bin/sh\fR is used.
+If \fBSHELL\fR is unset or \fBNULL\fR, \fB/usr/bin/sh\fR is used.
.sp
.LP
The following options are supported:
diff --git a/usr/src/man/man1/ed.1 b/usr/src/man/man1/ed.1
index 6217a7cd4b..cb22999587 100644
--- a/usr/src/man/man1/ed.1
+++ b/usr/src/man/man1/ed.1
@@ -81,16 +81,10 @@ While \fBed\fR is accepting text, it is said to be in \fIinput mode\fR. In this
mode, \fBno\fR commands are recognized; all input is merely collected. Leave
input mode by typing a period (\fB\&.\fR) at the beginning of a line, followed
immediately by a carriage return.
-.SS "/usr/bin/ed"
.sp
.LP
If \fBed\fR executes commands with arguments, it uses the default shell
\fB/usr/bin/sh\fR (see \fBsh\fR(1)).
-.SS "/usr/xpg4/bin/ed and /usr/xpg6/bin/ed"
-.sp
-.LP
-If \fBed\fR executes commands with arguments, it uses \fB/usr/xpg4/bin/sh\fR
-(see \fBksh\fR(1)).
.SS "Regular Expressions"
.sp
.LP
diff --git a/usr/src/man/man1/env.1 b/usr/src/man/man1/env.1
index 540586ee45..6294786a5e 100644
--- a/usr/src/man/man1/env.1
+++ b/usr/src/man/man1/env.1
@@ -33,16 +33,10 @@ the modified environment.
Optional arguments are passed to \fIutility\fR. If no \fIutility\fR operand is
specified, the resulting environment is written to the standard output, with
one \fIname\fR\fB=\fR\fIvalue\fR pair per line.
-.SS "\fB/usr/bin\fR"
.sp
.LP
If \fBenv\fR executes commands with arguments, it uses the default shell
\fB/usr/bin/sh\fR (see \fBsh\fR(1)).
-.SS "\fB/usr/xpg4/bin\fR"
-.sp
-.LP
-If \fBenv\fR executes commands with arguments, it uses \fB/usr/xpg4/bin/sh\fR
-(see \fBksh\fR(1)).
.SH OPTIONS
.sp
.LP
diff --git a/usr/src/man/man1/nice.1 b/usr/src/man/man1/nice.1
index fd5e671e30..9925c592c1 100644
--- a/usr/src/man/man1/nice.1
+++ b/usr/src/man/man1/nice.1
@@ -44,16 +44,10 @@ that supports \fBnice\fR.
If the C shell (see \fBcsh\fR(1)) is used, the full path of the command must be
specified. Otherwise, the \fBcsh\fR built-in version of \fBnice\fR will be
invoked. See \fBcsh Builtin\fR below.
-.SS "/usr/bin/nice"
.sp
.LP
If \fBnice\fR executes commands with arguments, it uses the default shell
\fB/usr/bin/sh\fR (see \fBsh\fR(1)).
-.SS "/usr/xpg4/bin/nice"
-.sp
-.LP
-If \fBnice\fR executes commands with arguments, it uses \fB/usr/xpg4/bin/sh\fR
-(see \fBksh\fR(1)).
.SS "csh Builtin"
.sp
.LP
diff --git a/usr/src/man/man3c/popen.3c b/usr/src/man/man3c/popen.3c
index ade577bfce..ebf8b88262 100644
--- a/usr/src/man/man3c/popen.3c
+++ b/usr/src/man/man3c/popen.3c
@@ -43,19 +43,11 @@ argument as described in \fBfopen\fR(3C) to enable extended FILE facility.
.sp
.LP
The environment of the executed command will be as if a child process were
-created within the \fBpopen()\fR call using \fBfork\fR(2). If the application
-is standard-conforming (see \fBstandards\fR(5)), the child is created as if
-invoked with the call:
+created within the \fBpopen()\fR call using \fBfork\fR(2). The child is
+created as if invoked with the call:
.sp
.LP
-\fBexecl("/usr/xpg4/bin/sh", "sh", "\fR\fB-c\fR\fB",\fR\fIcommand\fR, \fB(char
-*)0);\fR
-.sp
-.LP
-otherwise, the child is created as if invoked with the call:
-.sp
-.LP
-\fBexecl("/usr/bin/sh", "sh", "\fR\fB-c\fR\fB",\fR\fIcommand\fR, \fB(char
+\fBexecl("/usr/bin/sh", "sh", "\fR\fB-c\fR\fB", \fR\fIcommand\fR, \fB(char
*)0);\fR
.sp
.LP
diff --git a/usr/src/man/man3c/system.3c b/usr/src/man/man3c/system.3c
index 11812da3f8..f6404ba0bf 100644
--- a/usr/src/man/man3c/system.3c
+++ b/usr/src/man/man3c/system.3c
@@ -31,8 +31,7 @@ the shell in the format specified by \fBwaitpid\fR(3C).
.LP
If \fIstring\fR is a null pointer, \fBsystem()\fR checks if the shell exists
and is executable. If the shell is available, \fBsystem()\fR returns a
-non-zero value; otherwise, it returns \fB0\fR. The standard to which the
-caller conforms determines which shell is used. See \fBstandards\fR(5).
+non-zero value; otherwise, it returns \fB0\fR.
.sp
.LP
The \fBsystem()\fR function sets the \fBSIGINT\fR and \fBSIGQUIT\fR signals to
diff --git a/usr/src/man/man5/standards.5 b/usr/src/man/man5/standards.5
index caba3a202d..ddc1c34203 100644
--- a/usr/src/man/man5/standards.5
+++ b/usr/src/man/man5/standards.5
@@ -252,29 +252,6 @@ other directories containing binaries needed by the application
.RE
.RE
-.sp
-.LP
-When an application uses \fBexeclp()\fR or \fBexecvp()\fR (see \fBexec\fR(2))
-to execute a shell file, or uses \fBsystem\fR(3C), the shell used to interpret
-the shell file depends on the standard to which the caller conforms:
-.sp
-
-.sp
-.TS
-tab();
-cw(4.33i) cw(1.17i)
-lw(4.33i) lw(1.17i)
-.
-StandardShell Used
-_
-T{
-1989 ANSI C, 1990 ISO C, 1999 ISO C, POSIX.1 (1990-2001), SUS, SUSv2, SUSv3, XPG4
-T}\fB/usr/xpg4/bin/sh\fR
-T{
-POSIX.1 (1988), SVID3, XPG3, no standard specified
-T}\fB/usr/bin/sh\fR
-.TE
-
.SS "Feature Test Macros"
.sp
.LP