Add `_PATH_DEVZERO'.

Use _PATH_* where where possible.
This commit is contained in:
David E. O'Brien 2000-12-09 09:35:55 +00:00
parent 2961fc5ac4
commit 1a37aa566b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69793
76 changed files with 255 additions and 147 deletions

View file

@ -52,6 +52,7 @@ static const char rcsid[] =
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <paths.h>
#endif
#include <sys/ioctl.h>
@ -635,9 +636,9 @@ forkshell(jp, n, mode)
if ((jp == NULL || jp->nprocs == 0) &&
! fd0_redirected_p ()) {
close(0);
if (open("/dev/null", O_RDONLY) != 0)
error("Can't open /dev/null: %s",
strerror(errno));
if (open(_PATH_DEVNULL, O_RDONLY) != 0)
error("Can't open %s: %s",
_PATH_DEVNULL, strerror(errno));
}
}
#else
@ -647,9 +648,9 @@ forkshell(jp, n, mode)
if ((jp == NULL || jp->nprocs == 0) &&
! fd0_redirected_p ()) {
close(0);
if (open("/dev/null", O_RDONLY) != 0)
error("Can't open /dev/null: %s",
strerror(errno));
if (open(_PATH_DEVNULL, O_RDONLY) != 0)
error("Can't open %s: %s",
_PATH_DEVNULL, strerror(errno));
}
}
#endif

View file

@ -15,6 +15,8 @@
This program must run suid to root.
*/
/* $FreeBSD$ */
#include <stdio.h>
#include <string.h>
@ -36,7 +38,7 @@ main (argc, argv)
char *z;
if (argc != 2
|| strncmp (argv[1], "/dev/", sizeof "/dev/" - 1) != 0)
|| strncmp (argv[1], _PATH_DEV, sizeof _PATH_DEV - 1) != 0)
{
fprintf (stderr, "Usage: tstout device\n");
exit (EXIT_FAILURE);

View file

@ -2,6 +2,8 @@
Hemedinger <bob@dalek.mwc.com> of Mark Williams Corporation and
lightly edited by Ian Lance Taylor. */
/* $FreeBSD$ */
/* The bottom part of this file is lock.c.
* This is a hacked lock.c. A full lock.c can be found in the libmisc sources
* under /usr/src/misc.tar.Z.
@ -29,6 +31,7 @@
#include <ctype.h>
#include <access.h>
#include <paths.h>
/* fscoherent_disable_tty() is a COHERENT specific function. It takes the name
* of a serial device and then scans /etc/ttys for a match. If it finds one,
@ -139,9 +142,10 @@ char enable_device[16]; /* this will hold our device name
x = ixswait ((unsigned long) ipid,
(const char *) NULL);
}
*pzenable = zbufalc (sizeof "/dev/"
*pzenable = zbufalc (sizeof _PATH_DEV
+ strlen (enable_device));
sprintf(*pzenable,"/dev/%s", enable_device);
sprintf(*pzenable,"%s%s",_PATH_DEV,
enable_device);
/* ulog(LOG_NORMAL,"Enable string is {%s}",*pzenable); */
return TRUE;
}else{
@ -246,7 +250,7 @@ const char *ttyn;
char resource[LOKFLEN];
char filename[LOKFLEN];
sprintf(filename, "/dev/%s", ttyn);
sprintf(filename, "%s%s", _PATH_DEV, ttyn);
if (NULL == gen_res_name(filename, resource)){
return(0); /* Non-existent tty can not be locked :-) */
}

View file

@ -63,6 +63,7 @@ const char cusub_rcsid[] = "$FreeBSD$";
#endif /* ! defined (O_NONBLOCK) */
#include <errno.h>
#include <paths.h>
/* 4.2 systems don't define SIGUSR2. This should work for them. On
systems which are missing SIGUSR1, or SIGURG, you must find two
@ -156,8 +157,8 @@ fsysdep_port_access (qport)
zfree = NULL;
if (*zline != '/')
{
zfree = zbufalc (sizeof "/dev/" + strlen (zline));
sprintf (zfree, "/dev/%s", zline);
zfree = zbufalc (sizeof _PATH_DEV + strlen (zline));
sprintf (zfree, "%s%s", _PATH_DEV, zline);
zline = zfree;
}
@ -188,14 +189,14 @@ fsysdep_port_is_line (qport, zline)
zfree2 = NULL;
if (*zline != '/')
{
zfree1 = zbufalc (sizeof "/dev/" + strlen (zline));
sprintf (zfree1, "/dev/%s", zline);
zfree1 = zbufalc (sizeof _PATH_DEV + strlen (zline));
sprintf (zfree1, "%s%s", _PATH_DEV, zline);
zline = zfree1;
}
if (*zpline != '/')
{
zfree2 = zbufalc (sizeof "/dev/" + strlen (zpline));
sprintf (zfree2, "/dev/%s", zpline);
zfree2 = zbufalc (sizeof _PATH_DEV + strlen (zpline));
sprintf (zfree2, "%s%s", _PATH_DEV, zpline);
zpline = zfree2;
}

View file

@ -23,6 +23,8 @@
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
*/
/* $FreeBSD$ */
#include "uucp.h"
#include "uudefs.h"
@ -30,6 +32,7 @@
#include "sysdep.h"
#include <errno.h>
#include <paths.h>
#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
@ -123,7 +126,7 @@ usysdep_detach ()
{
int o;
o = open ((char *) "/dev/tty", O_RDONLY);
o = open ((char *) _PATH_TTY, O_RDONLY);
if (o >= 0)
{
(void) ioctl (o, TIOCNOTTY, (char *) NULL);
@ -137,10 +140,10 @@ usysdep_detach ()
(void) close (0);
(void) close (1);
(void) close (2);
if (open ((char *) "/dev/null", O_RDONLY) != 0
|| open ((char *) "/dev/null", O_WRONLY) != 1
|| open ((char *) "/dev/null", O_WRONLY) != 2)
ulog (LOG_FATAL, "open (/dev/null): %s", strerror (errno));
if (open ((char *) _PATH_DEVNULL, O_RDONLY) != 0
|| open ((char *) _PATH_DEVNULL, O_WRONLY) != 1
|| open ((char *) _PATH_DEVNULL, O_WRONLY) != 2)
ulog (LOG_FATAL, "open (%s): %s", _PATH_DEVNULL, strerror (errno));
#if HAVE_SETSID

View file

@ -23,6 +23,8 @@
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
*/
/* $FreeBSD$ */
#include "uucp.h"
#include "uudefs.h"
@ -31,6 +33,7 @@
#include "sysdep.h"
#include <errno.h>
#include <paths.h>
#include <pwd.h>
#if HAVE_FCNTL_H
@ -189,13 +192,13 @@ usysdep_initialize (puuconf,iflags)
/* Make sure stdin, stdout and stderr are open. */
if (fcntl (0, F_GETFD, 0) < 0
&& open ((char *) "/dev/null", O_RDONLY, 0) != 0)
&& open ((char *) _PATH_DEVNULL, O_RDONLY, 0) != 0)
exit (EXIT_FAILURE);
if (fcntl (1, F_GETFD, 0) < 0
&& open ((char *) "/dev/null", O_WRONLY, 0) != 1)
&& open ((char *) _PATH_DEVNULL, O_WRONLY, 0) != 1)
exit (EXIT_FAILURE);
if (fcntl (2, F_GETFD, 0) < 0
&& open ((char *) "/dev/null", O_WRONLY, 0) != 2)
&& open ((char *) _PATH_DEVNULL, O_WRONLY, 0) != 2)
exit (EXIT_FAILURE);
iuuconf = uuconf_spooldir (puuconf, &zSspooldir);

View file

@ -1,6 +1,8 @@
/* portnm.c
Get the port name of stdin. */
/* $FreeBSD$ */
#include "uucp.h"
#include "sysdep.h"
@ -12,6 +14,7 @@
#endif
#include <sys/socket.h>
#endif
#include <paths.h>
#ifndef ttyname
extern char *ttyname ();
@ -44,8 +47,8 @@ zsysdep_port_name (ftcp_port)
z = ttyname (0);
if (z == NULL)
return NULL;
if (strncmp (z, "/dev/", sizeof "/dev/" - 1) == 0)
return z + sizeof "/dev/" - 1;
if (strncmp (z, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
return z + sizeof _PATH_DEV - 1;
else
return z;
}

View file

@ -37,6 +37,7 @@ const char serial_rcsid[] = "$FreeBSD$";
#include <errno.h>
#include <ctype.h>
#include <paths.h>
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
@ -497,10 +498,10 @@ fsserial_init (qconn, qcmds, zdevice)
size_t clen;
clen = strlen (zdevice);
q->zdevice = zbufalc (sizeof "/dev/" + clen);
memcpy (q->zdevice, "/dev/", sizeof "/dev/" - 1);
memcpy (q->zdevice + sizeof "/dev/" - 1, zdevice, clen);
q->zdevice[sizeof "/dev/" + clen - 1] = '\0';
q->zdevice = zbufalc (sizeof _PATH_DEV + clen);
memcpy (q->zdevice, _PATH_DEV, sizeof _PATH_DEV - 1);
memcpy (q->zdevice + sizeof _PATH_DEV - 1, zdevice, clen);
q->zdevice[sizeof _PATH_DEV + clen - 1] = '\0';
}
q->o = -1;
q->ord = -1;
@ -519,7 +520,7 @@ fsysdep_stdin_init (qconn)
{
/* chmod /dev/tty to prevent other users from writing messages to
it. This is essentially `mesg n'. */
(void) chmod ("/dev/tty", S_IRUSR | S_IWUSR);
(void) chmod (_PATH_TTY, S_IRUSR | S_IWUSR);
return fsserial_init (qconn, &sstdincmds, (const char *) NULL);
}
@ -959,8 +960,8 @@ fsserial_open (qconn, ibaud, fwait, tlocal)
#else
const char *z;
if (strncmp (q->zdevice, "/dev/", sizeof "/dev/" - 1) == 0)
z = q->zdevice + sizeof "/dev/" - 1;
if (strncmp (q->zdevice, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
z = q->zdevice + sizeof _PATH_DEV - 1;
else
z = q->zdevice;
ulog_device (z);
@ -1651,8 +1652,8 @@ fsysdep_modem_begin_dial (qconn, qdial)
zfree = NULL;
if (*z != '/')
{
zfree = zbufalc (sizeof "/dev/" + strlen (z));
sprintf (zfree, "/dev/%s", z);
zfree = zbufalc (sizeof _PATH_DEV + strlen (z));
sprintf (zfree, "%s%s", _PATH_DEV, z);
z = zfree;
}

View file

@ -23,12 +23,15 @@
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
*/
/* $FreeBSD$ */
#include "uucp.h"
#include "uudefs.h"
#include "sysdep.h"
#include <errno.h>
#include <paths.h>
#if HAVE_FCNTL_H
#include <fcntl.h>
@ -210,7 +213,7 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell,
{
if (onull < 0)
{
onull = open ((char *) "/dev/null", O_RDWR);
onull = open ((char *) _PATH_DEVNULL, O_RDWR);
if (onull < 0
|| fcntl (onull, F_SETFD,
fcntl (onull, F_GETFD, 0) | FD_CLOEXEC) < 0)

View file

@ -38,6 +38,7 @@ const char tli_rcsid[] = "$FreeBSD$";
#include "system.h"
#include <errno.h>
#include <paths.h>
#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
@ -267,8 +268,8 @@ ftli_open (qconn, ibaud, fwait)
zfreedev = NULL;
if (*zdevice != '/')
{
zfreedev = zbufalc (sizeof "/dev/" + strlen (zdevice));
sprintf (zfreedev, "/dev/%s", zdevice);
zfreedev = zbufalc (sizeof _PATH_DEV + strlen (zdevice));
sprintf (zfreedev, "%s%s", _PATH_DEV, zdevice);
zdevice = zfreedev;
}

View file

@ -19,6 +19,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $FreeBSD$ */
/*
* This works like "remote" but, you use it like this:
* target kcore /dev/mem
@ -37,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <signal.h>
#include <fcntl.h>
#include <kvm.h>
#include <paths.h>
#include "defs.h"
#include "gdb_string.h"
@ -110,7 +113,7 @@ initial_pcb()
return (0);
/* If this is NOT /dev/mem try for dumppcb. */
if (strncmp(core_file, "/dev/", 5)) {
if (strncmp(core_file, _PATH_DEV, sizeof _PATH_DEV - 1)) {
sym = lookup_minimal_symbol("dumppcb", NULL, NULL);
if (sym != NULL) {
addr = SYMBOL_VALUE_ADDRESS(sym);

View file

@ -17,11 +17,14 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* $FreeBSD$ */
#include "defs.h"
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <paths.h>
#include <sys/sysctl.h>
#include <sys/param.h>
#include <sys/time.h>
@ -540,7 +543,7 @@ kvm_open (efile, cfile, sfile, perm, errout)
&& stb.st_rdev == makedev (2, 0))
{
devmem = 1;
kfd = open ("/dev/kmem", perm, 0);
kfd = open (_PATH_KMEM, perm, 0);
}
if (lookup_minimal_symbol("mp_ncpus", NULL, NULL)) {

View file

@ -17,11 +17,14 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* $FreeBSD$ */
#include "defs.h"
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <paths.h>
#include <sys/sysctl.h>
#include <sys/param.h>
#include <sys/time.h>
@ -540,7 +543,7 @@ kvm_open (efile, cfile, sfile, perm, errout)
&& stb.st_rdev == makedev (2, 0))
{
devmem = 1;
kfd = open ("/dev/kmem", perm, 0);
kfd = open (_PATH_KMEM, perm, 0);
}
if (lookup_minimal_symbol("mp_ncpus", NULL, NULL)) {

View file

@ -1,3 +1,7 @@
/* $FreeBSD$ */
#include <paths.h>
#include "EXTERN.h"
#include "common.h"
#include "INTERN.h"
@ -247,7 +251,7 @@ long arg1,arg2,arg3;
write(1, buf, strlen(buf));
r = read(1, buf, sizeof buf);
}
else if ((ttyfd = open("/dev/tty", 2)) >= 0 && isatty(ttyfd)) {
else if ((ttyfd = open(_PATH_TTY, 2)) >= 0 && isatty(ttyfd)) {
/* might be deleted or unwriteable */
write(ttyfd, buf, strlen(buf));
r = read(ttyfd, buf, sizeof buf);
@ -382,7 +386,7 @@ int assume_exists;
if (debug & 128)
say4("fetchname %s %d %d\n",at,strip_leading,assume_exists);
#endif
if (strnEQ(at, "/dev/null", 9)) /* so files can be created by diffing */
if (strnEQ(at, _PATH_DEVNULL, sizeof _PATH_DEVNULL - 1)) /* so files can be created by diffing */
return Nullch; /* against /dev/null. */
name = fullname = t = savestr(at);

View file

@ -31,6 +31,7 @@
* SUCH DAMAGE.
*
* @(#)paths.h 8.1 (Berkeley) 6/2/93
* $FreeBSD$
*/
#ifndef _PATHS_H_
@ -50,6 +51,7 @@
#define _PATH_CSHELL "/bin/csh"
#define _PATH_DEVDB "/var/run/dev.db"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_DEVZERO "/dev/zero"
#define _PATH_DRUM "/dev/drum"
#define _PATH_FTPUSERS "/etc/ftpusers"
#define _PATH_KMEM "/dev/kmem"

View file

@ -72,7 +72,7 @@
static int fdzero;
# define MMAP_FD fdzero
# define INIT_MMAP() \
{ if ((fdzero = _open("/dev/zero", O_RDWR, 0000)) == -1) \
{ if ((fdzero = _open(_PATH_DEVZERO, O_RDWR, 0000)) == -1) \
wrterror("open of /dev/zero"); }
# define MADV_FREE MADV_DONTNEED
#endif /* __sparc__ */
@ -91,6 +91,7 @@
#include <sys/mman.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

View file

@ -31,6 +31,7 @@
#include <sys/fcntl.h>
#include <sys/sysctl.h>
#include <err.h>
#include <paths.h>
#include <machine/bwx.h>
#include <machine/sysarch.h>
#include <stdlib.h>
@ -52,9 +53,9 @@ bwx_init()
size_t len = sizeof(u_int64_t);
int error;
mem_fd = open("/dev/mem", O_RDWR);
mem_fd = open(_PATH_MEM, O_RDWR);
if (mem_fd < 0)
err(1, "/dev/mem");
err(1, _PATH_MEM);
bwx_int1_ports = mmap(0, 1L<<32, PROT_READ, MAP_ANON, -1, 0);
bwx_int2_ports = mmap(0, 1L<<32, PROT_READ, MAP_ANON, -1, 0);
bwx_int4_ports = mmap(0, 1L<<32, PROT_READ, MAP_ANON, -1, 0);

View file

@ -31,6 +31,7 @@
#include <sys/fcntl.h>
#include <sys/sysctl.h>
#include <err.h>
#include <paths.h>
#include <machine/swiz.h>
#include <machine/sysarch.h>
#include <stdlib.h>
@ -54,9 +55,9 @@ swiz_init()
size_t len = sizeof(u_int64_t);
int error;
mem_fd = open("/dev/mem", O_RDWR);
mem_fd = open(_PATH_MEM, O_RDWR);
if (mem_fd < 0)
err(1, "/dev/mem");
err(1, _PATH_MEM);
swiz_ports = mmap(0, 1L<<32, PROT_READ, MAP_ANON, -1, 0);
if ((error = sysctlbyname("hw.chipset.ports", &swiz_io_base, &len,

View file

@ -27,6 +27,7 @@ static const char rcsid[] =
#include <fcntl.h>
#include <kvm.h>
#include <nlist.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -187,7 +188,7 @@ kvm_getswapinfo(
swap_ary[i].ksw_devname,
sizeof(swap_ary[i].ksw_devname),
"%s%s",
((flags & SWIF_DEV_PREFIX) ? "/dev/" : ""),
((flags & SWIF_DEV_PREFIX) ? _PATH_DEV : ""),
devname(swinfo.sw_dev, S_IFCHR)
);
}

View file

@ -9,11 +9,14 @@
* For copyright information, see copyright.h.
*/
/* $FreeBSD$ */
#include "ss_internal.h"
#include "copyright.h"
#include <errno.h>
#include <stdio.h>
#include <sys/file.h>
#include <paths.h>
#include <signal.h>
#include <unistd.h>
@ -61,7 +64,7 @@ int ss_pager_create()
int ss_pager_create()
{
int fd;
fd = open("/dev/tty", O_WRONLY, 0);
fd = open(_PATH_TTY, O_WRONLY, 0);
return fd;
}
#endif

View file

@ -65,6 +65,7 @@ SOFTWARE.
#include <errno.h>
#include <ctype.h>
#include <netdb.h>
#include <paths.h>
#include <syslog.h>
#include <assert.h>
@ -395,7 +396,7 @@ main(argc, argv)
#ifdef NO_SETSID
setpgrp(0,0);
#ifdef TIOCNOTTY
n = open("/dev/tty", O_RDWR);
n = open(_PATH_TTY, O_RDWR);
if (n >= 0) {
ioctl(n, TIOCNOTTY, (char *) 0);
(void) close(n);

View file

@ -25,6 +25,8 @@ ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
************************************************************************/
/* $FreeBSD$ */
/*
* BOOTPGW is typically used to forward BOOTP client requests from
* one subnet to a BOOTP server on a different subnet.
@ -54,6 +56,7 @@ SOFTWARE.
#include <errno.h>
#include <ctype.h>
#include <netdb.h>
#include <paths.h>
#include <syslog.h>
#include <assert.h>
@ -372,7 +375,7 @@ main(argc, argv)
#ifdef NO_SETSID
setpgrp(0,0);
#ifdef TIOCNOTTY
n = open("/dev/tty", O_RDWR);
n = open(_PATH_TTY, O_RDWR);
if (n >= 0) {
ioctl(n, TIOCNOTTY, (char *) 0);
(void) close(n);

View file

@ -18,6 +18,7 @@
#endif
#include <ctype.h>
#include <paths.h>
#include <syslog.h>
#include "getether.h"
@ -195,7 +196,7 @@ getether(ifname, eap)
char *enaddr;
int unit = -1; /* which unit to attach */
snprintf(devname, sizeof(devname), "/dev/%s", ifname);
snprintf(devname, sizeof(devname), "%s%s", _PATH_DEV, ifname);
fd = open(devname, 2);
if (fd < 0) {
/* Try without the trailing digit. */

View file

@ -45,6 +45,7 @@
#include <err.h>
#include <fcntl.h>
#include <a.out.h>
#include <paths.h>
#include <stab.h>
#include <stdio.h>
#include <stdlib.h>
@ -66,8 +67,8 @@
#ifndef MAP_ANON
#define MAP_ANON 0
#define anon_open() do { \
if ((anon_fd = open("/dev/zero", O_RDWR, 0)) == -1) \
err("open: %s", "/dev/zero"); \
if ((anon_fd = open(_PATH_DEVZERO, O_RDWR, 0)) == -1) \
err("open: %s", _PATH_DEVZERO); \
} while (0)
#define anon_close() do { \
(void)close(anon_fd); \

View file

@ -49,6 +49,7 @@ static char *rcsid = "$FreeBSD$";
#include <sys/types.h>
#include <err.h>
#include <paths.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@ -456,9 +457,9 @@ int n;
int offset;
#ifdef NEED_DEV_ZERO
fd = open("/dev/zero", O_RDWR, 0);
fd = open(_PATH_DEVZERO, O_RDWR, 0);
if (fd == -1)
perror("/dev/zero");
perror(_PATH_DEVZERO);
#endif
if (pagepool_end - pagepool_start > pagesz) {

View file

@ -190,6 +190,7 @@ int ttyfd = -1;
#include <sys/types.h>
#include <libutil.h>
#include <paths.h>
int cleanopen __P((char *));
void scrub_env __P((void));
@ -512,7 +513,8 @@ int *ptynum;
#endif
#ifndef __hpux
(void) strcpy(line, "/dev/ptyXX");
(void) strcpy(line, _PATH_DEV);
(void) strcat(line, "ptyXX");
p1 = &line[8];
p2 = &line[9];
#else
@ -563,7 +565,7 @@ int *ptynum;
struct stat sb;
for (*ptynum = lowpty; *ptynum <= highpty; (*ptynum)++) {
(void) sprintf(myline, "/dev/pty/%03d", *ptynum);
(void) sprintf(myline, "%spty/%03d", _PATH_DEV, *ptynum);
p = open(myline, 2);
if (p < 0)
continue;
@ -1325,7 +1327,7 @@ login_tty(t)
* the indirect /dev/tty interface.
*/
close(t);
if ((t = open("/dev/tty", O_RDWR)) < 0)
if ((t = open(_PATH_TTY, O_RDWR)) < 0)
fatalperror(net, "open(/dev/tty)");
# endif
# else
@ -1414,7 +1416,7 @@ startslave(host, autologin, autoname)
wtmp.ut_pid = pid;
SCPYN(wtmp.ut_user, "LOGIN");
SCPYN(wtmp.ut_host, host);
SCPYN(wtmp.ut_line, line + sizeof("/dev/") - 1);
SCPYN(wtmp.ut_line, line + sizeof(_PATH_DEV) - 1);
#ifndef __hpux
SCPYN(wtmp.ut_id, wtmp.ut_line+3);
#else
@ -1546,7 +1548,7 @@ start_login(host, autologin, name)
bzero(&utmpx, sizeof(utmpx));
SCPYN(utmpx.ut_user, ".telnet");
SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1);
SCPYN(utmpx.ut_line, line + sizeof(_PATH_DEV) - 1);
utmpx.ut_pid = pid;
utmpx.ut_id[0] = 't';
utmpx.ut_id[1] = 'n';
@ -1823,7 +1825,7 @@ cleanup(sig)
# if (BSD > 43) || defined(convex)
char *p;
p = line + sizeof("/dev/") - 1;
p = line + sizeof(_PATH_DEV) - 1;
if (logout(p))
logwtmp(p, "", "");
(void)chmod(line, 0666);
@ -2102,7 +2104,7 @@ rmut()
* This updates the utmpx and utmp entries and make a wtmp/x entry
*/
SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1);
SCPYN(utmpx.ut_line, line + sizeof(_PATH_DEV) - 1);
utxp = getutxline(&utmpx);
if (utxp) {
utxp->ut_type = DEAD_PROCESS;
@ -2163,7 +2165,7 @@ rmut()
}
(void) chmod(line, 0666);
(void) chown(line, 0, 0);
line[strlen("/dev/")] = 'p';
line[strlen(_PATH_DEV)] = 'p';
(void) chmod(line, 0666);
(void) chown(line, 0, 0);
} /* end of rmut */

View file

@ -62,6 +62,7 @@ static const char rcsid[] =
#include <sys/mman.h>
#include <libutil.h>
#include <paths.h>
#include <utmp.h>
#if defined(_SC_CRAY_SECURE_SYS)
@ -824,10 +825,10 @@ doit(who)
if (secflag) {
char slave_dev[16];
sprintf(tty_dev, "/dev/pty/%03d", ptynum);
sprintf(tty_dev, "%spty/%03d", _PATH_DEV, ptynum);
if (setdevs(tty_dev, &dv) < 0)
fatal(net, "cannot set pty security");
sprintf(slave_dev, "/dev/ttyp%03d", ptynum);
sprintf(slave_dev, "%sp%03d", _PATH_TTY, ptynum);
if (setdevs(slave_dev, &dv) < 0)
fatal(net, "cannot set tty security");
}

View file

@ -909,15 +909,15 @@ main(int argc, char **argv)
}
}
if(devfs)
mount("devfs","/dev",MNT_NOEXEC|MNT_RDONLY,0);
mount("devfs",_PATH_DEV,MNT_NOEXEC|MNT_RDONLY,0);
/* Fill in the sess structures. */
/* XXX Really, should be filled based upon config file. */
for(i=0;i<MAX_CONS;i++) {
if(i==0) {
sprintf(ttys[i].tty,"/dev/console");
sprintf(ttys[i].tty,_PATH_CONSOLE);
} else {
sprintf(ttys[i].tty,"/dev/ttyv%c",vty[i]);
sprintf(ttys[i].tty,"%sv%c",_PATH_TTY,vty[i]);
}
ttys[i].pid=0;
ttys[i].func=shell;

View file

@ -52,6 +52,7 @@
#include <ctype.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -73,7 +74,7 @@ extern int pca200e_microcode_size;
#define DEV_NAME "/dev/sbus%d"
#endif /* sun */
#if (defined(BSD) && (BSD >= 199103))
#define DEV_NAME "/dev/kmem"
#define DEV_NAME _PATH_KMEM
#endif /* BSD */
#define MAX_CHECK 60
@ -1056,7 +1057,7 @@ char *argv[];
* If comm_mode, setup terminal for single char I/O
*/
if ( comm_mode ) {
tty = open ( "/dev/tty", O_RDWR );
tty = open ( _PATH_TTY, O_RDWR );
ioctl ( tty, TCGETA, &sgtty );
sgtty.c_lflag &= ~( ICANON | ECHO );
vmin = sgtty.c_cc[VMIN];

View file

@ -48,6 +48,7 @@ static const char rcsid[] =
#include <fcntl.h>
#include <kvm.h>
#include <limits.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -444,9 +445,9 @@ resolve_ccdname(name)
free(path);
return (NULL);
}
(void)sprintf(path, "/dev/%s%c", name, 'a' + rawpart);
(void)sprintf(path, "%s%s%c", _PATH_DEV, name, 'a' + rawpart);
} else
(void)sprintf(path, "/dev/%s", name);
(void)sprintf(path, "%s%s", _PATH_DEV, name);
return (path);
}

View file

@ -35,6 +35,7 @@ static const char rcsid[] =
#include <fcntl.h>
#include <err.h>
#include <errno.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -331,11 +332,11 @@ main(int argc, char *argv[])
{
static char realname[12];
if(strncmp(argv[0], "/dev", 4) == 0)
if(strncmp(argv[0], _PATH_DEV, sizeof _PATH_DEV - 2) == 0)
disk = argv[0];
else
{
snprintf(realname, 12, "/dev/%s", argv[0]);
snprintf(realname, 12, "%s%s", _PATH_DEV, argv[0]);
disk = realname;
}

View file

@ -59,6 +59,7 @@ static const char rcsid[] =
#include <errno.h>
#include <fcntl.h>
#include <libutil.h>
#include <paths.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@ -283,7 +284,7 @@ main(argc, argv)
warning("ignoring excess arguments");
if (devfs) {
mount("devfs", "/dev", 0, 0);
mount("devfs", _PATH_DEV, 0, 0);
}
/*

View file

@ -35,6 +35,7 @@ static const char rcsid[] =
#include <fcntl.h>
#include <err.h>
#include <errno.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -331,11 +332,11 @@ main(int argc, char *argv[])
{
static char realname[12];
if(strncmp(argv[0], "/dev", 4) == 0)
if(strncmp(argv[0], _PATH_DEV, sizeof _PATH_DEV - 2) == 0)
disk = argv[0];
else
{
snprintf(realname, 12, "/dev/%s", argv[0]);
snprintf(realname, 12, "%s%s", _PATH_DEV, argv[0]);
disk = realname;
}

View file

@ -66,6 +66,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -178,7 +179,7 @@ main(argc, argv)
pid = getpid();
uid = getuid();
if (tflag)
s = open("/dev/null", O_WRONLY, 0);
s = open(_PATH_DEVNULL, O_WRONLY, 0);
else
s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s < 0)

View file

@ -70,8 +70,10 @@
*
* $FreeBSD$
*/
#include <stdio.h>
#include <fcntl.h>
#include <paths.h>
#include <string.h>
#include <sys/ioccom.h>
@ -97,7 +99,7 @@ main(int argc, char *argv[])
if (ioctl(kernel_fd, CDEV_IOCTL1, &one) == -1) {
perror("CDEV_IOCTL1");
} else {
printf( "Sent ioctl CDEV_IOCTL1 to device /dev/" CDEV_DEVICE "\n");
printf( "Sent ioctl CDEV_IOCTL1 to device %s%s\n", _PATH_DEV, CDEV_DEVICE);
}
len = strlen(writestr) + 1;

View file

@ -138,7 +138,7 @@ main(int argc, char *argv[])
exit(EX_SOFTWARE);
}
snprintf(targdevname, sizeof(targdevname), "/dev/targ%d",
snprintf(targdevname, sizeof(targdevname), "%starg%d", _PATH_DEV,
alloc_unit.unit);
if ((targfd = open(targdevname, O_RDWR)) == -1) {

View file

@ -1,7 +1,9 @@
/* @(#)msg_proc.c 2.1 88/08/11 4.0 RPCSRC */
/* $FreeBSD$ */
/*
* msg_proc.c: implementation of the remote procedure "printmessage"
*/
#include <paths.h>
#include <stdio.h>
#include <rpc/rpc.h> /* always need this here */
#include "msg.h" /* need this too: msg.h will be generated by rpcgen */
@ -16,7 +18,7 @@ printmessage_1(msg)
static int result; /* must be static! */
FILE *f;
f = fopen("/dev/console", "w");
f = fopen(_PATH_CONSOLE, "w");
if (f == NULL) {
result = 0;
return (&result);

View file

@ -1,7 +1,9 @@
/* @(#)printmsg.c 2.1 88/08/11 4.0 RPCSRC */
/* $FreeBSD$ */
/*
* printmsg.c: print a message on the console
*/
#include <paths.h>
#include <stdio.h>
main(argc, argv)
@ -33,7 +35,7 @@ printmessage(msg)
{
FILE *f;
f = fopen("/dev/console", "w");
f = fopen(_PATH_CONSOLE, "w");
if (f == NULL) {
return (0);
}

View file

@ -55,6 +55,7 @@
#include <sys/disklabel.h>
#include <sys/conf.h>
#include <sys/cons.h>
#include <paths.h>
#include "opt_ddb.h"
#ifdef DDB
@ -253,7 +254,7 @@ vfs_mountroot_ask(void)
for(;;) {
printf("\nManual root filesystem specification:\n");
printf(" <fstype>:<device> Mount <device> using filesystem <fstype>\n");
printf(" eg. ufs:/dev/da0s1a\n");
printf(" eg. ufs:%sda0s1a\n", _PATH_DEV);
printf(" ? List valid disk boot devices\n");
printf(" <empty line> Abort manual input\n");
printf("\nmountroot> ");

View file

@ -55,6 +55,7 @@
#include <sys/disklabel.h>
#include <sys/conf.h>
#include <sys/cons.h>
#include <paths.h>
#include "opt_ddb.h"
#ifdef DDB
@ -253,7 +254,7 @@ vfs_mountroot_ask(void)
for(;;) {
printf("\nManual root filesystem specification:\n");
printf(" <fstype>:<device> Mount <device> using filesystem <fstype>\n");
printf(" eg. ufs:/dev/da0s1a\n");
printf(" eg. ufs:%sda0s1a\n", _PATH_DEV);
printf(" ? List valid disk boot devices\n");
printf(" <empty line> Abort manual input\n");
printf("\nmountroot> ");

View file

@ -44,6 +44,7 @@
#include <glob.h>
#include <errno.h>
#include <ctype.h>
#include <paths.h>
#include <stddef.h>
#include "dispatch.h"
@ -273,7 +274,7 @@ translate_filename(u_char *dname, u_char *uname, int *drivep)
if (!strcasecmp(dname, "con")) {
*drivep = -1;
strcpy(uname, "/dev/tty");
strcpy(uname, _PATH_TTY);
return (0);
}
@ -281,7 +282,7 @@ translate_filename(u_char *dname, u_char *uname, int *drivep)
/* Really need a better way to handle devices */
if (!strcasecmp(dname, "emmxxxx0")) {
*drivep = -1;
strcpy(uname, "/dev/null");
strcpy(uname, _PATH_DEVNULL);
return (0);
}

View file

@ -39,6 +39,7 @@
#include <errno.h>
#include <limits.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
#include <unistd.h>
@ -116,7 +117,7 @@ main(int argc, char **argv)
/* XXX should only be for tty mode */
fd = open ("/dev/null", O_RDWR);
fd = open (_PATH_DEVNULL, O_RDWR);
if (fd != 3)
dup2 (fd, 3); /* stdaux */
if (fd != 4)

View file

@ -33,6 +33,7 @@
*/
#include "doscmd.h"
#include <paths.h>
#include <signal.h>
static int lpt_fd[4] = { -1, -1, -1, -1, };
@ -138,7 +139,7 @@ open_printer(int printer)
return;
}
} else {
sprintf(printer_name, "/dev/lpt%d", printer);
sprintf(printer_name, "%slpt%d", _PATH_DEV, printer);
debug(D_PRINTER, "Opening device %s\n", printer_name);
if ((fd = open(printer_name, O_WRONLY)) < 0) {
perror(printer_name);

View file

@ -44,6 +44,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <paths.h>
#include <signal.h>
#include <sys/time.h>
#ifdef __FreeBSD__
@ -306,8 +307,8 @@ console_init()
}
#endif
if ((fd = open("/dev/console", 2)) < 0) {
perror("/dev/console");
if ((fd = open(_PATH_CONSOLE, 2)) < 0) {
perror(_PATH_CONSOLE);
quit(1);
}
@ -2036,7 +2037,7 @@ video_init()
i = 0;
if (fds)
for (i = 0; i < nfds && (i == 0 || fds[i-1] < 63); ++i)
if ((fds[i] = open("/dev/null", 0)) < 0)
if ((fds[i] = open(_PATH_DEVNULL, 0)) < 0)
break;
/*
* Leave 3 fds behind for X to play with

View file

@ -80,6 +80,7 @@ char *version = "@(#) ee, version 1.3";
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
#include <sys/types.h>
@ -577,7 +578,7 @@ char *argv[];
scr_pos =0;
scr_vert = 0;
scr_horz = 0;
bit_bucket = fopen("/dev/null", "w");
bit_bucket = fopen(_PATH_DEVNULL, "w");
edit = TRUE;
gold = case_sen = FALSE;
shell_fork = TRUE;

View file

@ -66,6 +66,7 @@
#include <string.h>
#include <errno.h>
#include <dirent.h>
#include <paths.h>
#include <unistd.h>
#include "pathnames.h"
@ -98,7 +99,7 @@ gid_t gid;
*cp = 0; /* strip comment */
if ((cp = devname = strtok(buf, WSPACE)) == 0)
continue; /* empty or comment */
if (strncmp(devname, "/dev/", 5) != 0
if (strncmp(devname, _PATH_DEV, sizeof _PATH_DEV - 1) != 0
|| (cp = strtok((char *) 0, WSPACE)) == 0
|| *cp != '0'
|| sscanf(cp, "%o", &prot) == 0

View file

@ -52,6 +52,7 @@
#include <errno.h>
#include <fcntl.h>
#include <libatm.h>
#include <paths.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
@ -247,7 +248,7 @@ start_daemon()
atmarp_log(LOG_ERR, "can't change process group");
exit(1);
}
fd = open("/dev/tty", O_RDWR);
fd = open(_PATH_TTY, O_RDWR);
if (fd >= 0) {
ioctl(fd, TIOCNOTTY, (char *)0);
close(fd);

View file

@ -53,6 +53,7 @@
#include <errno.h>
#include <fcntl.h>
#include <libatm.h>
#include <paths.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
@ -284,7 +285,7 @@ start_daemon()
scsp_log(LOG_ERR, "can't change process group");
exit(1);
}
fd = open("/dev/tty", O_RDWR);
fd = open(_PATH_TTY, O_RDWR);
if (fd >= 0) {
ioctl(fd, TIOCNOTTY, (char *)0);
close(fd);

View file

@ -26,6 +26,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -1141,7 +1142,7 @@ int open_cd ()
if (*cdname == '/') {
snprintf (devbuf, MAXPATHLEN, "%s", cdname);
} else {
snprintf (devbuf, MAXPATHLEN, "/dev/%s", cdname);
snprintf (devbuf, MAXPATHLEN, "%s%s", _PATH_DEV, cdname);
}
fd = open (devbuf, O_RDONLY);

View file

@ -34,6 +34,7 @@ static const char rcsid[] =
#include "cron.h"
#include <sys/signal.h>
#include <fcntl.h>
#include <paths.h>
#if defined(SYSLOG)
# include <syslog.h>
#endif
@ -130,7 +131,7 @@ cron_popen(program, type, e)
if (*type == 'r') {
/* Do not share our parent's stdin */
(void)close(0);
(void)open("/dev/null", O_RDWR);
(void)open(_PATH_DEVNULL, O_RDWR);
if (pdes[1] != 1) {
dup2(pdes[1], 1);
dup2(pdes[1], 2); /* stderr, too! */
@ -144,9 +145,9 @@ cron_popen(program, type, e)
}
/* Hack: stdout gets revoked */
(void)close(1);
(void)open("/dev/null", O_RDWR);
(void)open(_PATH_DEVNULL, O_RDWR);
(void)close(2);
(void)open("/dev/null", O_RDWR);
(void)open(_PATH_DEVNULL, O_RDWR);
(void)close(pdes[1]);
}
# if defined(LOGIN_CAP)

View file

@ -31,6 +31,7 @@ static const char rcsid[] =
#include "cron.h"
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <sys/file.h>
#include <sys/stat.h>
#ifdef USE_UTIMES
@ -297,8 +298,8 @@ edit_cmd() {
if (errno != ENOENT)
err(ERROR_EXIT, "%s", n);
warnx("no crontab for %s - using an empty one", User);
if (!(f = fopen("/dev/null", "r")))
err(ERROR_EXIT, "/dev/null");
if (!(f = fopen(_PATH_DEVNULL, "r")))
err(ERROR_EXIT, _PATH_DEVNULL);
}
um = umask(077);

View file

@ -32,6 +32,7 @@ static char rcsid[] = "$FreeBSD$";
# include <sys/ioctl.h>
#endif
#include <errno.h>
#include <paths.h>
/* the code does not depend on any of vfork's
@ -109,7 +110,7 @@ setsid()
# else
newpgrp = setpgrp(0, getpid());
# endif
if ((fd = open("/dev/tty", 2)) >= 0)
if ((fd = open(_PATH_TTY, 2)) >= 0)
{
(void) ioctl(fd, TIOCNOTTY, (char*)0);
(void) close(fd);
@ -117,9 +118,9 @@ setsid()
# else /*BSD*/
newpgrp = setpgrp();
(void) close(STDIN); (void) open("/dev/null", 0);
(void) close(STDOUT); (void) open("/dev/null", 1);
(void) close(STDERR); (void) open("/dev/null", 2);
(void) close(STDIN); (void) open(_PATH_DEVNULL, 0);
(void) close(STDOUT); (void) open(_PATH_DEVNULL, 1);
(void) close(STDERR); (void) open(_PATH_DEVNULL, 2);
# endif /*BSD*/
return newpgrp;
}

View file

@ -1,3 +1,5 @@
/* $FreeBSD$ */
/* Still missing:
*
* mkctm
@ -27,6 +29,7 @@
#include <unistd.h>
#include <md5.h>
#include <err.h>
#include <paths.h>
#include <signal.h>
#define DEFAULT_IGNORE "/CVS$|/\\.#|00_TRANS\\.TBL$"
@ -560,7 +563,7 @@ main(int argc, char **argv)
argv += optind;
if (!logf)
logf = fopen("/dev/null", "w");
logf = fopen(_PATH_DEVNULL, "w");
setbuf(stdout, 0);

View file

@ -43,6 +43,7 @@
#include <ctype.h>
#include <err.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@ -130,7 +131,7 @@ makename(const char *arg, const char *suffix)
return arg;
if(*arg == '/') /* do not convert absolute pathnames */
return arg;
strcpy(namebuff, "/dev/");
strcpy(namebuff, _PATH_DEV);
strncat(namebuff, arg, 3);
strcat(namebuff, suffix);
return namebuff;

View file

@ -13,6 +13,7 @@
#include <ctype.h>
#include <err.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@ -106,9 +107,9 @@ main(int argc, char **argv)
if(optind < argc)
usage();
tty = fopen("/dev/tty","r+");
tty = fopen(_PATH_TTY,"r+");
if(!tty)
err(1, "/dev/tty");
err(1, _PATH_TTY);
setbuf(tty,0);
for(j=1;j > 0;) {

View file

@ -42,6 +42,7 @@
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <paths.h>
#define MAX_PIDS 32
@ -214,7 +215,8 @@ exec_answer(cfg_entry_t *cep)
device = bdrivername(cep->usrdevicename);
snprintf(devicename, sizeof(devicename), "/dev/i4b%s%d", device, cep->usrdeviceunit);
snprintf(devicename, sizeof(devicename), "%si4b%s%d", _PATH_DEV, device,
cep->usrdeviceunit);
argv[0] = cep->answerprog;
argv[1] = "-D";

View file

@ -36,6 +36,7 @@
*---------------------------------------------------------------------------*/
#include <locale.h>
#include <paths.h>
#ifdef I4B_EXTERNAL_MONITOR
#include "monitor.h"
@ -709,7 +710,7 @@ isdnrdhdl(void)
break;
default:
log(LL_WRN, "ERROR, unknown message received from /dev/isdn (0x%x)", msg_rd_buf[0]);
log(LL_WRN, "ERROR, unknown message received from %sisdn (0x%x)", _PATH_DEV, msg_rd_buf[0]);
break;
}
}

View file

@ -38,6 +38,7 @@
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <paths.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@ -212,7 +213,7 @@ static void
usage(void)
{
fprintf(stderr, "\n");
fprintf(stderr, "isdntelctl - /dev/i4btel control, version %d.%d.%d (%s %s)\n",VERSION, REL, STEP, __DATE__, __TIME__);
fprintf(stderr, "isdntelctl - %si4btel control, version %d.%d.%d (%s %s)\n", _PATH_DEV, VERSION, REL, STEP, __DATE__, __TIME__);
fprintf(stderr, "usage: isdntelctl -c -g -u <unit> -A -N -U\n");
fprintf(stderr, " -c clear input queue\n");
fprintf(stderr, " -g get current settings\n");

View file

@ -32,6 +32,7 @@
#include <err.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -107,8 +108,8 @@ main(int argc, char *argv[])
if (argc < 2) {
help(NULL);
} else {
if ((memfd = open("/dev/mem", O_RDONLY)) == -1)
err(1, "can't open /dev/mem");
if ((memfd = open(_PATH_MEM, O_RDONLY)) == -1)
err(1, "can't open %s", _PATH_MEM);
for (i = 0; functions[i].cmd != NULL; i++)
if (!strcmp(argv[1], functions[i].cmd))

View file

@ -49,6 +49,7 @@ static const char rcsid[] =
#include <sys/types.h>
#include <err.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -350,7 +351,7 @@ main( int argc, char *argv[] )
}
/* open physical memory for access to MP structures */
if ( (pfd = open( "/dev/mem", O_RDONLY )) < 0 )
if ( (pfd = open( _PATH_MEM, O_RDONLY )) < 0 )
err( 1, "mem open" );
/* probe for MP structures */
@ -866,7 +867,7 @@ static void
seekEntry( vm_offset_t addr )
{
if ( lseek( pfd, (off_t)addr, SEEK_SET ) < 0 )
err( 1, "/dev/mem seek" );
err( 1, "%s seek", _PATH_MEM );
}

View file

@ -33,6 +33,7 @@ static const char rcsid[] =
#include <varargs.h>
#endif
#include <fcntl.h>
#include <paths.h>
#ifdef SNMP
#include "snmp.h"
@ -384,7 +385,7 @@ main(argc, argv)
(void)setpgrp();
#else
#ifdef TIOCNOTTY
t = open("/dev/tty", 2);
t = open(_PATH_TTY, 2);
if (t >= 0) {
(void)ioctl(t, TIOCNOTTY, (char *)0);
(void)close(t);

View file

@ -34,7 +34,7 @@
*/
static char *id =
"@(#)cursor.c, 3.20, Last Edit-Date: [Tue Apr 4 12:27:54 1995]";
"@(#)cursor.c, 3.20, Last Edit-Date: [Tue Apr 4 12:27:54 1995]\n$FreeBSD$";
/*---------------------------------------------------------------------------*
*
@ -48,6 +48,7 @@ static char *id =
#include <fcntl.h>
#include <sys/stat.h>
#include <machine/pcvt_ioctl.h>
#include <paths.h>
#define DEFAULTFD 0
@ -148,7 +149,7 @@ usage()
{
fprintf(stderr,"\ncursor - set cursor shape for pcvt video driver\n");
fprintf(stderr,"usage: cursor -d [device] -n [no] -s [line] -e [line]\n");
fprintf(stderr," -d <device> device to use (/dev/ttyvX), default current\n");
fprintf(stderr," -d <device> device to use (%svX), default current\n", _PATH_TTY);
fprintf(stderr," -n <no> screen no if specified, else current screen\n");
fprintf(stderr," -s <line> start scan line (topmost scan line)\n");
fprintf(stderr," -e <line> ending scan line (bottom scan line)\n\n");

View file

@ -15,6 +15,8 @@ choice to the address below.
*/
/* $FreeBSD$ */
#include "header.h"
char inchar(), *instr(), *lookup();
@ -1846,7 +1848,7 @@ initterminal(pn) int pn; {
stty(0,&sgttyNew);
#ifdef SIII
close(2);
open("/dev/tty",O_RDWR|O_NDELAY);
open(_PATH_TTY,O_RDWR|O_NDELAY);
#endif
#endif
#ifdef SARG10

View file

@ -52,6 +52,7 @@
* $FreeBSD$
*/
#include <paths.h>
#include "defs.h"
#ifdef SNMP
@ -424,7 +425,7 @@ main(argc, argv)
(void)setpgrp();
#else
#ifdef TIOCNOTTY
t = open("/dev/tty", 2);
t = open(_PATH_TTY, 2);
if (t >= 0) {
(void)ioctl(t, TIOCNOTTY, (char *)0);
(void)close(t);

View file

@ -60,6 +60,7 @@
#include <sys/param.h>
#include <sys/time.h>
#include <errno.h>
#include <paths.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
@ -466,7 +467,7 @@ main(argc, argv)
(void) setpgrp();
#else
#ifdef TIOCNOTTY
t = open("/dev/tty", 2);
t = open(_PATH_TTY, 2);
if (t >= 0)
{
(void) ioctl(t, TIOCNOTTY, (char *) 0);

View file

@ -24,6 +24,7 @@ static const char rcsid[] =
*/
#include <err.h>
#include <paths.h>
#include "lib.h"
#include "add.h"
@ -363,9 +364,9 @@ pkg_do(char *pkg)
printf("Running mtree for %s..\n", PkgName);
p = find_plist(&Plist, PLIST_CWD);
if (Verbose)
printf("mtree -U -f %s -d -e -p %s >/dev/null\n", MTREE_FNAME, p ? p->name : "/");
printf("mtree -U -f %s -d -e -p %s >%s\n", MTREE_FNAME, p ? p->name : "/", _PATH_DEVNULL);
if (!Fake) {
if (vsystem("/usr/sbin/mtree -U -f %s -d -e -p %s >/dev/null", MTREE_FNAME, p ? p->name : "/"))
if (vsystem("/usr/sbin/mtree -U -f %s -d -e -p %s >%s", MTREE_FNAME, p ? p->name : "/"), _PATH_DEVNULL)
warnx("mtree returned a non-zero status - continuing");
}
unlink(MTREE_FNAME);

View file

@ -25,6 +25,7 @@ static const char rcsid[] =
*/
#include <err.h>
#include <paths.h>
#include "lib.h"
/* Die a relatively simple death */
@ -51,10 +52,10 @@ y_or_n(Boolean def, const char *msg, ...)
* Need to open /dev/tty because file collection may have been
* collected on stdin
*/
tty = fopen("/dev/tty", "r");
tty = fopen(_PATH_TTY, "r");
if (!tty) {
cleanup(0);
errx(2, "can't open /dev/tty!");
errx(2, "can't open %s!", _PATH_TTY);
}
while (ch != 'Y' && ch != 'N') {
vfprintf(stderr, msg, args);

View file

@ -41,6 +41,7 @@ static char rcsid[] = "$FreeBSD$";
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <paths.h>
#include <pwd.h>
#include <string.h>
#include <sys/types.h>
@ -965,7 +966,7 @@ plogin(user, passwd, msg, msglen)
/* Log in wtmp and utmp using login() */
tty = devnam;
if (strncmp(tty, "/dev/", 5) == 0)
if (strncmp(tty, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
tty += 5;
if (logout(tty)) /* Already entered (by login?) */
@ -1031,7 +1032,7 @@ plogout()
char *tty;
tty = devnam;
if (strncmp(tty, "/dev/", 5) == 0)
if (strncmp(tty, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
tty += 5;
logwtmp(tty, "", ""); /* Wipe out wtmp logout entry */
logout(tty); /* Wipe out utmp */

View file

@ -31,6 +31,7 @@ static char rcsid[] = "$FreeBSD$";
#include <syslog.h>
#include <string.h>
#include <netdb.h>
#include <paths.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -80,7 +81,7 @@ int dflag = 0; /* Tell libpcap we want debugging */
int debug = 0; /* Debug flag */
int kdebugflag = 0; /* Tell kernel to print debug messages */
int default_device = 1; /* Using /dev/tty or equivalent */
char devnam[MAXPATHLEN] = "/dev/tty"; /* Device name */
char devnam[MAXPATHLEN] = _PATH_TTY; /* Device name */
int crtscts = 0; /* Use hardware flow control */
int modem = 1; /* Use modem control lines */
int inspeed = 0; /* Input/Output speed requested */
@ -694,7 +695,7 @@ options_for_tty()
int ret;
dev = devnam;
if (strncmp(dev, "/dev/", 5) == 0)
if (strncmp(dev, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
dev += 5;
if (strcmp(dev, "tty") == 0)
return 1; /* don't look for /etc/ppp/options.tty */
@ -1671,9 +1672,9 @@ setdevname(cp, quiet)
if (*cp == 0)
return 0;
if (strncmp("/dev/", cp, 5) != 0) {
strcpy(dev, "/dev/");
strncat(dev, cp, MAXPATHLEN - 5);
if (strncmp(_PATH_DEV, cp, sizeof _PATH_DEV - 1) != 0) {
strcpy(dev, _PATH_DEV);
strncat(dev, cp, MAXPATHLEN - sizeof _PATH_DEV - 1);
dev[MAXPATHLEN-1] = 0;
cp = dev;
}

View file

@ -206,7 +206,7 @@ main(int argc, char *argv[])
* don't bother with extraneous errors
*/
if (getarg(&arglist, 'q') != NULL)
freopen("/dev/null", "w", stderr);
freopen(_PATH_DEVNULL, "w", stderr);
/*
* Set our base working path if not overridden

View file

@ -44,6 +44,7 @@ static const char rcsid[] =
#include <err.h>
#include <fcntl.h>
#include <errno.h>
#include <paths.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@ -569,7 +570,7 @@ main(argc,argv)
for (; --cnt >= 0; mp++) {
if (!strncmp(mp->f_fstypename, "ufs", MFSNAMELEN)) {
if ((nm = strrchr(mp->f_mntfromname,'/'))) {
sprintf(dev,"/dev/%s",nm + 1);
sprintf(dev,"%s%s",_PATH_DEV,nm + 1);
nm = dev;
} else
nm = mp->f_mntfromname;

View file

@ -38,6 +38,7 @@ static const char rcsid[] =
#include "ypxfrd.h"
#include <err.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h> /* getenv, exit */
#include <unistd.h>
@ -240,10 +241,10 @@ main(argc, argv)
size = getdtablesize();
for (i = 0; i < size; i++)
(void) close(i);
i = open("/dev/console", 2);
i = open(_PATH_CONSOLE, 2);
(void) dup2(i, 1);
(void) dup2(i, 2);
i = open("/dev/tty", 2);
i = open(_PATH_TTY, 2);
if (i >= 0) {
(void) ioctl(i, TIOCNOTTY, (char *)NULL);
(void) close(i);

View file

@ -39,6 +39,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -156,7 +157,7 @@ main(int argc, char **argv)
if (strchr(Devname, '/') == NULL) {
char *acp = malloc(6 + strlen(Devname));
strcpy(acp, "/dev/");
strcpy(acp, _PATH_DEV);
strcat(acp, Devname);
Devname = acp;
}

View file

@ -39,6 +39,7 @@ static char copyright[] =
#ifndef lint
static char sccsid[] = "@(#)sliplogin.c 8.2 (Berkeley) 2/1/94";
static char rscid[] = "@(#)$FreeBSD$";
#endif /* not lint */
/*
@ -82,6 +83,7 @@ static char sccsid[] = "@(#)sliplogin.c 8.2 (Berkeley) 2/1/94";
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <paths.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
@ -375,7 +377,7 @@ main(argc, argv)
FILE *iffile; /* interfaces file */
char *p;
int n;
char devnam[MAXPATHLEN] = "/dev/tty"; /* Device name */
char devnam[MAXPATHLEN] = _PATH_TTY; /* Device name */
if ((name = strrchr(argv[0], '/')) == NULL)
name = argv[0];
@ -510,7 +512,7 @@ main(argc, argv)
(void) close(1);
if ((fd = open(_PATH_DEVNULL, O_WRONLY)) != 1) {
if (fd < 0) {
syslog(LOG_ERR, "open /dev/null: %m");
syslog(LOG_ERR, "open %s: %m", _PATH_DEVNULL);
exit(1);
}
(void) dup2(fd, 1);

View file

@ -49,6 +49,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
@ -263,7 +264,7 @@ config(vnp)
* Operate on vnp->dev because it is used later.
*/
if (vnp->dev[0] != '/' && vnp->dev[0] != '.')
(void)asprintf(&vnp->dev, "/dev/%s", vnp->dev);
(void)asprintf(&vnp->dev, "%s%s", _PATH_DEV, vnp->dev);
dev = vnp->dev;
file = vnp->file;
flags = vnp->flags;

View file

@ -26,6 +26,7 @@ static const char rcsid[] =
#include <err.h>
#include <locale.h>
#include <paths.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@ -139,7 +140,7 @@ fatal(err, buf)
int
open_snp()
{
char snp[] = {"/dev/snpX"};
char snp[] = {_PATH_DEV "snpX"};
char c;
int f, mode;
@ -233,14 +234,14 @@ set_dev(name)
char buf[DEV_NAME_LEN];
struct stat sb;
if (strlen(name) > 5 && !strncmp(name, "/dev/", 5)) {
if (strlen(name) > 5 && !strncmp(name, _PATH_DEV, sizeof _PATH_DEV - 1)) {
snprintf(buf, sizeof buf, "%s", name);
}
else {
if (strlen(name) == 2)
sprintf(buf, "/dev/tty%s", name);
sprintf(buf, "%s%s", _PATH_TTY, name);
else
sprintf(buf, "/dev/%s", name);
sprintf(buf, "%s%s", _PATH_DEV, name);
}
if (*name == '\0' || stat(buf, &sb) < 0)