Commit Graph

382 Commits

Author SHA1 Message Date
Martin Blapp
f130dcf22a Change the semantics of sysv shm emulation to take a additional
argument to the functions shm{at,ctl}1 and shm_find_segment_by_shmid{x}.
The BSD semantics didn't allow the usage of shared segment after
being marked for removal through IPC_RMID.

The patch involves the following functions:
  - shmat
  - shmctl
  - shm_find_segment_by_shmid
  - shm_find_segment_by_shmidx
  - linux_shmat
  - linux_shmctl

Submitted by:	Orlando Bassotto <orlando.bassotto@ieo-research.it>
Reviewed by:	marcel
2003-05-05 09:22:58 +00:00
Martin Blapp
a966b13d67 Initialize tbuf in newstat_copyout() too.
Reviewed by:	phk
2003-04-29 17:03:22 +00:00
Alexander Kabaev
104a9b7e3e Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on:	standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-04-29 13:36:06 +00:00
Martin Blapp
616aa29a0e Do the same thing for stat64_copyout() as we already
do for newstat_copyout().

Lie about disk drives which are character devices
in FreeBSD but block devices under Linux.

PR:		37227
Submitted by:	Vladimir B. Grebenschikov <vova@sw.ru>
Reviewed by:	phk
MFC after:	2 weeks
2003-04-29 12:36:03 +00:00
John Baldwin
2f7ed219b2 Argh! We want to return the old signal set when the error return is zero
(i.e. success), not non-zero (failure).

Submitted by:	tegge
Pointy hat to:	jhb
2003-04-28 19:43:11 +00:00
John Baldwin
19dde5cd3b Use a switch to convert the Linux sigprocmask flags to the equivalent
FreeBSD flags instead of just adding one to the Linux flags.  This should
be identical to the previous version except that I have at least one report
of this patch fixing problems people were having with Linux apps after my
last commit to this file.  It is safer to use the switch then to make
assumptions about the flag values anyways, esp. since we currently use
MD defines for the values of the flags and this is MI code.

Tested by:	Michael Class <michael_class@gmx.net>
2003-04-25 19:26:18 +00:00
Eric Anholt
caa18809df Add an ioctl handler for the DRM. This removes the need for the DRM_LINUX
option, which has been a source of frustration for many users.
2003-04-24 23:36:35 +00:00
John Baldwin
c6004a6202 Fix a lock order reversal. Unlock the proc before calling fget().
Reported by:	kris
2003-04-23 18:13:26 +00:00
John Baldwin
fe8cdcae87 - Replace inline implementations of sigprocmask() with calls to
kern_sigprocmask() in the various binary compatibility emulators.
- Replace calls to sigsuspend(), sigaltstack(), sigaction(), and
  sigprocmask() that used the stackgap with calls to the corresponding
  kern_sig*() functions instead without using the stackgap.
2003-04-22 18:23:49 +00:00
John Baldwin
9d8643eca6 Don't hold the proc lock while performing sigset conversions on local
variables.
2003-04-17 22:07:56 +00:00
John Baldwin
8804bf6b03 Use local struct proc variables to reduce repeated td->td_proc dereferences
and improve readability.
2003-04-17 22:02:47 +00:00
Poul-Henning Kamp
a300701213 Don't include <sys/disklabel.h> 2003-04-16 20:57:35 +00:00
John Baldwin
20b04da89c Explicitly cast a l_ulong to an unsigned long to make all arch's happy
with the printf format.
2003-04-16 20:43:10 +00:00
John Baldwin
760eb2e033 Fix printf format in a debug printf. 2003-04-16 20:07:48 +00:00
Poul-Henning Kamp
95082542bb Add #include <sys/conf.h> so we don't rely on <sys/disk.h> doing it. 2003-04-01 12:34:47 +00:00
Jeff Roberson
4093529dee - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread with
a follow on commit to kern_sig.c
 - signotify() now operates on a thread since unmasked pending signals are
   stored in the thread.
 - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
2003-03-31 22:49:17 +00:00
Poul-Henning Kamp
10c665ef8f Fix an XXX: and implement LINUX_BLKGETSIZE correctly. 2003-03-28 08:58:11 +00:00
John Baldwin
35eb8c5aa2 Add a cleanup function to destroy the osname_lock and call it on module
unload.

Submitted by:	gallatin
Reported by:	Martin Karlsson <mk-freebsd@bredband.net>
2003-03-26 18:29:44 +00:00
John Baldwin
31566c96f4 Use td->td_ucred instead of td->td_proc->p_ucred. 2003-03-20 21:17:40 +00:00
Poul-Henning Kamp
cc34e37e5b Backout the getcwd changes, a more comprehensive effort will be needed. 2003-03-20 10:40:45 +00:00
Poul-Henning Kamp
9eaf5abceb (This commit certainly increases the need for a wash&clean of vfs_cache.c,
but I decided that it was important for this patch to not bit-rot, and
since it is mainly moving code around, the total amount of entropy is
epsilon /phk)

This is a patch to move the common parts of linux_getcwd() back into
kern/vfs_cache.c so that the standard FreeBSD libc getcwd() can use it's
extended functionality.  The linux syscall linux_getcwd() in
compat/linux/linux_getcwd.c has been rewritten to use it too.  It should
be possible to simplify libc's getcwd() after this.  No doubt this code
needs some cleaning up, since I've left in the sysctl variables I used
for debugging.

PR:	48169
Submitted by:	James Whitwell <abacau@yahoo.com.au>
2003-03-17 12:21:08 +00:00
John Baldwin
b62f75cf44 - Change the linux_[gs]et_os{name, release, s_version}() functions to
take a thread instead of a proc for their first argument.
- Add a mutex to protect the system-wide Linux osname, osrelease, and
  oss_version variables.
- Change linux_get_prison() to take a thread instead of a proc for its
  first argument and to use td_ucred rather than p_ucred.  This is ok
  because a thread's prison does not change even though it's ucred might.
- Also, change linux_get_prison() to return a struct prison * instead of
  a struct linux_prison * since it returns with the struct prison locked
  and this makes it easier to safely unlock the prison when we are done
  messing with it.
2003-03-13 22:45:43 +00:00
Dag-Erling Smørgrav
1d062e2be8 Clean up whitespace and remove register keyword. 2003-03-03 09:17:12 +00:00
Dag-Erling Smørgrav
4b7ef73d71 More caddr_t removal, in conjunction with copy{in,out}(9) this time.
Also clean up some egregious casts and incorrect use of sizeof.
2003-03-03 09:14:26 +00:00
Dag-Erling Smørgrav
8994a245e0 Clean up whitespace, s/register //, refrain from strong urge to ANSIfy. 2003-03-02 15:56:49 +00:00
Dag-Erling Smørgrav
c952458814 uiomove-related caddr_t -> void * (just the low-hanging fruit) 2003-03-02 15:50:23 +00:00
Hajimu UMEMOTO
5b13e7814b Add M_WAITOK 2003-02-20 11:24:55 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Tim J. Robbins
96d7f8ef46 Use the proc lock to protect p_realtimer instead of Giant, and obtain
sched_lock around accesses to p_stats->p_timer[] to avoid a potential
race with hardclock. getitimer(), setitimer() and the realitexpire()
callout are now Giant-free.
2003-02-17 10:03:02 +00:00
Tim J. Robbins
5d58e28570 Add MPSAFE comment to linux_sigpending(). 2003-02-16 02:33:12 +00:00
Tim J. Robbins
fb30aed1a5 Obtain proc lock around modification of p_siglist in linux_wait4(). 2003-02-14 08:59:49 +00:00
David Malone
4d45de743a 1) Linux_sendto was trashing the BSD sockaddr it put in the stackgap,
so be more careful about calling stackgap_init.

    Tested by: Fred Souza <fred@storming.org>

2) Linux_sendmsg was forgetting to fill out the bsd_args struct.

    Reviewed by: ume

3) The args to linux_connect have differently named types on alpha and
i386, so add a cast to stop gcc complaining.

    Spotted by: peter
2003-02-08 09:26:31 +00:00
Hajimu UMEMOTO
37e7a5a285 Avoid undefined symbol error with an IPv4 only kernel.
Reported by:	"Sergey A. Osokin" <osa@freebsd.org.ru>
2003-02-05 11:05:45 +00:00
Hajimu UMEMOTO
ca26842e2a Add IPv6 support for Linuxlator.
Reviewed by:	dwmalone
MFC after:	10 days
2003-02-03 17:43:20 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Matthew Dillon
48e3128b34 Bow to the whining masses and change a union back into void *. Retain
removal of unnecessary casts and throw in some minor cleanups to see if
anyone complains, just for the hell of it.
2003-01-13 00:33:17 +00:00
Matthew Dillon
cd72f2180b Change struct file f_data to un_data, a union of the correct struct
pointer types, and remove a huge number of casts from code using it.

Change struct xfile xf_data to xun_data (ABI is still compatible).

If we need to add a #define for f_data and xf_data we can, but I don't
think it will be necessary.  There are no operational changes in this
commit.
2003-01-12 01:37:13 +00:00
Alfred Perlstein
e15583ce20 Add function linux_msg() for regulating output from the linux emulation
code, make the emulator use it.

Rename unsupported_msg() to unimplemented_syscall().  Rename some arguments
for clarity

Fixup grammar.

Requested by: bde
2003-01-02 02:19:10 +00:00
Alfred Perlstein
4f5a0588ee When complaining about obsolete/unimplemented syscalls output the process
name to make things more clear for the user.

PR: 46661
MFC After: 3 days
2003-01-01 01:42:57 +00:00
Jeffrey Hsu
b30a244c34 SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
Ian Dowse
42d5b03cfc Fix emulation of the fcntl64() syscall. In Linux, this is exactly
the same as fcntl() except that it supports the new 64-bit file
locking commands (LINUX_F_GETLK64 etc) that use the `flock64'
structure. We had been interpreting all flock structures passed to
fcntl64() as `struct flock64' instead of only the ones from F_*64
commands.

The glibc in linux_base-7 uses fcntl64() by default, but the bug
was often non-fatal since the misinterpretation typically only
causes junk to appear in the `l_len' field and most junk values are
accepted as valid range lengths. The result is occasional EINVAL
errors from F_SETLK and a few bytes after the supplied `struct
flock' getting clobbered during F_GETLK.

PR:		kern/37656
Reviewed by:	marcel
Approved by:	re
MFC after:	1 week
2002-12-08 18:30:44 +00:00
Marcel Moolenaar
60d04085cf Implement the CDROMREADAUDIO ioctl. 2002-10-19 21:11:43 +00:00
Robert Drehmel
75e8f2dad8 - Use strlcpy() rather than strncpy() to copy NUL terminated
strings.
 - Pass the correct buffer size to getcredhostname().
2002-10-17 22:00:30 +00:00
Maxim Sobolev
3ad9c842d2 - Add support for IPC_64 extensions into shmctl(2), semctl(2) and msgctl(2);
- add wrappers for mmap2(2) and ftruncate64(2) system calls;
- don't spam console with printf's when VFAT_READDIR_BOTH ioctl(2) is invoked;
- add support for SOUND_MIXER_READ_STEREODEVS ioctl(2);
- make msgctl(IPC_STAT) and IPC_SET actually working by converting from
  BSD msqid_ds to Linux and vice versa;
- properly return EINVAL if semget(2) is called with nsems being negative.

Reviewed by:	marcel
Approved by:	marcel
Tested with:	LSB runtime test
2002-10-11 11:43:09 +00:00
Juli Mallett
1d9c56964d Back our kernel support for reliable signal queues.
Requested by:	rwatson, phk, and many others
2002-10-01 17:15:53 +00:00
Juli Mallett
1226f694e6 First half of implementation of ksiginfo, signal queues, and such. This
gets signals operating based on a TailQ, and is good enough to run X11,
GNOME, and do job control.  There are some intricate parts which could be
more refined to match the sigset_t versions, but those require further
evaluation of directions in which our signal system can expand and contract
to fit our needs.

After this has been in the tree for a while, I will make in kernel API
changes, most notably to trapsignal(9) and sendsig(9), to use ksiginfo
more robustly, such that we can actually pass information with our
(queued) signals to the userland.  That will also result in using a
struct ksiginfo pointer, rather than a signal number, in a lot of
kern_sig.c, to refer to an individual pending signal queue member, but
right now there is no defined behaviour for such.

CODAFS is unfinished in this regard because the logic is unclear in
some places.

Sponsored by:	New Gold Technology
Reviewed by:	bde, tjr, jake [an older version, logic similar]
2002-09-30 20:20:22 +00:00
Jeff Roberson
0fa89fc7d9 - Hold the vn lock over vm_mmap(). 2002-09-25 02:42:04 +00:00
Jonathan Mini
044af7c357 Back out last commit. Linux uses the old 4.3BSD sockaddr format. 2002-09-24 07:03:01 +00:00
Jonathan Mini
d7f94a7a0e Don't use compatability syscall wrappers in emulation code.
This is needed for the COMPAT_FREEBSD3 option split.

Reviewed by:	alfred, jake
2002-09-23 06:17:54 +00:00
Matthew N. Dodd
27830d1e8e Remove NVIDIA ioctl bits. They will be provided in a kernel module. 2002-09-20 19:19:58 +00:00