Beispiel #1
0
int
svr4_32_sys_fstat(struct lwp *l, const struct svr4_32_sys_fstat_args *uap, register_t *retval)
{
#ifdef SVR4_NO_OSTAT
	struct svr4_32_sys_fxstat_args cup;

	SCARG(&cup, two) = 2;
	SCARG(&cup, fd) = SCARG(uap, fd);
	SCARG(&cup, sb) = SCARG(uap, sb);
	return svr4_32_sys_fxstat(l, &cup, retval);
#else
	struct stat		st;
	struct svr4_32_stat	svr4_st;
	int			error;

	error = do_sys_fstat(SCARG(uap, fd), &st);
	if (error != 0)
		return error;

	bsd_to_svr4_32_stat(&st, &svr4_st);

	return copyout(&svr4_st, SCARG_P32(uap, ub),
			     sizeof svr4_st);
#endif
}
Beispiel #2
0
int
svr4_sys_fstat64(struct lwp *l, const struct svr4_sys_fstat64_args *uap, register_t *retval)
{
	struct svr4_stat64	svr4_st;
	struct stat		st;
	int			error;

	error = do_sys_fstat(SCARG(uap, fd), &st);
	if (error != 0)
		return error;

	bsd_to_svr4_stat64(&st, &svr4_st);

	return copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st);
}
Beispiel #3
0
/*
 * Return status information about a file descriptor.
 */
int
sys___fstat50(struct lwp *l, const struct sys___fstat50_args *uap,
	      register_t *retval)
{
	/* {
		syscallarg(int)			fd;
		syscallarg(struct stat *)	sb;
	} */
	struct stat sb;
	int error;

	error = do_sys_fstat(SCARG(uap, fd), &sb);
	if (error == 0) {
		error = copyout(&sb, SCARG(uap, sb), sizeof(sb));
	}
	return error;
}
int
compat_30_netbsd32___fstat13(struct lwp *l, const struct compat_30_netbsd32___fstat13_args *uap, register_t *retval)
{
	/* {
		syscallarg(int) fd;
		syscallarg(netbsd32_stat13p_t) sb;
	} */
	struct netbsd32_stat13 sb32;
	struct stat ub;
	int error;

	error = do_sys_fstat(SCARG(uap, fd), &ub);
	if (error == 0) {
		netbsd32_from___stat13(&ub, &sb32);
		error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb32));
	}
	return (error);
}
Beispiel #5
0
/*
 * The stat functions below are plain sailing. stat and lstat are handled
 * by one function to avoid code duplication.
 */
int
linux_sys_fstat(struct lwp *l, const struct linux_sys_fstat_args *uap, register_t *retval)
{
	/* {
		syscallarg(int) fd;
		syscallarg(linux_stat *) sp;
	} */
	struct linux_stat tmplst;
	struct stat tmpst;
	int error;

	error = do_sys_fstat(SCARG(uap, fd), &tmpst);
	if (error != 0)
		return error;
	bsd_to_linux_stat(&tmpst, &tmplst);

	return copyout(&tmplst, SCARG(uap, sp), sizeof tmplst);
}
int
ibcs2_sys_fstat(struct lwp *l, const struct ibcs2_sys_fstat_args *uap, register_t *retval)
{
	/* {
		syscallarg(int) fd;
		syscallarg(struct ibcs2_stat *) st;
	} */
	struct stat sb;
	struct ibcs2_stat ibcs2_st;
	int error;

	error = do_sys_fstat(SCARG(uap, fd), &sb);
	if (error != 0)
		return error;

	bsd_stat2ibcs_stat(&sb, &ibcs2_st);
	return copyout(&ibcs2_st, SCARG(uap, st), sizeof (ibcs2_st));
}
int
linux32_sys_fstat64(struct lwp *l, const struct linux32_sys_fstat64_args *uap, register_t *retval)
{
	/* {
	        syscallarg(int) fd;
	        syscallarg(linux32_stat64p) sp;
	} */
	int error;
	struct stat st;
	struct linux32_stat64 st32;

	error = do_sys_fstat(SCARG(uap, fd), &st);
	if (error != 0)
		return error;

	bsd_to_linux32_stat64(&st, &st32);
	return copyout(&st32, SCARG_P32(uap, sp), sizeof(st32));
}
/* ARGSUSED */
int
compat_43_sys_fstat(struct lwp *l, const struct compat_43_sys_fstat_args *uap, register_t *retval)
{
	/* {
		syscallarg(int) fd;
		syscallarg(struct stat43 *) sb;
	} */
	struct stat ub;
	struct stat43 oub;
	int error;

	error = do_sys_fstat(SCARG(uap, fd), &ub);
	if (error == 0) {
		cvtstat(&ub, &oub);
		error = copyout((void *)&oub, (void *)SCARG(uap, sb),
		    sizeof (oub));
	}

	return (error);
}