Re: freeing data segment

2003-10-30 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Vinod R. Kashyap [EMAIL PROTECTED] writes:
: 
: Hi,
: 
: I have this huge data structure in the data segment of my scsi driver.  This
: data structure is initialized at driver build time, and is used only during 
: driver
: initialization.  I am trying to find out if I can free-up the memory it 
: occupies,
: once I am done with the driver initialization.  Does anyone know how to do 
: this?

Put it in a module, and unload the module.  Alternatively, load it
from userland.

Warner
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: POSIX Threads

2003-10-30 Thread Isaac Gelado
Dan Nelson escribió:
In the last episode (Oct 29), Isaac Gelado said:

I am developing a distributed application based on MICO (mico-2.3.9),
which uses Packet Capture Library (PCapLib).
In the code, I create a posix thread to execute the pcap_loop
function (this function waits until certain number of packets have
been captured or infinite if the number is 0). When PCapLib captures
a packet and pcap_loop is running it calls to a handle function
inside the same thread.
This schema is working correctly in a linux machine, so when a packet
is captured an CORBA event is sent to clients. But, when the server
is running under FreeBSD 5.0, the handle function isn't executed when
a packet is received. In FreeBSD the handle function is executed, for
each packet, after certain time (maybe when the buffer of PCapLib is
full), which is a problem because it sends events too fast to clients
so the CORBA event service fails.


When you called pcap_open_live, what timeout did you set?

I set it to 0, so PCapLib should return the packet inmediatly.

Can the problem be in the PCapLib implementation?

--
 __
|Isaac Gelado   |  |
|   Telefónica I+D  | Tlf 983367649|
|Paq. Tec. de Boecillo  |  |
|Valladolid | [EMAIL PROTECTED]   |
|___|__|
|   As gold which he cannot spend will make no man rich|
| so knowledge which he cannot apply will make no man wise |
|__|
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: freeing data segment

2003-10-30 Thread Terry Lambert
Vinod R. Kashyap wrote:
 I have this huge data structure in the data segment of my scsi driver.  This
 data structure is initialized at driver build time, and is used only during
 driver
 initialization.  I am trying to find out if I can free-up the memory it
 occupies,
 once I am done with the driver initialization.  Does anyone know how to do
 this?

You can either implement it in a separate ELF section that's marked
init only (this is a defined ELF attribute), and then fix FreeBSD
to honor discarding of such sections (FreeBSD doesn't implement
very much of the capabilities of ELF), or...

You can make two drivers, make the init driver depend on the other
driver, load the init driver, have it's init routine call an entry
point in the other driver to give it a callback into itself, do the
callback to do the actual initialization, and then unload the second
driver.

Convoluted, but it works (I used it for a firmware downaload in a
GigE driver at one point).

-- Terry
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: non-root process and PID files

2003-10-30 Thread Terry Lambert
Christopher Vance wrote:
 You can already mark a fd 'close on exec'.
 
 May I suggest a different feature: the ability to mark an open file
 (not just its fd) 'remove on close', with permission checked at mark
 time rather than close time (this status forgotten if not permitted
 when set) and the unlink actually done at close time only if the file
 has exactly one link and one open file instance at that time.

If all you have is an fd, you can not get from an fd to a path
without an exhaustive search of the disk, in most FS's.

Also, leaving the path peresent permits someone to hard-link it
to some other file, to make it stay around.  Since /var has a
/var/tmp, this would be a real danger, I think.

-- Terry
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Experimental FreeBSD and Linux kernel source cross reference web site

2003-10-30 Thread Hiten Pandya
Robert Watson (Wed, Oct 29, 2003 at 11:18:51PM -0500) wrote:
 
 In the past when browsing the Linux source code, I've made extensive use
 of the Linux Cross-Reference (LXR) hosted at lxr.linux.no.  This web site
 provides a cross-referenced and searchable HTML interface to the Linux
 source code; you can perform freetext and identifier searches, check
 differences between revisions, etc.  For FreeBSD, we provide a cvsweb
 interface that is extremely useful for tracking changes, but a little less
 useful for raw browsing when you're looking for use of an identifier. In
 the past, CMU's PDL (and possibly others) have provided FreeBSD
 cross-reference web pages, but I was unable to find one once that site
 went down.  As such, I've experimentally set up the LXR software with
 access to several branches of the FreeBSD source code, as well as 2.4 and
 2.6 Linux kernels at: 
 
 http://fxr.watson.org/
 

Thank you very very much! ;-)

Atlast, someone got to it.  I have been wanting to setup LXR for
DragonFly for quite some time now, but did not have enough time
on my hands to mess with it.  Does it require any sort of
patching for it to work on FreeBSD ?  I recall it requires MySQL
and some other stuff..

Regards,

-- Hiten
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


libwrap crash

2003-10-30 Thread Dan Langille
I've been tracking down a libwrap call which crashes the application. 
 The crash occurs on line 395 of contrib/tcp_wrappers/options.c, but 
I have no idea.

The situation:

- The daemon starts on the remote client.
- Connection is attempted from another box via port 9102
- The daemon uses hosts_access(3) to see if the connection is allowed
- /etc/hosts.allow contains no explit allow/deny for this connection 
which means this line is invoked:

# The rest of the daemons are protected.
ALL : ALL \
: severity auth.info \
: twist /bin/echo You are not welcome to use %d from %h.

When the host_acess calls invokes twist_option 
(contrib/tcp_wrappers/options.c:370), things blow up on this call:

  (void) execl(/bin/sh, sh, -c, value, (char *) 0);

Any ideas?  Suggestions?

Thank you


[EMAIL PROTECTED]:/usr/ports/sysutils/bacula/work/bacula-1.32b/src/filed] # 
gdb ./bacula-fd
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and 
you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for 
details.
This GDB was configured as i386-unknown-freebsd...Deprecated 
bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../con
trib/gdb/gdb/dwarf2read.c line 3049 in dwarf2_read_section

(gdb) source ~/debug
Breakpoint 1 at 0x805a365: file bnet_server.c, line 152.

Breakpoint 1, bnet_thread_server (bind_addr=0x0, port=9102, 
max_clients=10, client_wq=0x807c4a0,
handle_client_request=0x804d3c0 handle_client_request(void *)) 
at bnet_server.c:152
152   fromhost(request);
Current language:  auto; currently c++
(gdb) n
153   if (!hosts_access(request)) {
(gdb) s
0x8049cc8 in hosts_access () at 
/usr/src/lib/libwrap/../../contrib/tcp_wrappers/hosts_access.c:126
126
(gdb) /usr/src/lib/libwrap/../../contrib/tcp_wrappers/options.c:395
Undefined command: .  Try help.
(gdb) b /usr/src/lib/libwrap/../../contrib/tcp_wrappers/options.c:395
Breakpoint 2 at 0x280a1766: file 
/usr/src/lib/libwrap/../../contrib/tcp_wrappers/options.c, line 395.
(gdb) c
Continuing.

Breakpoint 2, twist_option (value=0xbfbfe890 /bin/echo \You are not 
welcome to use bast-fd from undef.unixathome.org.\,
request=0xbfbff574) at 
/usr/src/lib/libwrap/../../contrib/tcp_wrappers/options.c:395
395 (void) execl(/bin/sh, sh, -c, value, (char 
*) 0);
Current language:  auto; currently c
(gdb) list
390 maybe_dup2(request-fd, 2) != 2) {
391 error = twist_option: dup: %m;
392 } else {
393 if (request-fd  2)
394 close(request-fd);
395 (void) execl(/bin/sh, sh, -c, value, (char 
*) 0);
396 error = twist_option: /bin/sh: %m;
397 }
398
399 /* Something went wrong: we MUST terminate the 
process. */
(gdb) print value
$1 = 0xbfbfe890 /bin/echo \You are not welcome to use bast-fd from 
undef.unixathome.org.\
(gdb) n
0x2809fb4c in _init () from /usr/lib/libwrap.so.3
(gdb) n
Single stepping until exit from function _init,
which has no line number information.
Error accessing memory address 0x281a1e84: Bad address.
(gdb
-- 
Dan Langille : http://www.langille.org/

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


O_NOACCESS?

2003-10-30 Thread andi payn
As far as I can tell, FreeBSD doesn't have anything equivalent to
linux's O_NOACCESS (which is not in any of the standard headers, but
it's equal to O_WRONLY | O_RDWR, or O_ACCMODE). In linux, this can be
used to say, give me an fd for this file, but don't try to open it for
reading or writing or anything else. 

This allows you to get an fd to pass to fcntl (e.g., for dnotify), or
call ioctl's on, etc.--even if you don't have either read or write
access to the file. The obvious question is, Why should this ever be
allowed? Well, if you can stat the file, why can't you, e.g., ask
kevent to monitor it? 

In FreeBSD, this doesn't work; you just get EINVAL.

Having O_NOACCESS would be useful for the fam port, for porting pieces
of lilo, and probably for other things I haven't thought of yet. (I
believe that either this was added to linux to support lilo, or the open
syscall just happened to work this way, and once the lilo developers
discovered this and took advantage of it, it's been retained that way
ever since to keep lilo working.)

On the other hand, BSD has done without it for many years, and there's
probably a good reason it's never been added. So, what is that good
reason?

I don't think there's a backwards-compatibility issue. The open(2)
manpage specifies that EINVAL will be returned if An attempt was made
to open a descriptor with an illegal combination of O_RDONLY, O_WRONLY,
and O_RDWR. However, it doesn't specify what constitutes an illegal
combination--and nowhere does it say that exactly one of the three must
be specified. (Interestingly, the manpage on my Mandrake 9.1 box _does_
say that exactly one must be specified, which is not true in linux)

While a reader would be unlikely to assume that O_WRONLY | O_RDWR
means open for no access, I can't imagine many programs rely on the
fact that this combination returns an error. If there is such an issue,
well, there are other flag bits left unused (3 in the low 16 bits, plus
15 in the high 16 bits); if not, it would probably be nicer to use the
same value as linux.

Meanwhile, as mentioned above, doesn't define O_NOACCESS in any of the
standard header files (IIRC, programs that use it--like lilo--explicitly
#define it as 3, or O_WRONLY | O_RDWR, or O_ACCMODE), and it's not
documented in the man pages. I think that, if it's added to FreeBSD, it
should be added in a cleaner and better-documented way.

Anyway, would a patch to add this feature be considered? And if so, does
anyone have any input into questions like whether O_NOACCESS should be 3
as it is in linux or use some unused flag bit instead, whether it should
be defined in fcntl.h or elsewhere, etc.?

Thanks.


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


kevent and related stuff

2003-10-30 Thread andi payn
First, let me mention that I'm not nearly as experienced coding for *BSD
as for linux, so I may ask some stupid questions.

I've been looking at the fam port, and this has brought up a whole slew
of questions. I'm not sure if all of them are appropriate to this list,
but I don't know who else to ask, so

First, some background: On Irix and Linux, fam works by asking the
kernel to send it a signal whenever the specified accesses occur. On
FreeBSD, since there is no imon interface and no dnotify fcntl, it
instead works by periodically stating all of the files it's
watching--which is obviously not as good. The fam FAQ suggests that
FreeBSD users should adapt fam to use the kevent interface. 

I looked into kevent, and it seems like there are a number of problems
that lead me to suspect that this is a really stupid idea. And yet, I'd
assume that someone on the fam team at SGI and/or one of the outside fam
developers would know FreeBSD at least as well as me. Therefore, I'm
guessing I'm missing something here. So, any ideas anyone can offer
would be very helpful.

So, here's the questions I have:

* I think (but I'm not sure) that kevent doesn't notify at all if the
only change to a file is its ATIME. If I'm right, this makes kevent
completely useless for fam. Adding a NOTE_ACCESS or something similar
would fix this. Since I'm pretty new to FreeBSD: What process do I go
through to figure out whether anyone else wants this, whether the
interface I've come up with is acceptable, etc.? And, once I write the
code, do I submit it as a pr?

* The kevent mechanism doesn't monitor directories in a sufficient way
to make fam happy. If you change a file in a directory that you're
watching, unlike imon or dnotify, kevent won't see anything worth
reporting at all. This means that for directory monitoring, kevent is
useless as-is. Again, if I wanted to patch kevent to provide this
additional notification, would others want this?

* When two equivalent events appear in the queue, kevent aggregates
them. This means that if there are two updates to a file since the last
time you checked, you'll only see the most recent one. For some uses of
fam (keeping a folder window up to date), this is what you want; for
others (keeping track of how often a file is read), this is useless. The
only solution I can think of is to add an additional flag, or some other
way to specify that you want duplicated events.

* Unlike imon and dnotify, kevent doesn't provide any kind of callback
mechanism; instead, you have to poll the queue for events. Would it be
useful to specify another flag/parameter that would tell the kernel to
signal the monitoring process whenever an event is available? (It would
certainly make the fam code easier to write--but if it's not useful
anywhere else, that's probably not enough.)

* The kevent vnode stuff apparently only works on UFS. And it looks like
it would be a major project to port it to other filesystems. Would this
be useful for anything other than improving fam? What about a port of
the imon kernel interface (and/or the dnotify fcntl) to FreeBSD instead?

* The kqueue doesn't appear to have any maximum size. If this is true,
the dnotify/fam problem where you get hideous errors from overflowing
queues wouldn't be an issue, but you could instead end up wasting
massive amounts of memory in the kernel if you didn't get around to
reading the queue Which is it?

Any answers, or pointers to where I can find these answers, would be
greatly appreciated.


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: POSIX Threads

2003-10-30 Thread Dan Nelson
In the last episode (Oct 30), Isaac Gelado said:
 Dan Nelson escribi:
 In the last episode (Oct 29), Isaac Gelado said:
 This schema is working correctly in a linux machine, so when a
 packet is captured an CORBA event is sent to clients. But, when the
 server is running under FreeBSD 5.0, the handle function isn't
 executed when a packet is received. In FreeBSD the handle function
 is executed, for each packet, after certain time (maybe when the
 buffer of PCapLib is full), which is a problem because it sends
 events too fast to clients so the CORBA event service fails.
 
 When you called pcap_open_live, what timeout did you set?
 
 I set it to 0, so PCapLib should return the packet inmediatly.
 
 Can the problem be in the PCapLib implementation?

Are you sure 0 means return immediately?  I think it might mean Wait
forever until the buffer fills.  Try a very small timeout value.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: how to monitor remote users

2003-10-30 Thread Matt Freitag
On Wed, Oct 29, 2003 at 3:01 AM, Andreas Klemm wrote:
 Is there a freebsd tool that shows you in realtime, which users
 are logged in from remote using which pty port ?

 So to say something like
 while true
 do
 clear; w; sleep 10
 done

 Preferable as X11 application.



The closest thing to my knowledge, would probably be whowatch
which resides in /usr/ports/sysutils/whowatch.
It doesn't allow you to click on the user to spawn a watch session, but I
doubt it'd be too difficult to add such functionality if you so desired.

Regards,
-mpf
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Experimental FreeBSD and Linux kernel source cross reference web site

2003-10-30 Thread Robert Watson

On Thu, 30 Oct 2003, Hiten Pandya wrote:

   Thank you very very much! ;-)
 
   Atlast, someone got to it.  I have been wanting to setup LXR for
   DragonFly for quite some time now, but did not have enough time
   on my hands to mess with it.  Does it require any sort of
   patching for it to work on FreeBSD ?  I recall it requires MySQL
   and some other stuff..

I'm actually using an older version of the lxr software, 0.3.1, which
doesn't make use of a back-end SQL database, rather, some simple db-based
data stores and glimpse for searches.  It was a lot easier to set up, once
I fixed some rather critical bugs :-).

I've gone ahead and dropped a snapshot of the DFBSD sys tree on fxr as
well, and am currently cvsuping opendarwin source to drop a recent
snapshot of xnu.  I'm not sure if there are any DFBSD tags worth using
other than HEAD, so I just used a timestamp for the checkout.  The
rearrangement of the DFBSD tree makes diffing between FreeBSD and DFBSD
bits a little more difficult, but in many cases it's fairly feasible. I've
been trying to decide how to improve diffability between the FreeBSD and
Darwin trees: most FreeBSD bits compare directly with xnu/bsd/..., not
xnu/..., and lxr isn't very flexible about how it sets up diff
comparisons. 

I've also noticed that lxr is currently unwilling to index macros as
identifiers when they're generated at compile-time, which means (for
example) that you have to use freetext searches to find vnode operation
macro use.  I'm not sure how much more time I'm willing to invest in
further refining lxr itself, but I'll keep the source code snapshots
up-to-date and bring in new sources of kernel source code as appropriate. 

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Network Associates Laboratories

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Experimental FreeBSD and Linux kernel source cross reference web site

2003-10-30 Thread Garance A Drosihn
At 11:18 PM -0500 10/29/03, Robert Watson wrote:
In the past when browsing the Linux source code, I've made
extensive use of the Linux Cross-Reference (LXR) hosted at
lxr.linux.no.
For FreeBSD, we provide a cvsweb interface that is extremely
useful for tracking changes, but a little less useful for
raw browsing when you're looking for use of an identifier.
In the past, CMU's PDL (and possibly others) have provided
FreeBSD cross-reference web pages, but I was unable to find
one once that site went down.
How about http://snapshots.jp.FreeBSD.org/tour/
?
That's what I have used from time-to-time, when on a random
goose chase for various variables...
--
Garance Alistair Drosehn=   [EMAIL PROTECTED]
Senior Systems Programmer   or  [EMAIL PROTECTED]
Rensselaer Polytechnic Instituteor  [EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


stupid C language question

2003-10-30 Thread Nickolay A. Kritsky
Hello freebsd-hackers,

  My fellow freebsd-hackers! I ran ino minor problem here. I am
currently debugging some part of FreeBSD bridging/vlan'ing kernel
code. Every N minutes I want to add some debugging printf's in kernel
or remove some previously installed. And now - a stupid question! When
I change some .c files in src/sys/net directory, do I need to do 'make
depend  make kernel' or I can just 'make kernel'? System is 4.8-p3.
Any help is very good, and please cc: me in your replies as I am not
subscribed to this list.

PS: I wish you good luck in your hacking.
PPS: I heard about 10th FreeBSD bithday - receive my congratulations,
gluckwunschen and all that!

Thanks again.

-- 
Best regards,
;  Nickolay A. Kritsky
; SysAdmin STAR Software LLC
; mailto:[EMAIL PROTECTED]


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


5.x kernel config changes?

2003-10-30 Thread Leo Bicknell

I just built my first 5.1-RELEASE box requiring a custom kernel, and
noticed some interesting things.

1) It appears IPFW just works (eg, configure it in /etc/rc.conf).  It
   used to be you had to compile it in.  What's interesting to me is
   that IPFW options are not in generic, and I didn't think options
   could be done in LKM's.  What am I missing?

2) IPDIVERT is missing / doesn't work, so while my IPFW config seemed 
   to take/work natd did not work.  If IPFW is just going to work having
   IPDIVERT just work seems like a good idea as well.

3) There seems to be no more LINT or other listing of all the options.
   Why?  In particular I needed options NETATALK but couldn't remember
   the name and there was no file to quickly grep.  Has the list of 
   options been moved somewhere else?

4) Due to the way the makefiles now work it seems impossible to build a
   new kernel after changing just options statements and install it
   without also rebuilding all the modules...which takes quite some
   time.  This seems to be because it moves the whole directory out of
   the way in /boot.  This seems a little suboptimal to me.

-- 
   Leo Bicknell - [EMAIL PROTECTED] - CCIE 3440
PGP keys at http://www.ufp.org/~bicknell/
Read TMBG List - [EMAIL PROTECTED], www.tmbg.org


pgp0.pgp
Description: PGP signature


Re[2]: stupid C language question

2003-10-30 Thread Nickolay A. Kritsky
Hello Tim  -hackers,

zillion thanks to all who answered. Now I think that I understand :)

Thursday, October 30, 2003, 10:45:42 PM, you wrote:

TK Nickolay A. Kritsky wrote:
 When
 I change some .c files in src/sys/net directory, do I need to do 'make
 depend  make kernel' or I can just 'make kernel'?

TK You should only need to 'make depend' if you change
TK the dependencies, for example, if you add or remove
TK a #include somewhere.

TK Usually, 'make kernel' suffices.

-- 
Best regards,
;  Nickolay A. Kritsky
; SysAdmin STAR Software LLC
; mailto:[EMAIL PROTECTED]


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: 5.x kernel config changes?

2003-10-30 Thread John Baldwin

On 30-Oct-2003 Leo Bicknell wrote:
 
 I just built my first 5.1-RELEASE box requiring a custom kernel, and
 noticed some interesting things.
 
 1) It appears IPFW just works (eg, configure it in /etc/rc.conf).  It
used to be you had to compile it in.  What's interesting to me is
that IPFW options are not in generic, and I didn't think options
could be done in LKM's.  What am I missing?

It's loaded from the ipfw.ko module.  You can build modules for some
things that are compiled in using 'options'.

 2) IPDIVERT is missing / doesn't work, so while my IPFW config seemed 
to take/work natd did not work.  If IPFW is just going to work having
IPDIVERT just work seems like a good idea as well.

You will probably need to just include IPFW and IPDIVERT in your
kernel config for this to work.

 3) There seems to be no more LINT or other listing of all the options.
Why?  In particular I needed options NETATALK but couldn't remember
the name and there was no file to quickly grep.  Has the list of 
options been moved somewhere else?

sys/conf/NOTES and sys/arch/conf/NOTES

 4) Due to the way the makefiles now work it seems impossible to build a
new kernel after changing just options statements and install it
without also rebuilding all the modules...which takes quite some
time.  This seems to be because it moves the whole directory out of
the way in /boot.  This seems a little suboptimal to me.

You can add 'makeoptions NO_MODULES=yes' to your kernel config to have
it only build a kernel and no modules.

-- 

John Baldwin [EMAIL PROTECTED]http://www.FreeBSD.org/~jhb/
Power Users Use the Power to Serve!  -  http://www.FreeBSD.org/
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 5.x kernel config changes?

2003-10-30 Thread Brooks Davis
On Thu, Oct 30, 2003 at 02:40:53PM -0500, Leo Bicknell wrote:
 
 3) There seems to be no more LINT or other listing of all the options.
Why?  In particular I needed options NETATALK but couldn't remember
the name and there was no file to quickly grep.  Has the list of 
options been moved somewhere else?

sys/conf/NOTES + sys/machine/conf/NOTES

 4) Due to the way the makefiles now work it seems impossible to build a
new kernel after changing just options statements and install it
without also rebuilding all the modules...which takes quite some
time.  This seems to be because it moves the whole directory out of
the way in /boot.  This seems a little suboptimal to me.

You can still use the old way of building kernels when you aren't
updating the world.  You can also use the reinstall target in
conjunction with -DNO_MODULES to just reinstall the kernel.

If you just want to change some options and you still want to use the
new way, the unsupported workaround is:

make -DNOCLEAN buildkernel

It still configured the kernel and does a make depend, but it won't
delete the object files which speeds things up a lot.  It does fail from
time to time though so be sure to try without -DNOCLEAN before reporting
breakage.

-- Brooks

-- 
Any statement of the form X is the one, true Y is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4


pgp0.pgp
Description: PGP signature


make_dev cdevsw_add (Is there anyone that could answer this ?)

2003-10-30 Thread (rp)
Hello (again)!

I would kindly request explanation on how are cdevsw_add and
make_dev related ? Maybe short example also with focus on
cdevsw_add. Thing is i do not understand the function of
cdevsw_add when i have make_dev.

Also if there is any real good document that describes most
of cdev related stuff i would appriciate if someone gives me
an url.

Second thing that i would like to know is:

struct cdevsw {
d_open_t*d_open;

When a process calls open on character device and d_open
function is called would it be possible to determine the
file descriptor returned by the open system call on that
device that is returned to the process from d_open ? That
is i would like to implement character device that wouldn't
require /dev/somedev[0-9]+ number of devices but only /dev/somedev
and would identify the open/close/ read/write operations
by pid and fd instead of dev_t's minor number.

re
RP

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 5.x kernel config changes?

2003-10-30 Thread Leo Bicknell
In a message written on Thu, Oct 30, 2003 at 02:55:50PM -0500, John Baldwin wrote:
  3) There seems to be no more LINT or other listing of all the options.
 Why?  In particular I needed options NETATALK but couldn't remember
 the name and there was no file to quickly grep.  Has the list of 
 options been moved somewhere else?
 
 sys/conf/NOTES and sys/arch/conf/NOTES

I'll reply to this message although I got this from three other people
privately.  All pointed me towards /usr/src/UPDATING, and for reference:

2621:
 Scott Flatman [EMAIL PROTECTED] sent in a decent write-up on
 the config file update procedure.
  http://people.freebsd.org/~imp/config-upd.html
 NOTE: LINT is gone.  It has been replaced with NOTES.  NOTES
 isn't buildable.  However, you can generate a LINT file:
 cd /sys/ARCH/conf  make LINT

So I looked in sys/i386/conf/NOTES which, well, had nothing of interest
in it.  Turns out the things I needed are in sys/conf/NOTES since it has
been split.

Someone with a commit bit should update the comment in UPDATING to say
NOTES is now in two parts as well. :)

Other than that, thanks much, I'm off to be a happy 5.x user now.

-- 
   Leo Bicknell - [EMAIL PROTECTED] - CCIE 3440
PGP keys at http://www.ufp.org/~bicknell/
Read TMBG List - [EMAIL PROTECTED], www.tmbg.org


pgp0.pgp
Description: PGP signature


Re: Crash 4.9-RC during heavy I/O, crashdump available.

2003-10-30 Thread Kees Jan Koster
Dear All,


 *snip crash details*

So... Uhm... Anyone?

I have gotten only one reply so far, from someone who says he's seen the
same thing.

Is there anyone who can help me get more details on what is happening? I
have no experience with crashdumps and I will need a few pointers as to
what I should be looking for.

 Yours,
   Kees Jan

---
 Kees Jan Koster e-mail:   kjkoster at kjkoster.org
 www: http://www.kjkoster.org/
---
 Life is uncertain; eat dessert first.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: libwrap crash

2003-10-30 Thread Dan Langille
On 30 Oct 2003 at 9:42, Dan Langille wrote:

 I've been tracking down a libwrap call which crashes the application. 
  The crash occurs on line 395 of contrib/tcp_wrappers/options.c, but 
 I have no idea.

I've been given some help in this offline.  Apparently, the bacula 
code is incorrectly using hosts_access. bacula should fork before it 
calls hosts_access because hosts_access will kill you on twist.  
Otherwise, you'll get either a deny or an allowed, and the thread 
continue from here.  

My offline helper was comparing the inetd source code.  I can't find 
any reference in host_options(5) or host_access(3) which point to the 
correct usage.

Is the FreeBSD documentation incomplete?  Is there a more accurate 
documentation I can point the bacula developers to?

FYI: The bacula approach is said to work under Linux and Solaris but 
I have yet to run my reproducible tests on those platforms.

Thank you.
-- 
Dan Langille : http://www.langille.org/

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: non-root process and PID files

2003-10-30 Thread Christopher Vance
On Thu, Oct 30, 2003 at 03:45:24AM -0800, Terry Lambert wrote:
Christopher Vance wrote:
You can already mark a fd 'close on exec'.

May I suggest a different feature: the ability to mark an open file
(not just its fd) 'remove on close', with permission checked at mark
time rather than close time (this status forgotten if not permitted
when set) and the unlink actually done at close time only if the file
has exactly one link and one open file instance at that time.
If all you have is an fd, you can not get from an fd to a path
without an exhaustive search of the disk, in most FS's.
I know that, but you're right that it didn't show in my previous mail.

If this thing is set at open time, rather than later, you do have a
path.  I guess for sanity, I would record the name to *node of
immediately enclosing directory, name within directory and inode of
file.  That surely gives you enough at close time to determine whether
the file is still where it was and is otherwise unattached.
Also, leaving the path peresent permits someone to hard-link it
to some other file, to make it stay around.  Since /var has a
/var/tmp, this would be a real danger, I think.
We were originally talking about pid files for root-dropping servers.
Assuming there's enough in there for a new still-root server to
determine if its predecessor is gone, there's nothing to stop the new
server removing the existing file before creating a new one for
itself, which won't have bogus links until somebody finds it again.
The attacker has a link to a file no longer in use.  Is the DOS disk
full?
Thanks for your comment, and my opportunity to learn from it; there's
clearly more thought needed.
And I know that the whole idea of setting up things to happen at a
later time like this is not particularly in flavour with the rest of
Unix.
Simpler alternative not requiring kernel changes:

program:
fork
if child
setup file
drop privs
do stuff
if parent
wait for child
remove file
The post-fork parent code could be made very simple to audit by
execing a program whose sole purpose is the wait/remove.
--
Christopher Vance
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: O_NOACCESS?

2003-10-30 Thread andi payn
On Thu, 2003-10-30 at 07:46, andi payn wrote:
 As far as I can tell, FreeBSD doesn't have anything equivalent to
 linux's O_NOACCESS (which is not in any of the standard headers, but
 it's equal to O_WRONLY | O_RDWR, or O_ACCMODE). In linux, this can be
 used to say, give me an fd for this file, but don't try to open it for
 reading or writing or anything else. 

I've been playing with this. I took out the test for ((flags 
O_ACCMODE) == O_ACCMODE) in kern_open (in sys/kern/vfs_syscalls.c), and
modified FFLAGS and OFLAGS (in sys/fcntl.h) to wrap around the lower two
bits (so 3, O_ACCMODE, becomes 0), then rebuilt everything. 

Everything seems to work as well as ever--as I expected, since only
programs that depend on using open(O_ACCMODE) to get an EINVAL should be
surprised. 

I suppose the slightly-more-complicated FFLAGS and OFLAGS macros is
slowing down my system to a some degree, although there's no slowdown
that I can tell by normal use, or by running benchmarks. Still, if I
knew every place the fflags result was used, it would probably be better
to use simpler macros wherever possible (usually the only part you need
is FREAD | FWRITE, but not always).

However, I haven't yet tested what all of the different vfs modules do
when opening or processing a file with !FREAD and !FWRITE. I also
haven't tested actually using O_ACCMODE yet--to see if I can get an fd
for a file I have no access to, verify that it won't let me read or
write on that fd, make sure I'm allowed to close it, etc.

Can anyone think of anything I should expect to go wrong? Or, more
important, anything I should test that I seem to have missed?

Meanwhile, I've been looking into where this is used in linux, and other
than internally (for symlinks), it seems like opening with neither read
nor write access is only used by lilo (and lilo also does all kinds of
other weird things--like opening with mode -1 for passthrough). 

I thought the dnotify utility or the fam dnotify patch would do this
(anything you can stat, you should be able to monitor), but I was wrong.
So maybe this isn't a very useful feature anyway. On the other hand,
just because the dnotify patch for fam doesn't take advantage of it
doesn't mean a kqueue patch for fam shouldn't


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: stupid C language question

2003-10-30 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Nickolay A. Kritsky [EMAIL PROTECTED] writes:
:   My fellow freebsd-hackers! I ran ino minor problem here. I am
: currently debugging some part of FreeBSD bridging/vlan'ing kernel
: code. Every N minutes I want to add some debugging printf's in kernel
: or remove some previously installed. And now - a stupid question! When
: I change some .c files in src/sys/net directory, do I need to do 'make
: depend  make kernel' or I can just 'make kernel'? System is 4.8-p3.
: Any help is very good, and please cc: me in your replies as I am not
: subscribed to this list.

If you've already done one make depend, you don't need to do another
until you update your sources, or add new .h dependencies.

Warner
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: 5.x kernel config changes?

2003-10-30 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Leo Bicknell [EMAIL PROTECTED] writes:
: 3) There seems to be no more LINT or other listing of all the options.
:Why?  In particular I needed options NETATALK but couldn't remember
:the name and there was no file to quickly grep.  Has the list of 
:options been moved somewhere else?

cd i386/conf
make LINT

There's a notes file that lint is now generated from.

Warner
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: non-root process and PID files

2003-10-30 Thread Nielsen
Christopher Vance wrote:
May I suggest a different feature: the ability to mark an open file
(not just its fd) 'remove on close', with permission checked at mark
time rather than close time (this status forgotten if not permitted
when set) and the unlink actually done at close time only if the file
has exactly one link and one open file instance at that time.
WinNT (2K etc...) has this capability. Not saying that this makes it a 
good idea though.

Nate

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: [SOLVED] [4.8-RELEASE - Stable, 5.1-RELEASE] Panics when system loaded

2003-10-30 Thread Jaco H. van Tonder
On Mon, Oct 27, 2003 at 01:08:18PM +0200, Jaco van Tonder wrote:

 Can anybody perhaps give a hint in which direction to look or to make
this
 go away?

Do you have stale modules loaded?

Kris

Hi all,

This problem was solved. The culprit was a bad memory module. :( Thanks to
all for your ideas.

Have a good one.
Jaco


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]