Re: pri_to_rtp returns invalid initial priority

2011-07-12 Thread Dmitry Krivenok
lean build and still see the same. On Thu, Jul 7, 2011 at 10:46 PM, John Baldwin wrote: > On Thursday, July 07, 2011 6:37:02 am Dmitry Krivenok wrote: >> Hi Hackers, >> I've developed a simple kld which demonstrates a problem I found on my >> FreeBSD-8.2. > > Ma

pri_to_rtp returns invalid initial priority

2011-07-07 Thread Dmitry Krivenok
Hi Hackers, I've developed a simple kld which demonstrates a problem I found on my FreeBSD-8.2. / #include #include #include #include #include #include #include #include #include #include #include

Re: Bug in ksched_setscheduler?

2011-06-06 Thread Dmitry Krivenok
I've submitted PR http://www.freebsd.org/cgi/query-pr.cgi?pr=157657. Dmitry On Thu, Jun 2, 2011 at 6:34 PM, John Baldwin wrote: > On Wednesday, June 01, 2011 12:42:42 pm Dmitry Krivenok wrote: >> Hello Hackers, >> I think I found a bug in ksched_setscheduler()

Bug in ksched_setscheduler?

2011-06-01 Thread Dmitry Krivenok
Hello Hackers, I think I found a bug in ksched_setscheduler() function. 178 int 179 ksched_setscheduler(struct ksched *ksched, 180 struct thread *td, int policy, const struct sched_param *param) 181 { 182 int e = 0; 183 struct rtprio rtp; 184 185 switch(policy) 186

Problem with running simple pthreads program under gdb-7.2 (Invalid selected thread)

2011-05-25 Thread Dmitry Krivenok
Hello, I wrote very simple Pthreads program to demonstrate the problem with gdb-7.2 installed from ports on my FreeBSD-8.2 (amd64). /// #include #include #include void* run(void* arg) { return 0; } int main(int argc,

Possible bug in gdb-6.1.1 (it leaves zombie processes)

2011-05-25 Thread Dmitry Krivenok
Hello hackers, I think I found a bug in base gdb-6.1.1 on FreeBSD-8.2. Below is how you can reproduce it. I run "sleep 10" command under control of gdb-6.1.1 as follows $ gdb --args sleep 10 GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the

hw.physmem (loader.conf and sysctl)

2011-03-04 Thread Dmitry Krivenok
Hello Hackers, I've limited the amount of physical memory visible for my FreeBSD-8.2 by adding the following in loader.conf: $ cat /boot/loader.conf | grep hw.physmem hw.physmem="500M" $ However, according to sysctl, the system sees $ sysctl hw.physmem hw.physmem: 507445248 $ The difference is

Re: mtx_init/lock_init and uninitialized struct mtx

2011-02-24 Thread Dmitry Krivenok
10:02 PM, John Baldwin wrote: > On Thursday, February 24, 2011 10:47:27 am Dmitry Krivenok wrote: >> Hello Hackers, >> >> Is it allowed to call mtx_init on a mutex defined as an auto variable >> and not initialized explicitly, i.e.: > > It does expect you to zero

mtx_init/lock_init and uninitialized struct mtx

2011-02-24 Thread Dmitry Krivenok
Hello Hackers, Is it allowed to call mtx_init on a mutex defined as an auto variable and not initialized explicitly, i.e.: static int foo() { struct mtx m; // Uninitialized auto variable, so it's value is undefined. mtx_init(&m, "my_mutex", NULL, MTX_DEF); … // Do something ...

Re: Simple kernel attack using socketpair.

2010-11-26 Thread Dmitry Krivenok
I run it on 8.0 and CURRENT and got fatal double fault on both systems: Unread portion of the kernel message buffer: kern.maxfiles limit exceeded by uid 1001, please see tuning(7). Fatal double fault rip = 0x80615f54 rsp = 0xff8

Re: printf doesn't work from kernel modules

2010-11-22 Thread Dmitry Krivenok
Just tried dys_sysctl. It doesn't work as well. Below are the results I got: r...@olimpico-freebsd 22:04:17 /usr/share/examples/kld/dyn_sysctl # [0] uname -a FreeBSD olimpico-freebsd 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Nov 22 21:35:15 MSK 2010 r...@olimpico-freebsd:/usr/obj/usr/src/sys/GENERIC

printf doesn't work from kernel modules

2010-11-22 Thread Dmitry Krivenok
Hello Hackers, Recently I installed 8.1 on my laptop and recompiled the kernel. The system works fine, but I have a strange problem with my own trivial kernel module. I noticed that printf function doesn't produce any output (according to dmesg) if I call it from a module. Note, that the same modul

Re: Broadcom BCM4310 / bwi(4) and interface bwi0 is not showing up

2010-11-08 Thread Dmitry Krivenok
I tried your patch, but my laptop hung at startup. The last line I saw on console was "Timecounters tick every 1.000 msec". I didn't dig into the problem and don't have any information useful for debugging, but I'm going to play with it later today. Dmitry On Mon, Oct 25, 2010 at 1:29 PM, Bernha

Re: Kernel linker and undefined references in KLD

2010-07-15 Thread Dmitry Krivenok
y use wrong calling convention. On Thu, Jul 15, 2010 at 6:32 PM, Kostik Belousov wrote: > On Thu, Jul 15, 2010 at 06:07:36PM +0400, Dmitry Krivenok wrote: >> Hello Hackers, >> >> I have a question about kernel link

Kernel linker and undefined references in KLD

2010-07-15 Thread Dmitry Krivenok
Hello Hackers, I have a question about kernel linker. Please take a look at an example of simple module: #include #include #include #include #include #include #include /* DECLARING A FUNCTION JUST TO AVOID WARNIN

Do we still need libc_r and libkse in /usr/src/lib?

2010-07-05 Thread Dmitry Krivenok
Hi Hackers, I've just started learning implementation of threads in FreeBSD-CURRENT. exctags found three different implementations of pthread_create function - libc_r, libkse and libthr: # pri kind tag file 1 F f_pthread_create lib/libc_r/uthread/uthread_create.c

select/poll for sockets in kernel space

2010-05-25 Thread Dmitry Krivenok
Hello Hackers! I'm developing a module for FreeBSD-8 and encountered the problem with polling sockets. I know that FreeBSD-8 kernel provides 3 interfaces for polling (kern/sys_generic.c): 1) kern_select 2) poll 3) selsocket I cannot use first two interfaces because I have an array of sockets (str

Need advice about selsocket analogue for a set of sockets

2010-05-13 Thread Dmitry Krivenok
Hi Hackers, I know that FreeBSD-8 kernel provides selsocket function declared as follows: int selsocket(struct socket *so, int events, struct timeval *tvp, struct thread *td); It's very useful if you have just one socket and don't care about which events fired. In my case, however, I have an arr

Moving from FreeBSD7 to FreeBSD8 (cdev, minor, dev2unit)

2010-05-07 Thread Dmitry Krivenok
Hello Hackers, I'm working on porting some kernel modules written for FreeBSD7 to FreeBSD8. Some of these modules contain the following code: struct cdev *dev; ... int dev_num = minor(dev); This code doesn't compile on FreeBSD8. I found that in FreeBSD7 minor() was defined as follows: 515 int

Re: Build world with DEBUG_FLAGS='-g -O0'

2010-04-12 Thread Dmitry Krivenok
Is there a simple way to build size constrained parts of world (e.g. bootcode) with '-O2' and other parts with '-O0'? On Mon, Apr 12, 2010 at 11:54 PM, Bernd Walter wrote: > On Mon, Apr 12, 2010 at 10:34:30PM +0400, Dmitry Krivenok wrote: > > Hello Hackers, > &

Build world with DEBUG_FLAGS='-g -O0'

2010-04-12 Thread Dmitry Krivenok
Hello Hackers, I'm trying to build FreeBSD-CURRENT (r206494) with DEBUG_FLAGS='-g -O0'. Below are the commands I executed: export DEBUG_FLAGS='-g -O0' cd /usr/src/ time make buildworld I got the following error: ... ... ===> sys/boot/i386/boot2 (all) objcopy -S -O binary boot1.out boot1

Strange behavior of kernel module (output terminated)

2010-03-23 Thread Dmitry Krivenok
Hello Hackers, I'm new to FreeBSD kernel development and have a very basic question about kernel modules. I compiled and slightly modified an example from http://www.freesoftwaremagazine.com/articles/writing_a_kernel_module_for_freebsd . Below is the source code of my first module called "hello":