Pull latest changes from OpenBSD:

- improve sysinfo(2) syscall;
- add dummy fadvise64(2) syscall;
- add dummy *xattr(2) family of syscalls;
- add protos for the syscalls 222-225, 238-249 and 253-267;
- add exit_group(2) syscall, which is currently just wired to exit(2).

Obtained from:  OpenBSD
MFC after:      2 weeks
This commit is contained in:
Maxim Sobolev 2003-11-16 15:07:10 +00:00
parent 5303e94607
commit d09c47acd9
6 changed files with 194 additions and 4 deletions

View File

@ -97,6 +97,7 @@ static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = {
struct l_sysinfo {
l_long uptime; /* Seconds since boot */
l_ulong loads[3]; /* 1, 5, and 15 minute load averages */
#define LINUX_SYSINFO_LOADS_SCALE 65536
l_ulong totalram; /* Total usable main memory size */
l_ulong freeram; /* Available memory size */
l_ulong sharedram; /* Amount of shared memory */
@ -104,7 +105,10 @@ struct l_sysinfo {
l_ulong totalswap; /* Total swap space size */
l_ulong freeswap; /* swap space still available */
l_ushort procs; /* Number of current processes */
char _f[22]; /* Pads structure to 64 bytes */
l_ulong totalbig;
l_ulong freebig;
l_uint mem_unit;
char _f[6]; /* Pads structure to 64 bytes */
};
#ifndef __alpha__
int
@ -134,7 +138,8 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
/* Use the information from the mib to get our load averages */
for (i = 0; i < 3; i++)
sysinfo.loads[i] = averunnable.ldavg[i];
sysinfo.loads[i] = averunnable.ldavg[i] *
LINUX_SYSINFO_LOADS_SCALE / averunnable.fscale;
sysinfo.totalram = physmem * PAGE_SIZE;
sysinfo.freeram = sysinfo.totalram - cnt.v_wire_count * PAGE_SIZE;
@ -152,7 +157,12 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
sysinfo.totalswap= i * PAGE_SIZE;
sysinfo.freeswap = (i - j) * PAGE_SIZE;
sysinfo.procs = 20; /* Hack */
sysinfo.procs = nprocs;
/* The following are only present in newer Linux kernels. */
sysinfo.totalbig = 0;
sysinfo.freebig = 0;
sysinfo.mem_unit = 1;
return copyout(&sysinfo, args->info, sizeof(sysinfo));
}

View File

@ -70,3 +70,25 @@ DUMMY(setfsgid);
DUMMY(pivot_root);
DUMMY(mincore);
DUMMY(madvise);
DUMMY(fadvise64);
#define DUMMY_XATTR(s) \
int \
linux_ ## s ## xattr( \
struct thread *td, struct linux_ ## s ## xattr_args *arg) \
{ \
\
return (ENOATTR); \
}
DUMMY_XATTR(set);
DUMMY_XATTR(lset);
DUMMY_XATTR(fset);
DUMMY_XATTR(get);
DUMMY_XATTR(lget);
DUMMY_XATTR(fget);
DUMMY_XATTR(list);
DUMMY_XATTR(llist);
DUMMY_XATTR(flist);
DUMMY_XATTR(remove);
DUMMY_XATTR(lremove);
DUMMY_XATTR(fremove);

View File

@ -644,6 +644,45 @@ struct linux_fcntl64_args {
char cmd_l_[PADL_(l_uint)]; l_uint cmd; char cmd_r_[PADR_(l_uint)];
char arg_l_[PADL_(l_ulong)]; l_ulong arg; char arg_r_[PADR_(l_ulong)];
};
struct linux_setxattr_args {
register_t dummy;
};
struct linux_lsetxattr_args {
register_t dummy;
};
struct linux_fsetxattr_args {
register_t dummy;
};
struct linux_getxattr_args {
register_t dummy;
};
struct linux_lgetxattr_args {
register_t dummy;
};
struct linux_fgetxattr_args {
register_t dummy;
};
struct linux_listxattr_args {
register_t dummy;
};
struct linux_llistxattr_args {
register_t dummy;
};
struct linux_flistxattr_args {
register_t dummy;
};
struct linux_removexattr_args {
register_t dummy;
};
struct linux_lremovexattr_args {
register_t dummy;
};
struct linux_fremovexattr_args {
register_t dummy;
};
struct linux_fadvise64_args {
register_t dummy;
};
int linux_fork(struct thread *, struct linux_fork_args *);
int linux_open(struct thread *, struct linux_open_args *);
int linux_waitpid(struct thread *, struct linux_waitpid_args *);
@ -797,6 +836,19 @@ int linux_mincore(struct thread *, struct linux_mincore_args *);
int linux_madvise(struct thread *, struct linux_madvise_args *);
int linux_getdents64(struct thread *, struct linux_getdents64_args *);
int linux_fcntl64(struct thread *, struct linux_fcntl64_args *);
int linux_setxattr(struct thread *, struct linux_setxattr_args *);
int linux_lsetxattr(struct thread *, struct linux_lsetxattr_args *);
int linux_fsetxattr(struct thread *, struct linux_fsetxattr_args *);
int linux_getxattr(struct thread *, struct linux_getxattr_args *);
int linux_lgetxattr(struct thread *, struct linux_lgetxattr_args *);
int linux_fgetxattr(struct thread *, struct linux_fgetxattr_args *);
int linux_listxattr(struct thread *, struct linux_listxattr_args *);
int linux_llistxattr(struct thread *, struct linux_llistxattr_args *);
int linux_flistxattr(struct thread *, struct linux_flistxattr_args *);
int linux_removexattr(struct thread *, struct linux_removexattr_args *);
int linux_lremovexattr(struct thread *, struct linux_lremovexattr_args *);
int linux_fremovexattr(struct thread *, struct linux_fremovexattr_args *);
int linux_fadvise64(struct thread *, struct linux_fadvise64_args *);
#ifdef COMPAT_43

View File

@ -213,4 +213,18 @@
#define LINUX_SYS_linux_madvise 219
#define LINUX_SYS_linux_getdents64 220
#define LINUX_SYS_linux_fcntl64 221
#define LINUX_SYS_MAXSYSCALL 222
#define LINUX_SYS_linux_setxattr 226
#define LINUX_SYS_linux_lsetxattr 227
#define LINUX_SYS_linux_fsetxattr 228
#define LINUX_SYS_linux_getxattr 229
#define LINUX_SYS_linux_lgetxattr 230
#define LINUX_SYS_linux_fgetxattr 231
#define LINUX_SYS_linux_listxattr 232
#define LINUX_SYS_linux_llistxattr 233
#define LINUX_SYS_linux_flistxattr 234
#define LINUX_SYS_linux_removexattr 235
#define LINUX_SYS_linux_lremovexattr 236
#define LINUX_SYS_linux_fremovexattr 237
#define LINUX_SYS_linux_fadvise64 250
#define LINUX_SYS_exit_group 252
#define LINUX_SYS_MAXSYSCALL 268

View File

@ -239,4 +239,50 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)linux_madvise }, /* 219 = linux_madvise */
{ AS(linux_getdents64_args), (sy_call_t *)linux_getdents64 }, /* 220 = linux_getdents64 */
{ AS(linux_fcntl64_args), (sy_call_t *)linux_fcntl64 }, /* 221 = linux_fcntl64 */
{ 0, (sy_call_t *)nosys }, /* 222 = */
{ 0, (sy_call_t *)nosys }, /* 223 = */
{ 0, (sy_call_t *)nosys }, /* 224 = linux_gettid */
{ 0, (sy_call_t *)nosys }, /* 225 = linux_readahead */
{ 0, (sy_call_t *)linux_setxattr }, /* 226 = linux_setxattr */
{ 0, (sy_call_t *)linux_lsetxattr }, /* 227 = linux_lsetxattr */
{ 0, (sy_call_t *)linux_fsetxattr }, /* 228 = linux_fsetxattr */
{ 0, (sy_call_t *)linux_getxattr }, /* 229 = linux_getxattr */
{ 0, (sy_call_t *)linux_lgetxattr }, /* 230 = linux_lgetxattr */
{ 0, (sy_call_t *)linux_fgetxattr }, /* 231 = linux_fgetxattr */
{ 0, (sy_call_t *)linux_listxattr }, /* 232 = linux_listxattr */
{ 0, (sy_call_t *)linux_llistxattr }, /* 233 = linux_llistxattr */
{ 0, (sy_call_t *)linux_flistxattr }, /* 234 = linux_flistxattr */
{ 0, (sy_call_t *)linux_removexattr }, /* 235 = linux_removexattr */
{ 0, (sy_call_t *)linux_lremovexattr }, /* 236 = linux_lremovexattr */
{ 0, (sy_call_t *)linux_fremovexattr }, /* 237 = linux_fremovexattr */
{ 0, (sy_call_t *)nosys }, /* 238 = linux_tkill */
{ 0, (sy_call_t *)nosys }, /* 239 = linux_sendfile64 */
{ 0, (sy_call_t *)nosys }, /* 240 = linux_futex */
{ 0, (sy_call_t *)nosys }, /* 241 = linux_sched_setaffinity */
{ 0, (sy_call_t *)nosys }, /* 242 = linux_sched_getaffinity */
{ 0, (sy_call_t *)nosys }, /* 243 = linux_set_thread_area */
{ 0, (sy_call_t *)nosys }, /* 244 = linux_get_thread_area */
{ 0, (sy_call_t *)nosys }, /* 245 = linux_io_setup */
{ 0, (sy_call_t *)nosys }, /* 246 = linux_io_destroy */
{ 0, (sy_call_t *)nosys }, /* 247 = linux_io_getevents */
{ 0, (sy_call_t *)nosys }, /* 248 = linux_io_submit */
{ 0, (sy_call_t *)nosys }, /* 249 = linux_io_cancel */
{ 0, (sy_call_t *)linux_fadvise64 }, /* 250 = linux_fadvise64 */
{ 0, (sy_call_t *)nosys }, /* 251 = */
{ SYF_MPSAFE | AS(sys_exit_args), (sy_call_t *)sys_exit }, /* 252 = exit_group */
{ 0, (sy_call_t *)nosys }, /* 253 = linux_lookup_dcookie */
{ 0, (sy_call_t *)nosys }, /* 254 = linux_epoll_create */
{ 0, (sy_call_t *)nosys }, /* 255 = linux_epoll_ctl */
{ 0, (sy_call_t *)nosys }, /* 256 = linux_epoll_wait */
{ 0, (sy_call_t *)nosys }, /* 257 = linux_remap_file_pages */
{ 0, (sy_call_t *)nosys }, /* 258 = linux_set_tid_address */
{ 0, (sy_call_t *)nosys }, /* 259 = linux_timer_create */
{ 0, (sy_call_t *)nosys }, /* 260 = linux_timer_settime */
{ 0, (sy_call_t *)nosys }, /* 261 = linux_timer_gettime */
{ 0, (sy_call_t *)nosys }, /* 262 = linux_timer_getoverrun */
{ 0, (sy_call_t *)nosys }, /* 263 = linux_timer_delete */
{ 0, (sy_call_t *)nosys }, /* 264 = linux_clock_settime */
{ 0, (sy_call_t *)nosys }, /* 265 = linux_clock_gettime */
{ 0, (sy_call_t *)nosys }, /* 266 = linux_clock_getres */
{ 0, (sy_call_t *)nosys }, /* 267 = linux_clock_nanosleep */
};

View File

@ -338,3 +338,49 @@
l_uint count); }
221 STD LINUX { int linux_fcntl64(l_uint fd, l_uint cmd, \
l_ulong arg); }
222 UNIMPL
223 UNIMPL
224 UNIMPL LINUX linux_gettid
225 UNIMPL LINUX linux_readahead
226 STD LINUX { int linux_setxattr(void); }
227 STD LINUX { int linux_lsetxattr(void); }
228 STD LINUX { int linux_fsetxattr(void); }
229 STD LINUX { int linux_getxattr(void); }
230 STD LINUX { int linux_lgetxattr(void); }
231 STD LINUX { int linux_fgetxattr(void); }
232 STD LINUX { int linux_listxattr(void); }
233 STD LINUX { int linux_llistxattr(void); }
234 STD LINUX { int linux_flistxattr(void); }
235 STD LINUX { int linux_removexattr(void); }
236 STD LINUX { int linux_lremovexattr(void); }
237 STD LINUX { int linux_fremovexattr(void); }
238 UNIMPL LINUX linux_tkill
239 UNIMPL LINUX linux_sendfile64
240 UNIMPL LINUX linux_futex
241 UNIMPL LINUX linux_sched_setaffinity
242 UNIMPL LINUX linux_sched_getaffinity
243 UNIMPL LINUX linux_set_thread_area
244 UNIMPL LINUX linux_get_thread_area
245 UNIMPL LINUX linux_io_setup
246 UNIMPL LINUX linux_io_destroy
247 UNIMPL LINUX linux_io_getevents
248 UNIMPL LINUX linux_io_submit
249 UNIMPL LINUX linux_io_cancel
250 STD LINUX { int linux_fadvise64(void); }
251 UNIMPL
252 MNOPROTO LINUX { void sys_exit(int rval); } exit_group sys_exit_args void
253 UNIMPL LINUX linux_lookup_dcookie
254 UNIMPL LINUX linux_epoll_create
255 UNIMPL LINUX linux_epoll_ctl
256 UNIMPL LINUX linux_epoll_wait
257 UNIMPL LINUX linux_remap_file_pages
258 UNIMPL LINUX linux_set_tid_address
259 UNIMPL LINUX linux_timer_create
260 UNIMPL LINUX linux_timer_settime
261 UNIMPL LINUX linux_timer_gettime
262 UNIMPL LINUX linux_timer_getoverrun
263 UNIMPL LINUX linux_timer_delete
264 UNIMPL LINUX linux_clock_settime
265 UNIMPL LINUX linux_clock_gettime
266 UNIMPL LINUX linux_clock_getres
267 UNIMPL LINUX linux_clock_nanosleep