aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/Makefile.inc2
-rw-r--r--lib/libc/sys/Symbol.map41
-rw-r--r--lib/libc/sys/getdents.c41
-rw-r--r--lib/libc/sys/getdirentries.28
-rw-r--r--lib/libc/sys/lstat.c43
-rw-r--r--lib/libc/sys/mknod.c45
-rw-r--r--lib/libc/sys/stat.c43
-rw-r--r--lib/libc/sys/statfs.26
8 files changed, 194 insertions, 35 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 76eeebd9d71c..b641125096d1 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -35,6 +35,8 @@ SRCS+= \
__error.c \
interposing_table.c
+SRCS+= getdents.c lstat.c mknod.c stat.c
+
SRCS+= futimens.c utimensat.c
NOASM+= futimens.o utimensat.o
PSEUDO+= _futimens.o _utimensat.o
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index 6a5c838a762b..feccda6f6bf4 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -85,26 +85,19 @@ FBSD_1.0 {
fchown;
fcntl;
fhopen;
- fhstat;
- fhstatfs;
flock;
fork;
fpathconf;
- fstat;
- fstatfs;
fsync;
futimes;
getaudit;
getaudit_addr;
getauid;
getcontext;
- getdents;
- getdirentries;
getdtablesize;
getegid;
geteuid;
getfh;
- getfsstat;
getgid;
getgroups;
getitimer;
@@ -163,7 +156,6 @@ FBSD_1.0 {
link;
lio_listio;
listen;
- lstat;
lutimes;
mac_syscall;
madvise;
@@ -171,7 +163,6 @@ FBSD_1.0 {
minherit;
mkdir;
mkfifo;
- mknod;
mlock;
mlockall;
modfind;
@@ -192,10 +183,7 @@ FBSD_1.0 {
netbsd_lchown;
netbsd_msync;
nfssvc;
- nfstat;
- nlstat;
nmount;
- nstat;
ntp_adjtime;
ntp_gettime;
open;
@@ -275,8 +263,6 @@ FBSD_1.0 {
sigwaitinfo;
socket;
socketpair;
- stat;
- statfs;
swapoff;
swapon;
symlink;
@@ -330,7 +316,6 @@ FBSD_1.1 {
fchmodat;
fchownat;
fexecve;
- fstatat;
futimesat;
jail_get;
jail_set;
@@ -339,7 +324,6 @@ FBSD_1.1 {
lpathconf;
mkdirat;
mkfifoat;
- mknodat;
msgctl;
readlinkat;
renameat;
@@ -401,6 +385,19 @@ FBSD_1.4 {
FBSD_1.5 {
clock_nanosleep;
fdatasync;
+ fhstat;
+ fhstatfs;
+ fstat;
+ fstatat;
+ fstatfs;
+ getdents;
+ getdirentries;
+ getfsstat;
+ lstat;
+ mknod;
+ mknodat;
+ stat;
+ statfs;
};
FBSDprivate_1.0 {
@@ -606,8 +603,6 @@ FBSDprivate_1.0 {
__sys_getauid;
_getcontext;
__sys_getcontext;
- _getdents;
- __sys_getdents;
_getdirentries;
__sys_getdirentries;
_getdtablesize;
@@ -736,8 +731,6 @@ FBSDprivate_1.0 {
__sys_lio_listio;
_listen;
__sys_listen;
- _lstat;
- __sys_lstat;
_lutimes;
__sys_lutimes;
_mac_syscall;
@@ -796,14 +789,8 @@ FBSDprivate_1.0 {
__sys_netbsd_msync;
_nfssvc;
__sys_nfssvc;
- _nfstat;
- __sys_nfstat;
- _nlstat;
- __sys_nlstat;
_nmount;
__sys_nmount;
- _nstat;
- __sys_nstat;
_ntp_adjtime;
__sys_ntp_adjtime;
_ntp_gettime;
@@ -971,8 +958,6 @@ FBSDprivate_1.0 {
__sys_socket;
_socketpair;
__sys_socketpair;
- _stat;
- __sys_stat;
_statfs;
__sys_statfs;
_swapcontext;
diff --git a/lib/libc/sys/getdents.c b/lib/libc/sys/getdents.c
new file mode 100644
index 000000000000..c8a2878c972f
--- /dev/null
+++ b/lib/libc/sys/getdents.c
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2012 Gleb Kurtsou <gleb@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <sys/param.h>
+#include <sys/syscall.h>
+#include <dirent.h>
+#include "libc_private.h"
+
+ssize_t
+getdents(int fd, char *buf, size_t nbytes)
+{
+
+ return (__sys_getdirentries(fd, buf, nbytes, NULL));
+}
diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2
index ace8faa7521c..d3f2129d400f 100644
--- a/lib/libc/sys/getdirentries.2
+++ b/lib/libc/sys/getdirentries.2
@@ -40,10 +40,10 @@
.Sh SYNOPSIS
.In sys/types.h
.In dirent.h
-.Ft int
-.Fn getdirentries "int fd" "char *buf" "int nbytes" "long *basep"
-.Ft int
-.Fn getdents "int fd" "char *buf" "int nbytes"
+.Ft ssize_t
+.Fn getdirentries "int fd" "char *buf" "size_t nbytes" "off_t *basep"
+.Ft ssize_t
+.Fn getdents "int fd" "char *buf" "size_t nbytes"
.Sh DESCRIPTION
The
.Fn getdirentries
diff --git a/lib/libc/sys/lstat.c b/lib/libc/sys/lstat.c
new file mode 100644
index 000000000000..ccc73e3d3d06
--- /dev/null
+++ b/lib/libc/sys/lstat.c
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2012 Gleb Kurtsou <gleb@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <sys/param.h>
+#include <sys/fcntl.h>
+#include <sys/syscall.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include "libc_private.h"
+
+int
+lstat(const char *path, struct stat *sb)
+{
+
+ return (__sys_fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW));
+}
diff --git a/lib/libc/sys/mknod.c b/lib/libc/sys/mknod.c
new file mode 100644
index 000000000000..3bb3853b5849
--- /dev/null
+++ b/lib/libc/sys/mknod.c
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2011 Gleb Kurtsou <gleb@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <sys/param.h>
+#include <sys/fcntl.h>
+#include <sys/syscall.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include "libc_private.h"
+
+int __sys_mknodat(int, const char *, mode_t, dev_t);
+
+int
+mknod(const char *path, mode_t mode, dev_t dev)
+{
+
+ return (__sys_mknodat(AT_FDCWD, path, mode, dev));
+}
diff --git a/lib/libc/sys/stat.c b/lib/libc/sys/stat.c
new file mode 100644
index 000000000000..6b58daa9e515
--- /dev/null
+++ b/lib/libc/sys/stat.c
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2012 Gleb Kurtsou <gleb@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <sys/param.h>
+#include <sys/fcntl.h>
+#include <sys/syscall.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include "libc_private.h"
+
+int
+stat(const char *path, struct stat *sb)
+{
+
+ return (__sys_fstatat(AT_FDCWD, path, sb, 0));
+}
diff --git a/lib/libc/sys/statfs.2 b/lib/libc/sys/statfs.2
index 7a95871125ca..a7383c4ce12b 100644
--- a/lib/libc/sys/statfs.2
+++ b/lib/libc/sys/statfs.2
@@ -28,7 +28,7 @@
.\" @(#)statfs.2 8.5 (Berkeley) 5/24/95
.\" $FreeBSD$
.\"
-.Dd November 1, 2006
+.Dd February 13, 2017
.Dt STATFS 2
.Os
.Sh NAME
@@ -66,8 +66,8 @@ typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */
*/
#define MFSNAMELEN 16 /* length of type name including null */
-#define MNAMELEN 88 /* size of on/from name bufs */
-#define STATFS_VERSION 0x20030518 /* current version number */
+#define MNAMELEN 1024 /* size of on/from name bufs */
+#define STATFS_VERSION 0x20140518 /* current version number */
struct statfs {
uint32_t f_version; /* structure version number */