Commit Graph

1335 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
771709eb78 Add a pn_destroy field to pfs_node. This field points to a destructor
function which is called from pfs_destroy() before the node is reclaimed.

Modify pfs_create_{dir,file,link}() to accept a pointer to a destructor
function in addition to the usual attr / fill / vis pointers.

This breaks both the programming and binary interfaces between pseudofs
and its consumers.  It is believed that there are no pseudofs consumers
outside the source tree, so that the impact of this change is minimal.

Submitted by:	Aniruddha Bohra <bohra@cs.rutgers.edu>
2007-03-12 12:16:52 +00:00
Robert Watson
b77ad8fc3b In translate_path_major_minor(), do not calculate otherwise unused 'fp'
variable, avoiding an extra locking of the file descriptor array.
2007-03-06 07:39:12 +00:00
Jung-uk Kim
5017af608d MFP4: 113090, 113130, 113132
Add Linux kernel version strings to /proc/sys/kernel.
2007-03-02 01:10:26 +00:00
Jung-uk Kim
a4e3bad794 MFP4: 115220, 115222
- Fix style(9) and reduce diff between amd64 and i386.
- Prefix Linuxulator macros with LINUX_ to prevent future collision.
2007-03-02 00:08:47 +00:00
Alexander Leidinger
8cf5ee2e2a MFp4 (110541):
Sync with rev 1.7 in NetBSD.

	Obtained from:	NetBSD
2007-02-25 12:43:07 +00:00
Alexander Leidinger
f9dac96185 MFp4 (110523, parts which apply cleanly):
semi-automatic style(9)

The futex stuff already differs a lot (only a small part does not differ)
from NetBSD, so we are already way off and can't apply changes from NetBSD
automatically. As we need to merge everything by hand already, we can even
make the files comply to our world order.
2007-02-25 12:40:35 +00:00
Alexander Leidinger
802e08a360 Partial MFp4 of 114977:
Whitespace commit: Fix grammar, spelling and punctuation.

Submitted by:	"Scot Hetzel" <swhetzel@gmail.com>
2007-02-24 16:49:25 +00:00
Alexander Leidinger
1a26db0a3a MFp4 (114193 (i386 part), 114194, 114195, 114200):
- Dont "return" in linux_clone() after we forked the new process in a case
   of problems.
 - Move the copyout of p2->p_pid outside the emul_lock coverage in
   linux_clone().
 - Cache the em->pdeath_signal in a local variable and move the copyout
   out of the emul_lock coverage.
 - Move the free() out of the emul_shared_lock coverage in a preparation
   to switch emul_lock to non-sleepable lock (mutex).

Submitted by:	rdivacky
2007-02-23 22:39:26 +00:00
Alexander Leidinger
e8b8b834b4 MFp4 (part of 114132):
- Fix a LOR caused by holding emul_lock and proctree_lock at once.

Submitted by:	rdivacky
2007-02-23 22:29:24 +00:00
John Baldwin
a96255b62d Use 'pause' in several places rather than trying to tsleep() on NULL (which
triggers a KASSERT) or local variables.  In the case of kern_ndis, the
tsleep() actually used a common sleep address (curproc) making it
susceptible to a premature wakeup.
2007-02-23 16:25:08 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Konstantin Belousov
b4bb515484 Remove extern int hz; use proper include file instead. 2007-02-02 08:58:16 +00:00
Konstantin Belousov
d0b2365eec Introduce some more SO_ option equivalents from Linux to FreeBSD.
The msg variable in linux_recvmsg() was not initialized.
Copy it from userspace.

Submitted by: rdivacky
2007-02-01 13:36:19 +00:00
Konstantin Belousov
75ee4e5462 No need to lock emul_lock in exit_group() because em->shared
cannot change (because its referenced by curthread). This fixes
a LOR caused by acquiring emul_shared_lock while holding emul_lock.

Fix typo in comment.

Submitted by: rdivacky
2007-02-01 13:33:33 +00:00
Konstantin Belousov
25954d7430 No need to synchronize linux_schedtail with linux_proc_init.
p->p_emuldata is properly initialized in the time when the child can run.

Do not set p->p_emuldata to NULL when the process is exiting.
It does not make any sense and only costs 2 mutex operations.

Do not lock emul_data to unlock it on the very next line.
Comment on possible race while there.

Reparent all procs that are part of a threading group but not its leaders
to init and SIGCHLD init to finish the zombies off. This fixes zombies
left after opera's exit. [1]

There is no need to lock p_em in the linux_proc_init CLONE_THREAD
case because the process cannot change the address of the p_em->shared
because its currently running this code path.
Move assigning of em->shared outside emul_shared_lock.

Noticed by: Scott Robbins <scottro@nyc.rr.com> [1]
Submitted by: rdivacky
2007-02-01 13:29:27 +00:00
Alexander Leidinger
eff9c72b4b Use a printf-modifier which doesn't need a cast.
Submitted by:	scottl
2007-01-21 13:18:52 +00:00
Alexander Leidinger
9cb5a012fb Fix tinderbox build on amd64. 2007-01-20 19:32:23 +00:00
Alexander Leidinger
d071f5048c MFp4 (113077, 113083, 113103, 113124, 113097):
Dont expose em->shared to the outside world before its properly
	initialized. Might not affect anything but its at least a better
	coding style.

	Dont expose em via p->p_emuldata until its properly initialized.
	This also enables us to get rid of some locking and simplify the
	code because we are workin on a local copy.

	In linux_fork and linux_vfork create the process in stopped state
	to be sure that the new process runs with fully initialized emuldata
	structure [1]. Also fix the vfork (both in linux_clone and linux_vfork)
	race that could result in never woken up process [2].

Reported by:	Scot Hetzel	[1]
Suggested by:	jhb		[2]
Reviewed by:	jhb (at least some important parts)
Submitted by:	rdivacky
Tested by:	Scot Hetzel (on amd64)

Change 2 comments (in the new code) to comply to style(9).

Suggested by:	jhb
2007-01-20 14:58:59 +00:00
Alexander Leidinger
f0cad96d23 Ooops, fix the ratelimit. 2007-01-20 11:31:14 +00:00
Alexander Leidinger
456ede3976 Convert a KASSERT into a runtime warning (rate limited) + failsafe fallback.
Because of a stupid bug (also fixed with this commit) the KASSERT was
triggered when runnung the linux top.

Pointy hat to:	netchild
2007-01-20 11:07:41 +00:00
Konstantin Belousov
4349c6ba29 Add support for LINUX_O_DIRECT, LINUX_O_DIRECT and LINUX_O_NOFOLLOW flags
to open() [1].
Improve locking for accessing session control structures [2].
Try to document (most likely harmless) races in the code [3].

Based on submission by:	Intron (intron at intron ac) [1]
Reviewed by:		jhb [2]
Discussed with:		netchild, rwatson, jhb [3]
2007-01-18 09:32:08 +00:00
Alexander Leidinger
17011df1e1 MFp4 (112379):
Implement SETALL/GETALL IPC primitives. This fixes some LTP testcases and
LabView is able to proceed a little bit further.

Submitted by:	rdivacky
2007-01-14 16:34:43 +00:00
Alexander Leidinger
31becc7692 MFp4 (112705):
Inherit setting of the default emulation version to the jails.

Pointed out by:	jhb
Submitted by:	rdivacky
2007-01-14 16:07:01 +00:00
Alexander Leidinger
a849401985 MFp4 (112646):
Now (ok it's been a while...) that FreeBSD has RLIMIT_AS too, we can use
it in the linuxolator instead of ignoring it.

This fixes a LTP test.

Submitted by:	rdivacky
2007-01-07 19:30:19 +00:00
Alexander Leidinger
bb419e1b5b MFp4 (112535):
No need to lock prison in a case of linux_use26 because the int
setting is atomic and process cannot leave jail.

Submitted by:	kib
Reviewed by:	jhb
Requested by:	rdivacky
2007-01-07 19:20:17 +00:00
Alexander Leidinger
0ed6f09c4e MFp4 (112534):
Dont lock em in a case of just using em->shared->group_pid because
the group_pid never changes.

Submitted by:	rdivacky
Reviewed by:	kib
Glanced at by:	jhb
2007-01-07 19:14:06 +00:00
Alexander Leidinger
291081ce0a MFp4 (112499):
Protect em->shared with the lock in case of CLONE_THREAD.

Submitted by:	rdivacky
2007-01-07 19:09:20 +00:00
Alexander Leidinger
1c65504ca8 MFp4 (112498):
Rename the locking flags to EMUL_DOLOCK and EMUL_DONTLOCK to prevent confusion.

Submitted by:	rdivacky
2007-01-07 19:00:38 +00:00
Xin LI
59038483f5 Fix amd64 build.
Submitted by:	Divacky Roman <xdivac02 stud fit vutbr cz>
2007-01-01 14:47:45 +00:00
Alexander Leidinger
c9447c7551 MFp4 (111746, 108671, 108945, 112352):
- add linux utimes syscall [1]
 - add linux rt_sigtimedwait syscall [2]

Submitted by:	"Scot Hetzel" <swhetzel@gmail.com> [1]
Submitted by:	Bruce Becker <hostmaster@whois.gts.net> [2]
PR:		93199 [2]
2006-12-31 13:16:00 +00:00
Alexander Leidinger
a628609ee9 MFp4:
- semi-automatic style fixes
2006-12-31 12:42:55 +00:00
Alexander Leidinger
9ce8f9bcdd MFp4 (111746+):
Redo the checking for 2.6 emulation. We now cache the value of
  use26 and replace calls to linux_get_osrelease() + parsing with
  a call to linux_use26(). Typical path is lockless now.

  Pointed out by: kib

This allows to ship RELENG_7_0 with a default osrelease of 2.4.2 and the
possibility to enable 2.6.x emulation without the possible performance
impact of the previous version of the check.

Submitted by:	rdivacky
2006-12-31 12:39:10 +00:00
Alexander Leidinger
ef95cfeab9 MFp4:
- semi-automatic style fixes
 - spelling fixes in comments
 - add some comments
2006-12-31 11:56:16 +00:00
Sam Leffler
b1d83a2508 add entry points required by newer broadcom wireless driver
PR:		kern/106131
Submitted by:	Scot Hetzel
MFC after:	2 weeks
2006-12-25 17:04:41 +00:00
Alexander Leidinger
de6bf3bfcd MFP4 (110956):
Add definition for LINUX_MSG_INFO.

This fixes the tinderbox errors.

Submitted by:	rdivacky
2006-12-21 13:11:06 +00:00
Jung-uk Kim
77424f4177 MFP4: 109655
- Move linux_nanosleep() from src/sys/amd64/linux32/linux32_machdep.c to
src/sys/compat/linux/linux_time.c.
- Validate timespec ranges before use as Linux kernel does.
- Fix l_timespec structure.
- Clean up style(9) nits.
2006-12-20 20:17:35 +00:00
Jung-uk Kim
34ec45fe0d MFP4: 110179
Add rudimentary IPC_INFO/MSG_INFO command support for linux_msgctl()
to pacify Linux ipcs(1).  While I am here, add more bound checks
for linux_msgsnd() and linux_msgrcv().
2006-12-20 20:08:45 +00:00
Jung-uk Kim
5e868cbb79 Regen. 2006-12-20 19:39:10 +00:00
Jung-uk Kim
127891cab9 MFP4: (part of) 110058
Fix 32-bit msgsnd(3) and msgrcv(3) emulations for amd64.
2006-12-20 19:36:03 +00:00
Jung-uk Kim
f61480ecf5 MFP4: (part of) 110058
Use new kern_msgsnd()/kern_msgrcv() to fix linux32 emulation on amd64.
2006-12-20 19:30:52 +00:00
Jung-uk Kim
b34608fea5 MFP4: 109653
Linux mknod(2) can open any files, not just char/block or fifo files.
This fixes Linux Test Project test cases mknod01, mknod07 and mknod09.
2006-12-04 22:46:09 +00:00
Jung-uk Kim
b256a1e10b MFP4: 109652
Fixes for 'blocking in fifoor state' problem of LTP tests.
linux_*stat*() functions were opening files with O_RDONLY to get
major/minor pair for char/block special files.  Unfortunately,
when these functions are used against fifo, it is blocked forever
because there is no writer.  Instead, we only open char/block special
files for major/minor conversion.  We have to get rid of kern_open()
entirely from translate_path_major_minor() but today is not the day.
While I am here, add checks for errors before calling
translate_path_major_minor().
2006-12-04 22:38:52 +00:00
Alexander Leidinger
5ac7315788 MFP4 (110957)
Use TAILQ_FOREACH_SAFE instead of the unsafe one where an item is removed
from the queue.

This prevents a panic on kldunload.

Submitted by:	rdivacky
Tested by:	bsam
2006-12-03 21:00:31 +00:00
Alexander Leidinger
f6018b1434 MFP4 (108673, 110519, 110874):
- Currently LINUX_MAX_COMM_LEN is smaller than MAXCOMLEN, but in case
  this will change we have a buffer overflow. Apply some defensive
  programming to DTRT when this should happen.
- Use copyinstr() instead of copyin where appropriate.
  * Fallback to copyin() in case of ENAMETOOLONG. [1]
  * Use the right source and destination (it was wrong before).
- Use strlcpy instead of strcpy.
- Properly lock the read case (PR_GET_NAME) like the write case.

Reviewed by:	rwatson (except [1])
Suggested by:	rwatson [1]
2006-12-02 14:56:25 +00:00
Jung-uk Kim
e40fc50b9f MFP4: Change 109654
Add two linprocfs entries for Linux IPC:

	/proc/sys/kernel/msgmni	->	kern.ipc.msgmni
	/proc/sys/kernel/sem	->	kern.ipc.semmsl
					kern.ipc.semmns
					kern.ipc.semopm
					kern.ipc.semmni

This fixes msgget03 and semget05 from Linux Test Project (LTP) test suite.
msgctl08 and msgctl09 also use /proc/sys/kernel/msgmni but another fix is
required from p4 (Change 110179).

Requested by:	netchild
2006-11-27 21:10:55 +00:00
Konstantin Belousov
bdaee9ef4e Add missed ")". Fix the build.
Pointy hat to:	kib
2006-11-18 17:27:39 +00:00
Konstantin Belousov
cce1514679 Sync struct sysinfo with real one from linux.
Submitted by:	rdivacky
2006-11-18 14:37:54 +00:00
Konstantin Belousov
0c00520b93 Use standard debugging facilities in linux_getcwd().
Submitted by:	rdivacky
2006-11-18 13:31:03 +00:00
Konstantin Belousov
d559d18183 Add debuging printfs to syscalls that do not contain it yet. In
sethostname do not print the hostname because it would require to copyin
the string. Sethostname is not very frequently used.

Submitted by:	rdivacky
2006-11-18 13:00:59 +00:00
Konstantin Belousov
f472c6e35a Remove unecessary locking of process in linux_getpid.
Suggested by:	jhb
Submitted by:	rdivacky
2006-11-18 10:12:43 +00:00