int svr4_32_sys_lstat(struct lwp *l, const struct svr4_32_sys_lstat_args *uap, register_t *retval) { #ifdef SVR4_NO_OSTAT struct svr4_32_sys_lxstat_args cup; SCARG(&cup, two) = 2; SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = SCARG(uap, ub); return svr4_32_sys_lxstat(l, &cup, retval); #else struct stat st; struct svr4_32_stat svr4_st; int error; error = do_sys_stat(SCARG(&cup, path), NOFOLLOW, &st); if (error != 0) return error; bsd_to_svr4_32_stat(&st, &svr4_st); if (S_ISSOCK(st.st_mode)) (void) svr4_add_socket(p, SCARG(&cup, path), &st); return copyout(&svr4_st, SCARG_P32(uap, ub), sizeof svr4_st); #endif }
/* ARGSUSED */ int osf1_sys_stat2(struct lwp *l, const struct osf1_sys_stat2_args *uap, register_t *retval) { struct stat sb; struct osf1_stat2 osb; int error; error = do_sys_stat(SCARG(uap, path), FOLLOW, &sb); if (error) return (error); osf1_cvt_stat2_from_native(&sb, &osb); error = copyout((void *)&osb, (void *)SCARG(uap, ub), sizeof (osb)); return (error); }
static int linux_stat1(const struct linux_sys_stat_args *uap, register_t *retval, int flags) { struct linux_stat tmplst; struct stat tmpst; int error; error = do_sys_stat(SCARG(uap, path), flags, &tmpst); if (error != 0) return error; bsd_to_linux_stat(&tmpst, &tmplst); return copyout(&tmplst, SCARG(uap, sp), sizeof tmplst); }
/* ARGSUSED */ int compat_43_sys_stat(struct lwp *l, const struct compat_43_sys_stat_args *uap, register_t *retval) { /* { syscallarg(char *) path; syscallarg(struct stat43 *) ub; } */ struct stat sb; struct stat43 osb; int error; error = do_sys_stat(SCARG(uap, path), FOLLOW, &sb); if (error) return (error); cvtstat(&sb, &osb); error = copyout((void *)&osb, (void *)SCARG(uap, ub), sizeof (osb)); return (error); }
int svr4_sys_lstat64(struct lwp *l, const struct svr4_sys_lstat64_args *uap, register_t *retval) { struct stat st; struct svr4_stat64 svr4_st; int error; error = do_sys_stat(SCARG(uap, path), NOFOLLOW, &st); if (error != 0) return error; bsd_to_svr4_stat64(&st, &svr4_st); if (S_ISSOCK(st.st_mode)) (void) svr4_add_socket(l->l_proc, SCARG(uap, path), &st); return copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st); }
/* ARGSUSED */ int compat_12_sys_lstat(struct lwp *l, const struct compat_12_sys_lstat_args *uap, register_t *retval) { /* { syscallarg(const char *) path; syscallarg(struct stat12 *) ub; } */ struct stat sb; struct stat12 osb; int error; error = do_sys_stat(SCARG(uap, path), NOFOLLOW, &sb); if (error) return (error); compat_12_stat_conv(&sb, &osb); error = copyout(&osb, SCARG(uap, ub), sizeof (osb)); return (error); }
int ibcs2_sys_stat(struct lwp *l, const struct ibcs2_sys_stat_args *uap, register_t *retval) { /* { syscallarg(const char *) path; syscallarg(struct ibcs2_stat *) st; } */ struct stat sb; struct ibcs2_stat ibcs2_st; int error; error = do_sys_stat(SCARG(uap, path), FOLLOW, &sb); if (error != 0) return error; bsd_stat2ibcs_stat(&sb, &ibcs2_st); return copyout(&ibcs2_st, SCARG(uap, st), sizeof (ibcs2_st)); }
int compat_43_netbsd32_lstat43(struct lwp *l, const struct compat_43_netbsd32_lstat43_args *uap, register_t *retval) { /* { syscallarg(const netbsd32_charp) path; syscallarg(netbsd32_stat43p_t) ub; } */ struct stat sb; struct netbsd32_stat43 sb32; int error; error = do_sys_stat(SCARG_P32(uap, path), NOFOLLOW, &sb); if (error == 0) { netbsd32_from_stat(&sb, &sb32); error = copyout(&sb32, SCARG_P32(uap, ub), sizeof(sb32)); } return error; }
int linux32_sys_lstat64(struct lwp *l, const struct linux32_sys_lstat64_args *uap, register_t *retval) { /* { syscallarg(netbsd32_charp) path; syscallarg(linux32_stat64p) sp; } */ int error; struct stat st; struct linux32_stat64 st32; error = do_sys_stat(SCARG_P32(uap, path), NOFOLLOW, &st); if (error != 0) return error; bsd_to_linux32_stat64(&st, &st32); return copyout(&st32, SCARG_P32(uap, sp), sizeof(st32)); }
int svr4_32_sys_lxstat(struct lwp *l, const struct svr4_32_sys_lxstat_args *uap, register_t *retval) { struct stat st; struct svr4_32_xstat svr4_st; int error; const char *path = SCARG_P32(uap, path); error = do_sys_stat(path, NOFOLLOW, &st); if (error != 0) return error; bsd_to_svr4_32_xstat(&st, &svr4_st); if (S_ISSOCK(st.st_mode)) (void) svr4_add_socket(l->l_proc, path, &st); return copyout(&svr4_st, SCARG_P32(uap, ub), sizeof svr4_st); }
static int doesitexist(const char *path, bool isblk, devmajor_t dmaj, devminor_t dmin) { struct stat sb; int error; error = do_sys_stat(path, 0, &sb); /* even if not ENOENT, we might be able to create it */ if (error) return NOTEXIST; if (major(sb.st_rdev) != dmaj || minor(sb.st_rdev) != dmin) return DIFFERENT; if (isblk && !S_ISBLK(sb.st_mode)) return DIFFERENT; if (!isblk && !S_ISCHR(sb.st_mode)) return DIFFERENT; return SAME; }
int compat_30_netbsd32___stat13(struct lwp *l, const struct compat_30_netbsd32___stat13_args *uap, register_t *retval) { /* { syscallarg(const netbsd32_charp) path; syscallarg(netbsd32_stat13p_t) ub; } */ struct netbsd32_stat13 sb32; struct stat sb; int error; const char *path; path = SCARG_P32(uap, path); error = do_sys_stat(path, FOLLOW, &sb); if (error) return (error); netbsd32_from___stat13(&sb, &sb32); error = copyout(&sb32, SCARG_P32(uap, ub), sizeof(sb32)); return (error); }
int linux32_sys_lstat64(struct lwp *l, const struct linux32_sys_lstat64_args *uap, register_t *retval) { /* { syscallarg(netbsd32_charp) path; syscallarg(linux32_stat64p) sp; } */ int error; struct stat st; struct linux32_stat64 st32; struct linux32_stat64 *st32p; const char *path = SCARG_P32(uap, path); error = do_sys_stat(path, NOFOLLOW, &st); if (error != 0) return error; linux32_from_stat(&st, &st32); st32p = SCARG_P32(uap, sp); return copyout(&st32, st32p, sizeof(*st32p)); }