Re: Bumping MAXCPU on amd64?

2010-09-22 Thread pluknet
2010/9/22 Maxim Sobolev sobo...@freebsd.org:
 Hi,

 Is there any reason to keep MAXCPU at 16 in the default kernel config? There
 are quite few servers on the market today that have 24 or even 32 physical
 cores. With hyper-threading this can even go as high as 48 or 64 virtual
 cpus. People who buy such hardware might get very disappointed finding out
 that the FreeBSD is not going to use such hardware to its full potential.

 Does anybody object if I'd bump MAXCPU to 32, which is still low but might
 me more reasonable default these days, or at least make it an kernel
 configuration option documented in the NOTES?

Please correct me, if I'm about smth. different, but isn't it already?

/sys/amd64/include/param.h:#define MAXCPU   32
/sys/arm/include/param.h:#defineMAXCPU  2
/sys/i386/include/param.h:#define MAXCPU32
/sys/ia64/include/param.h:#define   MAXCPU  32
/sys/mips/include/param.h:#define   MAXCPU  MAXSMPCPU
/sys/powerpc/include/param.h:#defineMAXCPU  2
/sys/sparc64/include/param.h:#define MAXCPU 16
/sys/sun4v/include/param.h:#define MAXCPU   32

(almost 2y ago for x86)

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Bumping MAXCPU on amd64?

2010-09-22 Thread pluknet
2010/9/22 Curtis Penner curtis.penn...@gmail.com:
 MAXCPU at 32 has been good in the 32bit days.  Soon there will be (if not
 already) systems that will have 16cores/socket or more, and motherboards
 that have 4 sockets or more.  Combining this with hyper-threading, you have
 gone significantly beyond the limits of feasible server.

There is a one (16cores per socket, up to 4 sockets, 512 way).
http://www.oracle.com/us/corporate/press/173536

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: zfs + uma

2010-09-18 Thread pluknet
On 18 September 2010 17:52, Robert N. M. Watson rwat...@freebsd.org wrote:

 On 18 Sep 2010, at 13:35, Fabian Keil wrote:

 Doesn't build for me on amd64:

 f...@r500 /usr/src/tools/tools/umastat $make
 Warning: Object directory not changed from original 
 /usr/src/tools/tools/umastat
 cc -O2 -pipe  -fno-omit-frame-pointer -std=gnu99 -fstack-protector 
 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter 
 -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized 
 -Wno-pointer-sign -c umastat.c
 cc1: warnings being treated as errors
 umastat.c: In function 'uma_print_bucketlist':
 umastat.c:234: warning: format '%llu' expects type 'long long unsigned int', 
 but argument 3 has type 'uint64_t'
 umastat.c:234: warning: format '%llu' expects type 'long long unsigned int', 
 but argument 4 has type 'uint64_t'
 umastat.c: In function 'uma_print_cache':
 umastat.c:245: warning: format '%llu' expects type 'long long unsigned int', 
 but argument 3 has type 'u_int64_t'
 umastat.c:246: warning: format '%llu' expects type 'long long unsigned int', 
 but argument 3 has type 'u_int64_t'
 umastat.c: In function 'main':
 umastat.c:416: warning: format '%llu' expects type 'long long unsigned int', 
 but argument 2 has type 'u_int64_t'
 umastat.c:418: warning: format '%llu' expects type 'long long unsigned int', 
 but argument 2 has type 'u_int64_t'
 umastat.c:420: warning: format '%llu' expects type 'long long unsigned int', 
 but argument 2 has type 'u_int64_t'
 umastat.c:426: warning: dereferencing type-punned pointer will break 
 strict-aliasing rules
 umastat.c:429: warning: dereferencing type-punned pointer will break 
 strict-aliasing rules
 *** Error code 1

 Stop in /usr/src/tools/tools/umastat.

 The attached patch seems to work around the problem, I'm not sure if
 the casts to void* are better than decreasing the WARN level, though ...

 This is a 32-bit/64-bit issue. Probably all pointers printing should be 
 converted to %p, and large integer types to %ju and %jd, perhaps with a cast 
 first to intmax_t or uintmax_t if required.


FYI, There is a PR 146119 about sort of fixing that issues.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: strange problem with int64_t variables

2010-07-16 Thread pluknet
On 16 July 2010 01:42, Gabor Kovesdan ga...@freebsd.org wrote:
 Em 2010.07.13. 16:05, pluknet escreveu:

 #ifndef _SYS_SYSPROTO_H_
 struct setjlimit_args {
         jid_t   jid;
         int     resource;
         struct rlimit *rlp;
 };
 #endif
 int
 setjlimit(td, uap)
         struct thread *td;
         struct setjlimit_args /* {
                 jid_t   jid;
                 int     resource;
                 struct rlimit *rlp;
         } */ *uap;
 {

         printf(%s called\n, __FUNCTION__);

         printf(resource: %d\n, uap-resource);
         if (uap-resource= JLIM_NLIMITS) {
                 td-td_retval[0] = -1;
                 return (EINVAL);
         }
         return (0);
 }


 Thanks for trying this out. I still couldn't find the problem. Is this
 generate code? I mean the prototype of the function. I'm using C99 syntax
 and I manually added the implementation, the generated code what I'm using
 is just what make sysent generated. Besides, the generated code in
 sysproto.h is different from this struct that you have here, there are
 padding members, as well:

 +struct setjlimit_args {
 +       char jid_l_[PADL_(__jid_t)]; __jid_t jid; char
 jid_r_[PADR_(__jid_t)];
 +       char resource_l_[PADL_(int)]; int resource; char
 resource_r_[PADR_(int)];
 +       char rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char
 rlp_r_[PADR_(struct rlimit *)];
 +};



 And what do you have in syscalls.master? Is it the same as I have?

 +527AUE_NULLSTD { int setjlimit(__jid_t jid, int resource, \
 +   struct rlimit *rlp); }

Almost the same (#__jid_t#jid_t#).

struct setjlimit_args {
char jid_l_[PADL_(jid_t)]; jid_t jid; char jid_r_[PADR_(jid_t)];
char resource_l_[PADL_(int)]; int resource; char
resource_r_[PADR_(int)];
char rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char
rlp_r_[PADR_(struct rlimit *)];
};

526 AUE_NULLSTD { int setjlimit(jid_t jid, int resource, \
struct rlimit *rlp); }

The difference (and probably a trigger of bug elsewhere) might be in
that this lives
on amd64 arch (while yours on i386 afair). Just a food for thoughts.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: strange problem with int64_t variables

2010-07-13 Thread pluknet
On 12 July 2010 15:11, Gabor Kovesdan ga...@freebsd.org wrote:
 Em 2010.07.12. 9:00, pluknet escreveu:

 Looking at getjid() impl, I see you're trying to put jid_t into the
 one register_t
 which are 64-bit vs 32-bit capable respectively.
 You need to cast so you put 64-bit into two 32-bit as done for e.g.
 lseek().


 Thanks for pointing this out, probably this was the problem, I'll try later
 because for now, I switched to 32-bit jid_t and that part works but there's
 other similar problem now:

 +int
 +setjlimit(struct thread *td, struct setjlimit_args *uap)
 +{
 +       struct jobentry *jp;
 +
 +       /* sanity check */
 +       if (uap-resource= JLIMIT_NLIMITS) {
 +               td-td_retval[0] = -1;
 +               return (EINVAL);
 +       }

 ...

 The rest is just generated code with make sysent.

 I call this with resource parameter set to JLIMIT_NUMPROC (whose value is 3)
 and then inside the function it is seen as 869787392, so I always get
 EINVAL. In this case resource is just a normal int so I don't know what's
 going wrong.


Hmm.. something on your side.

# ./setjlimit_test
setjlimit returns zero

on console:
setjlimit called
resource: 3


#ifndef _SYS_SYSPROTO_H_
struct setjlimit_args {
jid_t   jid;
int resource;
struct rlimit *rlp;
};
#endif
int
setjlimit(td, uap)
struct thread *td;
struct setjlimit_args /* {
jid_t   jid;
int resource;
struct rlimit *rlp;
} */ *uap;
{

printf(%s called\n, __FUNCTION__);

printf(resource: %d\n, uap-resource);
if (uap-resource = JLIM_NLIMITS) {
td-td_retval[0] = -1;
return (EINVAL);
}
return (0);
}

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: strange problem with int64_t variables

2010-07-12 Thread pluknet
On 11 July 2010 18:58, Gabor Kovesdan ga...@freebsd.org wrote:
 Em 2010.07.11. 16:54, Dimitry Andric escreveu:

 On 2010-07-11 16:46, Gabor Kovesdan wrote:


 I have two int64_t variables in kernel code, first is stored internally
 and the second one is passed from a syscall argument. When I print them
 with printf %lld modifier, the internal one behaves correctly but the
 other one I pass from a syscall has a corrupted value. If I pass 1, it
 prints out 3735348794091372545. I'm not doing anything special with it
 just reading it out from the struct that was generated with make sysent.


 Since 3735348794091372545 is 0x33d69ff1, it looks like the upper
 word got corrupted somehow.  Maybe some part of it got non-atomically
 assigned?  Maybe the wrong word was read?  It is hard to tell without
 code...  :)


 Userland syscall calling:

 killjob(getjid(), SIGINT);  //getjid() returns 1 this case, whose type is
 jid_t


Looking at getjid() impl, I see you're trying to put jid_t into the
one register_t
which are 64-bit vs 32-bit capable respectively.
You need to cast so you put 64-bit into two 32-bit as done for e.g. lseek().

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: envy24 driver broken

2010-07-07 Thread pluknet
On 7 July 2010 22:39,  xorquew...@googlemail.com wrote:
 Hello.

 Is anyone using the envy24 audio driver?

 I've tried it with two cards (M-Audio Delta 66, M-Audio Audiophile)
 and it just doesn't work properly. Both are claimed to be supported
 and yet they spew errors to the console on boot:

 WRITE_MIXER: Device not configured
 WRITE_MIXER: Device not configured
 WRITE_MIXER: Device not configured
 WRITE_MIXER: Device not configured
 WRITE_MIXER: Device not configured
 WRITE_MIXER: Device not configured
 WRITE_MIXER: Device not configured

 etc.

 I can get audio out (most of the time) but only on two channels despite
 the Delta 66 being a six channel card. I can't get audio in at all.

 It seems like the driver's not been updated for over a year and that
 nobody really seems to be interested in the fact that it doesn't work.

 Any assistance would be appreciated (or recommendations for pro audio
 hardware that actually works with freebsd).

 Regards,
 xw

Hi!

I have audiophile192 card, it uses a different envy24ht (not envy24),
but with the same mixer warnings you described above.
I saw these warning since time driver has been committed to the tree.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: envy24 driver broken

2010-07-07 Thread pluknet
On 7 July 2010 22:58,  xorquew...@googlemail.com wrote:
 On 2010-07-07 22:50:14, pluknet wrote:

 Hi!

 I have audiophile192 card, it uses a different envy24ht (not envy24),
 but with the same mixer warnings you described above.
 I saw these warning since time driver has been committed to the tree.

 Hi,

 Does the card actually work?

 Can you get audio input and output (and both at the same time,
 full duplex?)


I just tried 2ch output.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: How change process flags from userland?

2010-06-30 Thread pluknet
On 30 June 2010 10:26, Andrey Zonov andrey.zo...@gmail.com wrote:
 Hi,

 I want to set P_PROTECTED flag for some daemons after it start, without
 patching application and kernel.
 It possible?


May be madvise(NULL, 0, MADV_PROTECT) will fit your needs?
(see howto example in usr.sbin/cron).
Note, this behav isn't portable.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: How change process flags from userland?

2010-06-30 Thread pluknet
On 30 June 2010 11:33, pluknet pluk...@gmail.com wrote:
 On 30 June 2010 10:26, Andrey Zonov andrey.zo...@gmail.com wrote:
 Hi,

 I want to set P_PROTECTED flag for some daemons after it start, without
 patching application and kernel.
 It possible?


 May be madvise(NULL, 0, MADV_PROTECT) will fit your needs?
 (see howto example in usr.sbin/cron).
 Note, this behav isn't portable.


Ahem, please ignore my post.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: How to get a thread ID?

2010-06-03 Thread pluknet
2010/6/3 Václav Haisman v.hais...@sh.cvut.cz:
 Kostik Belousov wrote, On 3.6.2010 17:19:
 On Thu, Jun 03, 2010 at 09:44:52AM -0500, Dan Nelson wrote:
 In the last episode (Jun 03), V??clav Haisman said:
 is it possible to obtain some sort of a thread ID that identifies a thread
 within a process other than pthread_self()?  Something like gettid() on
 Linux?  Apparently, on FreeBSD the pthread_t is a pointer type and does
 not identify the thread well enough.  GDB on FreeBSD seems to know about
 threads and does not seem to use the same ID as is pthread_t.

 The return value of pthread_self() is a pointer to the (private) struct
 pthread for the current thread, and should uniquely identify a thread.  Do
 you have a testcase that shows otherwise?  GDB might just enumerate the
 currently active threads starting from 1.

 There is thr_self(2) undocumented syscall:
 int thr_self(long *id);
 Thanks, I'll try it. Is the returned ID the LWP ID that GDB shows?


thr_self() does its work as well as ddb and procstat do: using td-td_tid.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: utimes(2): changing the birth time

2010-05-12 Thread pluknet
On 12 May 2010 22:38, Gary Jennejohn gljennj...@googlemail.com wrote:
 On Wed, 12 May 2010 17:53:38 +
 Knowledge Seeker knosee...@googlemail.com wrote:

 Hi,
 Is there a way to set birth time to a value greater(newer) than the actual
 birth time (not in the future, but not the current time)?
 The man page utimes(2) says that is only possible to change to an older
 value.

 I saw a way to do this by opening a new file, coping the data, setting the
 other attributes, then calling utimes 2 times to set the birth and the
 modification time.

 Is there a way to change it without creating a new file?


 Not with the current code.  vfs_syscalls.c:setutimes() explicitly checks
 that the new time is less than va_birthtime.

 Interestingly enough, there's code in the routine to handle what this
 comment in utimes(2) mentions, but it's not implemented yet.

 Ideally a new system call will be added that allows the setting of all
 three times at once.


btw, there's a paper someone can find something interesting at.
http://www.usenix.org/events/bsdcon03/tech/full_papers/mckusick/mckusick_html/

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: FreeBSD kernel doesn't boot on FUJITSU PRIMERGY RX200 S5 server

2010-04-21 Thread pluknet
2010/4/21 Andrey V. Elsukov bu7c...@yandex.ru:
 On 21.04.2010 2:44, Maxim Sobolev wrote:

 Maxim Sobolev wrote:

 Maybe try adding

 hint.atkbdc.0.disabled=1
 hint.atkbd.0.disabled=1

 Actually it helped, thank you very much! The problem was that I have had
 my hints compiled into the kernel itself.

 Hi, Maxim.

 I tried to boot 9.0-CURRENT amd64 snapshot on IBM x3650 M2 and seems have
 the
 same problem, i set hints from loader prompt, but this didn't help.
 Can you explain what you did to boot FreeBSD faster?


Hmm.. That's strange to hear.
We have in production a number of x3650m2: 7.2-R, 7.3-R (all amd64).
All runs flawlessly.
 I'll try to boot it from head today if that matters.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Panic in vm_map_stack

2010-03-26 Thread pluknet
On 26 March 2010 23:10, Tom Judge t...@tomjudge.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 This is the function, I am guessing that I need to unlock the proc
 before calling vmspace_free ?



As far as I know you cannot lock a process around
locking vmspace and/or vm_map (at least on 6.x).
I used process reference counting for that purpose.
Sort of the following mumble..

sx_slock(allproc_lock);
FOREACH_PROC_IN_SYSTEM(p) {
struct vmspace *vm;

PROC_LOCK(p);

/* Keep this process around until we finish this request. */
_PHOLD(p);
PROC_UNLOCK(p);

vm = vmspace_acquire_ref(p);
if (vm == NULL) {
PRELE(p);
continue;
}
if (!vm_map_trylock_read(vm-vm_map)) {
vmspace_free(vm);
PRELE(p);
continue;
}
vm_map_unlock_read(vm-vm_map);
vmspace_free(vm);
}

/*
 * Drop our hold on this process now
 * that the request has completed.
 */
PRELE(p);
}
sx_sunlock(allproc_lock);



  673 /* Given credential, return memory usage in bytes. */
  674 void
  675 prison_memory(struct prison *pr)
  676 {
  677     struct proc *p;
  678     struct thread *td;
  679     struct vmspace *vm;
  680     long mem_used = 0;
  681     long full_mem_used = 0;
  682     long proc_res = 0;
  683
  684     /*
  685      * TODO: this is a really bad way of doing the
  686      * search, as we end up going across all processes
  687      * for each jail.  It'd be more efficient to just do
  688      * this once in a period and update the relevant jail.
  689      *
  690      */
  691     sx_slock(allproc_lock);
  692
  693     FOREACH_PROC_IN_SYSTEM(p) {
  694     int breakout;
  695         proc_res=0;
  696     vm = NULL;
  697         if (PROC_TRYLOCK(p) == 0)
  698         continue;
  699     /*
  700      * If this is a system or protected process, skip it.
  701      */
  702     if ((p-p_flag  P_SYSTEM) || (p-p_pid == 1) ||
  703         (p-p_flag  P_PROTECTED) ||
  704         (p-p_pid  48)) {
  705         PROC_UNLOCK(p);
  706         continue;
  707     }
  708     /*
  709      * If the process is in a non-running type state,
  710      * don't touch it.  Check all the threads individually.
  711      */
  712     breakout = 0;
  713     FOREACH_THREAD_IN_PROC(p, td) {
  714         thread_lock(td);
  715         if (!TD_ON_RUNQ(td) 
  716             !TD_IS_RUNNING(td) 
  717             !TD_IS_SLEEPING(td)) {
  718             thread_unlock(td);
  719             breakout = 1;
  720             break;
  721         }
  722         thread_unlock(td);
  723     }
  724     if (breakout) {
  725         PROC_UNLOCK(p);
  726         continue;
  727     }
  728
  729         if (p-p_state == PRS_NEW ||
  730         p-p_state == PRS_ZOMBIE ||
  731             !jailed(p-p_ucred) ||
  732             (pr != p-p_ucred-cr_prison) ||
  733             !p-p_vmspace) {
  734             PROC_UNLOCK(p);
  735             continue;
  736         }
  737     /*
  738      * get the process size
  739      */
  740     vm = vmspace_acquire_ref(p);
  741     if (vm == NULL) {
  742         PROC_UNLOCK(p);
  743         continue;
  744     }
  745
  746         if (!vm_map_trylock_read(vm-vm_map)) {
  747         vmspace_free(vm);
  748             PROC_UNLOCK(p);
  749             continue;
  750         }
  751         full_mem_used += vmspace_swap_count(vm);
  752         vm_map_unlock_read(vm-vm_map);
  753         proc_res = vmspace_resident_count(vm);
  754         full_mem_used += proc_res;
  755         mem_used += proc_res;
  756         vmspace_free(vm);
  757         PROC_UNLOCK(p);
  758     }
  759     sx_sunlock(allproc_lock);
  760
  761     mem_used *= PAGE_SIZE;
  762     full_mem_used *= PAGE_SIZE;
  763     /* Copy the current memory usage to the prison struct */
  764     mtx_lock(pr-pr_mtx);
  765     pr-pr_mem_usage = mem_used;
  766     pr-pr_full_mem_usage = full_mem_used;
  767     mtx_unlock(pr-pr_mtx);
  768 }
  769



 Tom



-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: ZFS'inodes' (as reported by 'df -i') running out?

2010-02-18 Thread pluknet
On 18 February 2010 14:41, Ivan Voras ivo...@freebsd.org wrote:
 Karl Pielorz wrote:

 Hi All,

 I originally posted this in freebsd-fs - but didn't get a reply... I
 have a number of systems (mostly 7.2-S/amd64) running ZFS. Some of these
 handle millions of files.

 I've noticed recently, according to df -i I'm starting to run out of
 inodes on some of them (96% used).

 e.g.

 
 Filesystem     iused    ifree %iused Mounted on
 vol/imap      1726396   69976   96%  /vol/imap
 


 I know ZFS doesn't have inodes (think they're znodes), and is capable of
 handling more files than you can probably sensibly think about on a
 filesystem - but is df -i just getting confused, or do I need to be
 concerned?

 AFAIK ZFS allocates inodes when needed so df -i reports the previously
 allocated value. The number of available inodes should automatically
 grow as you add more files.

Sorta jfyi. That's what I see on Solaris:
df: operation not applicable for FSType zfs


-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: [patch] burncd: honour for envar SPEED

2009-11-10 Thread pluknet
2009/11/10 Dag-Erling Smørgrav d...@des.no:
 Alexander Best alexbes...@wwu.de writes:
 you're right. hundreds of functions cause segfaults when arg or args
 are NULL.  either we add safety checks for all of them (massive
 overhead) or just leave them the way they are.

 The consensus in the C community is that adding such checks does more
 harm than good, because a NULL pointer is usually a symptom of a bug
 somewhere else in the application, and checking for a NULL pointer will
 either hide that bug or trigger another error somewhere down the line,
 possibly making the real bug harder to find, rather than easier.


And which is a way some well known OS' developers like to choose to
fix sec.holes. No cookie.
P.S. I apologize for flaming on this.

 (next week's topic: the return value of malloc(0)...)

 DES
 --
 Dag-Erling Smørgrav - d...@des.no


-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH

2009-10-23 Thread pluknet
2009/10/23 Antony Mawer li...@mawer.org:
 On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best
 alexbes...@math.uni-muenster.de wrote:
 hi everyone,

 together with hugh mahon (the author of ee) i've been trying to fix a nasty
 bug in ee. for some reason ee exits (not crashes) and leaves the console
 corrupted when receiving SIGWINCH (`killall -SIGWINCH ee` should exit all
 running ee instances).

 I noticed this the other day when working on a new 8.0-RC1 system...
 in my case I was using putty (Windows ssh client) to access the system
 and maximised the window I had ee running in, and noticed ee just
 dumped me straight to the prompt.

 I am wondering if this has anything to do with the new tty subsystem
 in 8.0, as this wasn't a problem I've experienced before under 7.x...


No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH

2009-10-23 Thread pluknet
2009/10/23 Alexander Best alexbes...@math.uni-muenster.de:
 Gary Jennejohn schrieb am 2009-10-23:
 On Fri, 23 Oct 2009 12:58:43 +0400
 pluknet pluk...@gmail.com wrote:

  2009/10/23 Antony Mawer li...@mawer.org:
   On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best
   alexbes...@math.uni-muenster.de wrote:
   hi everyone,

   together with hugh mahon (the author of ee) i've been trying to
   fix a nasty
   bug in ee. for some reason ee exits (not crashes) and leaves the
   console
   corrupted when receiving SIGWINCH (`killall -SIGWINCH ee` should
   exit all
   running ee instances).

   I noticed this the other day when working on a new 8.0-RC1
   system...
   in my case I was using putty (Windows ssh client) to access the
   system
   and maximised the window I had ee running in, and noticed ee just
   dumped me straight to the prompt.

   I am wondering if this has anything to do with the new tty
   subsystem
   in 8.0, as this wasn't a problem I've experienced before under
   7.x...


  No, that's a regression appeared in (FreeBSD'ish? version of) ee
  1.5.0.


 SIGWINCH is handled in new_curse.c, but it's not being
 compiled/linked.

 ---
 Gary Jennejohn

 i think that file is only used on systems which have termio.h/sgtty.h and ee
 doesn't get linked against ncurses. on those systems (linux e.g.) new_curse.c
 is used to handle certain things which ncurses takes care under freebsd.

 this is under freebsd:

 `make`:
 Neither termio.h or sgtty.h are on this system!
 Relying on local curses implementation.
 Generating make.local
 make -f make.local
 cc ee.c -o ee -ggdb -DDIAG -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB -DHAS_CTYPE
 -DHAS_SYS_IOCTL -DHAS_SYS_WAIT   -DSLCT_HDR
 -DTERMCAP=\/usr/share/misc/termcap\ -lcursesw

 `ldd ee`:
 libncursesw.so.8 = /lib/libncursesw.so.8 (0x2809b000)
 libc.so.7 = /lib/libc.so.7 (0x280e9000)


[Probably already mentioned.]

btw, ee compiled under fbsd with new_curse.c
(and not linked with curses/cursesw) goes fine with SIGWINCH.

--- Makefile.old2009-10-23 16:13:45.0 +0400
+++ Makefile2009-10-23 16:30:03.0 +0400
@@ -3,15 +3,14 @@
 .PATH: ${.CURDIR}/../../contrib/ee

 CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \
--DHAS_SYS_WAIT
+-DHAS_SYS_WAIT -DCAP -DNCURSE

 PROG=  ee
+SRCS=  ee.c new_curse.c
 LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit
 MLINKS=ee.1 ree.1 ee.1 edit.1
-DPADD= ${LIBNCURSES}
-LDADD= -lncurses

-WARNS?=2
+WARNS?=0

 NLS=   en_US.US-ASCII fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \
uk_UA.KOI8-U ru_RU.KOI8-R hu_HU.ISO8859-2

$ ldd ./ee
./ee:
libc.so.6 = /lib/libc.so.6 (0x2808a000)

(yes, it's FreeBSD 6.x).

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH

2009-10-23 Thread pluknet
2009/10/23 Alexander Best alexbes...@math.uni-muenster.de:
 pluknet schrieb am 2009-10-23:
 2009/10/23 Alexander Best alexbes...@math.uni-muenster.de:
  Gary Jennejohn schrieb am 2009-10-23:
  On Fri, 23 Oct 2009 12:58:43 +0400
  pluknet pluk...@gmail.com wrote:

   2009/10/23 Antony Mawer li...@mawer.org:
On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best
alexbes...@math.uni-muenster.de wrote:
hi everyone,

together with hugh mahon (the author of ee) i've been trying
to
fix a nasty
bug in ee. for some reason ee exits (not crashes) and leaves
the
console
corrupted when receiving SIGWINCH (`killall -SIGWINCH ee`
should
exit all
running ee instances).

I noticed this the other day when working on a new 8.0-RC1
system...
in my case I was using putty (Windows ssh client) to access
the
system
and maximised the window I had ee running in, and noticed ee
just
dumped me straight to the prompt.

I am wondering if this has anything to do with the new tty
subsystem
in 8.0, as this wasn't a problem I've experienced before under
7.x...


   No, that's a regression appeared in (FreeBSD'ish? version of) ee
   1.5.0.


  SIGWINCH is handled in new_curse.c, but it's not being
  compiled/linked.

  ---
  Gary Jennejohn

  i think that file is only used on systems which have
  termio.h/sgtty.h and ee
  doesn't get linked against ncurses. on those systems (linux e.g.)
  new_curse.c
  is used to handle certain things which ncurses takes care under
  freebsd.

  this is under freebsd:

  `make`:
  Neither termio.h or sgtty.h are on this system!
  Relying on local curses implementation.
  Generating make.local
  make -f make.local
  cc ee.c -o ee -ggdb -DDIAG -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB
  -DHAS_CTYPE
  -DHAS_SYS_IOCTL -DHAS_SYS_WAIT   -DSLCT_HDR
  -DTERMCAP=\/usr/share/misc/termcap\ -lcursesw

  `ldd ee`:
  libncursesw.so.8 = /lib/libncursesw.so.8 (0x2809b000)
  libc.so.7 = /lib/libc.so.7 (0x280e9000)


 [Probably already mentioned.]

 btw, ee compiled under fbsd with new_curse.c
 (and not linked with curses/cursesw) goes fine with SIGWINCH.

 --- Makefile.old        2009-10-23 16:13:45.0 +0400
 +++ Makefile    2009-10-23 16:30:03.0 +0400
 @@ -3,15 +3,14 @@
  .PATH: ${.CURDIR}/../../contrib/ee

  CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \
 -        -DHAS_SYS_WAIT
 +        -DHAS_SYS_WAIT -DCAP -DNCURSE

  PROG=  ee
 +SRCS=  ee.c new_curse.c
  LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit
  MLINKS=        ee.1 ree.1 ee.1 edit.1
 -DPADD= ${LIBNCURSES}
 -LDADD= -lncurses

 -WARNS?=        2
 +WARNS?=        0

  NLS=   en_US.US-ASCII fr_FR.ISO8859-1 de_DE.ISO8859-1
  pl_PL.ISO8859-2 \
         uk_UA.KOI8-U ru_RU.KOI8-R hu_HU.ISO8859-2

 $ ldd ./ee
 ./ee:
         libc.so.6 = /lib/libc.so.6 (0x2808a000)

 (yes, it's FreeBSD 6.x).

 won't work under CURRENT i'm afraid:

 Warning: Object directory not changed from original /usr/src/usr.bin/ee
 cc  -O2 -fno-strict-aliasing -pipe -march=native -DHAS_NCURSES -DHAS_UNISTD
 -DHAS_STDARG -DHAS_STDLIB  -DHAS_SYS_WAIT -DCAP -DNCURSE -std=gnu99
 -fstack-protector -Wno-pointer-sign -c
 /usr/src/usr.bin/ee/../../contrib/ee/ee.c
 In file included from /usr/src/usr.bin/ee/../../contrib/ee/ee.c:68:
 /usr/src/usr.bin/ee/../../contrib/ee/new_curse.h:47:19: error: sgtty.h: No
 such file or directory
 *** Error code 1

 Stop in /usr/src/usr.bin/ee.

 here's the entry in ObsoleteFiles.inc:

 # 20080725: sgtty.h removed
 OLD_FILES+=usr/include/sgtty.h

 alex


Ah, OK. Just a stupid and not-tested guess.


-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: [problem] aac0 does not respond

2009-03-24 Thread pluknet
2009/3/24 Vladimir Ermakov samflan...@gmail.com:
 Hello, All

 Describe my problem:
 have volume RAID-10 (SAS-HDD x 6) on Adaptec RAID 5805
 2 HHD of 6  have errors in smart data (damaged)
 i am try read file /var/db/mysql/ibdata1 from this volume
 system does not respond ( lost access to ssh ) after read 6GB data from this
 file
 and print debug messages on ttyv0

 As to prevent the emergence of this problem?
 As monitor the status of RAID-controller?


You can check status of aac controller with arcconf utility

and post results there..

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Non-existing p_vmspace. When is it possible?

2009-03-11 Thread pluknet
Hi.

I perform in FOREACH_PROC_IN_SYSTEM(), where I conditionally
look at p_vmspace internals. I'd like to know the safe way to
reference p_vmspace fields without potential null-dereference.

I see an example in vm_pageout_oom(), where making access to
p-p_vmspace fields is done without additional checks.
Nevertheless I want to further catch on how it works.

Currently I additionally explicitly check on P_SYSTEM and PRS_NEW,
then p-p_vmspace against NULL.

So I'd wish to understand if a time-window between
1) placing a new process to proclist
 and
2) attaching vmspace to this process
is possible at all, and then in what cases.

I see in fork1() that a new process' (named p2 here) state is set to
PRS_NEW just before LIST_INSERT_HEAD(allproc, p2, p_list) and then
(after vmspace is already attached in vm_forkproc()) is set to PRS_NORMAL.

So an additional check on p_vmspace != NULL is not need.
Am I right?

Thanks.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Debugging init process.

2009-03-10 Thread pluknet
2009/3/10 vasanth raonaik vasanth.raon...@gmail.com:
 Hello Team,

 I need to debug init process. I am not able to attach init to gdb and it
 throws


That is because init is a system process, which you cannot trace by design
(see ptrace(2)).

$ ps -o flags -p 1
  F
10004200

, where from ps(1):
   P_SYSTEM0x00200  System proc: no sigs,
stats or swapping

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


OT: svn commit: r188764 - head/sys/kern

2009-02-18 Thread pluknet
Hi.

Am I right that td_estcpu is only updated under SCHED_4BSD ?
(well, user's ki_estcpu is not used in top anyway. ps shows all zeroes
under SCHED_ULE (as it should then though). I'm just interested.)

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: CFT: Graphics support for /boot/loader

2009-02-06 Thread pluknet
Hi, Scott!

2009/2/6 Scott Long sco...@samsco.org:
 Oliver Fromme wrote:

 Hello fellow hackers,

 Some of you might remember that I'm working on graphics
 support for our /boot/loader.  Unfortunately, progress has
 been rather slow because of non-FreeBSD-related activity.

 Anyway, I have now prepared a tarball containing a loader
 binary for public testing.  If you are eager to give it a
 try, please feel free to do so.  It should work with any
 FreeBSD version on i386 and amd64 platforms.

 I have posted detailed instructions on the FreeBSD wiki:

 http://wiki.freebsd.org/OliverFromme/BootLoaderTest

 Any kind of feedback is welcome.


 I think that this is really neat, you've done an impressive job
 with it good job.  However, I do take issue with your criticism
 of the ASCII logo; I actually spent a decent amount of time
 designing the block text logo =-)  I wish that there hadn't been
 moronic politics over the beastie logo, as that does look a lot
 better, even if it is text.  And text is still required for
 serial consoles.

Hey, then what's about that? ;)

--- /boot/beastie.4th2008-08-19 23:59:01.0 +0600
+++ /boot/beastie.4th2008-12-24 18:14:48.0 +0500
@@ -109,6 +109,27 @@
  at-xy . |/|_/|_/
 ;

+: share-logo ( x y -- )
+2dup at-xy .` 1+
+2dup at-xy . `-/oo/-```.:oshddmmddhso:.```:+oo/. 1+
+2dup at-xy . .--/shdmddNNNNdyhmddNNmh+-- 1+
+2dup at-xy . `:--/smMMNy+mMMNmho/-:: 1+
+2dup at-xy .  `/+dMMNMMMNNNmddNmho/:-/+ 1+
+2dup at-xy .   /mNNNMMMNmmmhhsso/:-:+y 1+
+2dup at-xy .  :dmdmNMNmdhyso++///:::::-++sh 1+
+2dup at-xy . `hdhdNMmhs+:-:://sy 1+
+2dup at-xy . -dsoyhhso/:.--.--+m 1+
+2dup at-xy . :d+/+/:::oN 1+
+2dup at-xy . -m/://:-...-/dm 1+
+2dup at-xy .  ys-:://:::..--omN 1+
+2dup at-xy .  .d+-::///:--:ohNd 1+
+2dup at-xy .   .ho-//:///++shy 1+
+2dup at-xy .`+s:-:+o+oyh+ 1+
+2dup at-xy .  .+o/:///osyy+ 1+
+2dup at-xy .`-//++ossys/- 1+
+ at-xy .`..--::-.
+;
+
 : print-logo ( x y -- )
 s loader_logo getenv
 dup -1 = if
@@ -131,6 +152,11 @@
 beastie-logo
 exit
 then
+2dup s share compare-insensitive 0= if
+2drop
+share-logo
+exit
+then
 2dup s none compare-insensitive 0= if
 2drop
 \ no logo

(spied out from http://www.opennet.ru/opennews/art.shtml?num=20136)

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


linking .a lib with another library

2009-02-05 Thread pluknet
Hi.

The problem is:

I have a program which is statically linked to my static lib during a build.
The lib is in turn uses kvm*() calls, hence it should be linked with libkvm.

During the build of my binaries which are linked to my libucron.a I
get the following:

/usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x6e):
In function `check_pidfile':
: undefined reference to `kvm_open'
/usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x8b):
In function `check_pidfile':
: undefined reference to `kvm_getprocs'
/usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0xbe):
In function `check_pidfile':
: undefined reference to `kvm_getprocs'
/usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x106):
In function `check_pidfile':
: undefined reference to `kvm_close'
*** Error code 1

Ok, if I add SHLIB_MAJOR directive in lib/Makefile (or remove any kvm*
references) then all is ok.
But the lib is used to be static. So the question is can I somehow
link two .a libraries?
e.g. libkvm.a + libucron.a + my binaries.

Thanks.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: linking .a lib with another library

2009-02-05 Thread pluknet
2009/2/5 pluknet pluk...@gmail.com:
 Hi.

 The problem is:

 I have a program which is statically linked to my static lib during a build.
 The lib is in turn uses kvm*() calls, hence it should be linked with libkvm.

 During the build of my binaries which are linked to my libucron.a I
 get the following:

 /usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x6e):
 In function `check_pidfile':
 : undefined reference to `kvm_open'
 /usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x8b):
 In function `check_pidfile':
 : undefined reference to `kvm_getprocs'
 /usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0xbe):
 In function `check_pidfile':
 : undefined reference to `kvm_getprocs'
 /usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x106):
 In function `check_pidfile':
 : undefined reference to `kvm_close'
 *** Error code 1

 Ok, if I add SHLIB_MAJOR directive in lib/Makefile (or remove any kvm*
 references) then all is ok.
 But the lib is used to be static. So the question is can I somehow
 link two .a libraries?
 e.g. libkvm.a + libucron.a + my binaries.


Ok, I finally got it:
gcc crond/crond.o lib/libucron.a /usr/lib/libkvm.a
-L/usr/local/lib/mysql -lmysqlclient

or in BNF (bmake normal form):
LDADD+= -lmysqlclient -lucron ${LIBKVM}

$ ldd crond/crond
crond/crond:
libmysqlclient.so.14 =
/usr/local/lib/mysql/libmysqlclient.so.14 (0x2808)
libc.so.6 = /lib/libc.so.6 (0x280d5000)
libcrypt.so.3 = /lib/libcrypt.so.3 (0x281ba000)
libm.so.4 = /lib/libm.so.4 (0x281d2000)
libz.so.3 = /lib/libz.so.3 (0x281e8000)

The only drawback is that I had to add that to crond/Makefile, not to
lib/Makefile.
crond knows nothing about kvm calls and now it has to (and lib does vice versa).

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


dublicated vm stats in sysctl

2009-01-28 Thread pluknet
Hi.

What is a purpose of some dublicated vm stuff in vm. and vm.stats. branches?

vm.v_free_min: 6392
vm.stats.vm.v_free_min: 6392
vm.v_cache_min: 26928
vm.v_cache_max: 53856
vm.stats.vm.v_cache_max: 53856
vm.stats.vm.v_cache_min: 26928

and so on..

I see some relevance in vm/vm_meter.c#rev1.62 but cannot understand it.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Determine if a kernel is built with a specific option?

2009-01-12 Thread pluknet
2009/1/12 Andrew Brampton bramp...@gmail.com:
 Hi,
 I was wondering how a autoconf configure script can determine if the
 kernel is built with a particular option. In this case the code I have
 can make use of the FreeBSD polling driver, which by default isn't
 built into a kernel. So I want my configure script to determine if the
 kernel supports it, if so sets a #define, otherwise doesn't.

 In the past I have basically hacked my way though these configure
 scripts by looking at other examples. One such example I found was for
 Linux, which does something like this:

 AC_CACHE_CHECK(for device polling kernel extension, 
 ac_cv_linux_poll_extension,
 [if grep polling `find_linuxpath include/linux/netdevice.h` /dev/null
 21; then
  ac_cv_linux_poll_extension=yes
 else ac_cv_linux_poll_extension=no; fi])
 if test $ac_cv_linux_poll_extension = yes; then
AC_DEFINE(HAVE_LINUX_POLLING)
 fi

 So I simply want to figure out an equalavant check I can do on FreeBSD.


Hi.

You may look at sysctl kern.polling presence.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: extattr problems?

2009-01-11 Thread pluknet
2009/1/11 Tim Kientzle kient...@freebsd.org:
 pluknet wrote:

 2009/1/11 Tim Kientzle kient...@freebsd.org:

 FreeBSD 6.3:

 fd = open(test, O_WRONLY | O_CREAT | O_EXCL, 0777);
 n = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, testattr, 1234, 4);

 After this, fd=3, n is non-zero, errno = 9 (EBADF)

 Huh?  I would have expected EOPNOTSUPP if
 extended attributes weren't supported on this
 filesystem.  The file descriptor is clearly
 valid.

 Simple guess.
 Don't hit me if I'm wrong. :)

 You call open() with (O_CREAT | O_EXCL) on an already existing file.

 Nope.  As you can see from my earlier summary,
 fd=3 immediately after this, so the open did
 succeed normally.

Ah, I'm sorry. My inadvertency.


 Oh, but that gives me an idea ... checking, checking
 ... darn.  Still no joy.  I tried changing the open to
 open(test, O_RDWR | O_CREATE, 0777) and it still
 fails in exactly the same way.  The open still succeeds
 and the extattr_set_fd() still fails with a nonsensical
 errno value.

It's strange..
FreeBSD jaw.ripn.net 6.3-RELEASE-p5.
works for me (tm), extattr_set_fd() returns 4 as expected.

Also works on 7.1 at home.


 Time to dig through kernel sources

 Tim


-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: extattr problems?

2009-01-10 Thread pluknet
2009/1/11 Tim Kientzle kient...@freebsd.org:
 FreeBSD 6.3:

 fd = open(test, O_WRONLY | O_CREAT | O_EXCL, 0777);
 n = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, testattr, 1234, 4);

 After this, fd=3, n is non-zero, errno = 9 (EBADF)

 Huh?  I would have expected EOPNOTSUPP if
 extended attributes weren't supported on this
 filesystem.  The file descriptor is clearly
 valid.

Simple guess.
Don't hit me if I'm wrong. :)

You call open() with (O_CREAT | O_EXCL) on an already existing file.
If such then open() returns -1 with EEXIST and subsequent extattr_set_fd() call
with fd (-1) returns EBADF from getvnode() on failed
(td-td_proc-p_fd == NULL)
or
(fp = fdp-fd_ofiles[fd]) == NULL)
checks.


 Tim

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: How to quickly determine if UFS2 FS is clean from command line?

2008-12-26 Thread pluknet
2008/12/26 Carlos A. M. dos Santos unixma...@gmail.com:
 On Fri, Dec 26, 2008 at 11:20 AM, Sean s...@gothic.net.au wrote:
 Carlos A. M. dos Santos wrote:

 Be warned that file(1) resides at /usr/bin and depends on
 /usr/share/misc/magic*, so it may not be available in early boot
 stages, when /usr is not mounted yet. The following combination will
 suffice, and depends only on /sbin and /stand:

 /sbin/ffsinfo -l 1 /usr/local | /rescue/sed -n 's/^clean *int8_t
 *\(.*\)/\1/p'


 Except FreeBSD hasn't had /stand for a long while, and there's no
 /rescue/sed (at least on 6.x and 7.x). Also, /stand was only ever populated
 on install and there's no guarantees it was ever up to date.

 Humm, 8.0 has /rescue/sed.


It's was added there over a year ago, but not in stable.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: PRINTF_BUFR_SIZE in freebsd6

2008-12-17 Thread pluknet
2008/12/17 Paul B. Mahol one...@gmail.com:
 On 12/17/08, pluknet pluk...@gmail.com wrote:
 2008/12/17 Paul B. Mahol one...@gmail.com:
 On 12/17/08, pluknet pluk...@gmail.com wrote:
 2008/12/17 pluknet pluk...@gmail.com:
 2008/12/16 Kostik Belousov kostik...@gmail.com:
 On Tue, Dec 16, 2008 at 03:23:28PM +0300, pluknet wrote:
 Hi.

 Could the PRINTF_BUFR_SIZE option be safely merged into RELENG_6
 without
 merging a possible underlining infrastructure and breaking something
 else?
 I want to use it in my custom freebsd6 because I see interspersed
 strings
 written from different CPUs at the same time:

 uuusseseerrvmrem: vlmivmeimtme :e mx:ceed eldi bly 2i89m68m (iihttt t
 pde) eaxtx cfcorke1 22e3e
 deded ebyd  by28 296898 68(h t(tpdh) att ftorkp1 22d3
 ) at fork1 223

 I'm talking about only merging kern/subr_prf.c 1.126, 1.128, 1.129.

 Thanks.

 I did a backport of the option some time ago, see
 http://people.freebsd.org/~kib/misc/releng_6_printf_bufr.3.patch


 Thank you!

 6.3 system panics (many page faults, one after another) early at boot
 without the option, and boots with it in the QEMU environment.
 Next step to test it on a real (and SMPable) hardware.


 Now tested on a real 2xXeon 3.0 w/ HTT enabled w/ PRINTF_BUFR_SIZE
 enabled.

 Received the following panic:

 And how big is PRINTF_BUFR_SIZE ?

 Hi.

 I set options PRINTF_BUFR_SIZE=128

 And maybe it's not enough (?) because I stress-tested server triggering
 to appear many kernel messages simultaneously.
 I don't know coherence between buffer size and this panic though.

 How long such kernel messages are?

48 symbols plus length of a process name... it added 6 in my case,
i.e. 54 symbols totally.

-- 
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: PRINTF_BUFR_SIZE in freebsd6

2008-12-17 Thread pluknet
2008/12/17 pluknet pluk...@gmail.com:
 2008/12/16 Kostik Belousov kostik...@gmail.com:
 On Tue, Dec 16, 2008 at 03:23:28PM +0300, pluknet wrote:
 Hi.

 Could the PRINTF_BUFR_SIZE option be safely merged into RELENG_6 without
 merging a possible underlining infrastructure and breaking something else?
 I want to use it in my custom freebsd6 because I see interspersed strings
 written from different CPUs at the same time:

 uuusseseerrvmrem: vlmivmeimtme :e mx:ceed eldi bly 2i89m68m (iihttt t
 pde) eaxtx cfcorke1 22e3e
 deded ebyd  by28 296898 68(h t(tpdh) att ftorkp1 22d3
 ) at fork1 223

 I'm talking about only merging kern/subr_prf.c 1.126, 1.128, 1.129.

 Thanks.

 I did a backport of the option some time ago, see
 http://people.freebsd.org/~kib/misc/releng_6_printf_bufr.3.patch


 Thank you!

 6.3 system panics (many page faults, one after another) early at boot
 without the option, and boots with it in the QEMU environment.
 Next step to test it on a real (and SMPable) hardware.


Now tested on a real 2xXeon 3.0 w/ HTT enabled w/ PRINTF_BUFR_SIZE enabled.

Received the following panic:

Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x72
fault code  = supervisor read, page not present
instruction pointer = 0x20:0xc07fc8c3
stack pointer   = 0x28:0xe4f56a78
frame pointer   = 0x28:0xe4f56b44
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, def32 1, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 14 (swi4: clock sio)
[thread pid 14 tid 12 ]
Stopped at  vm_fault+0x1e3: cmpw$0,0x72(%eax)
db bt
Tracing pid 14 tid 12 td 0xc63e9c80
vm_fault(c1066000,c009e000,2,0) at vm_fault+0x1e3
trap_pfault(e4f56bb0,0,c009effe) at trap_pfault+0x137
trap(410008,c63e0028,e4f50028,c009effe,c638effe,...) at trap+0x325
calltrap() at calltrap+0x5
--- trap 0xc, eip = 0xc08a2cad, esp = 0xe4f56bf0, ebp = 0xe4f56c10 ---
generic_bcopy(c0a63a68,7cf,c0a63a4c,7cf,f832) at generic_bcopy+0x41
vga_txtdraw(c0a63a40,7cf,f832,0) at vga_txtdraw+0xbe
scrn_update(c0a63a40,1) at scrn_update+0x22d
scrn_timer(c0a6c1e0) at scrn_timer+0x1e0
softclock(0) at softclock+0x1f4
ithread_execute_handlers(c63e8460,c6629800) at ithread_execute_handlers+0xd6
ithread_loop(c63a7910,e4f56d38,c0a10040,0,c0922ea6,...) at ithread_loop+0x53
fork_exit(c068d158,c63a7910,e4f56d38) at fork_exit+0x61
fork_trampoline() at fork_trampoline+0x8
--- trap 0x1, eip = 0, esp = 0xe4f56d6c, ebp = 0 ---
db
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: PRINTF_BUFR_SIZE in freebsd6

2008-12-17 Thread pluknet
2008/12/17 Paul B. Mahol one...@gmail.com:
 On 12/17/08, pluknet pluk...@gmail.com wrote:
 2008/12/17 pluknet pluk...@gmail.com:
 2008/12/16 Kostik Belousov kostik...@gmail.com:
 On Tue, Dec 16, 2008 at 03:23:28PM +0300, pluknet wrote:
 Hi.

 Could the PRINTF_BUFR_SIZE option be safely merged into RELENG_6 without
 merging a possible underlining infrastructure and breaking something
 else?
 I want to use it in my custom freebsd6 because I see interspersed
 strings
 written from different CPUs at the same time:

 uuusseseerrvmrem: vlmivmeimtme :e mx:ceed eldi bly 2i89m68m (iihttt t
 pde) eaxtx cfcorke1 22e3e
 deded ebyd  by28 296898 68(h t(tpdh) att ftorkp1 22d3
 ) at fork1 223

 I'm talking about only merging kern/subr_prf.c 1.126, 1.128, 1.129.

 Thanks.

 I did a backport of the option some time ago, see
 http://people.freebsd.org/~kib/misc/releng_6_printf_bufr.3.patch


 Thank you!

 6.3 system panics (many page faults, one after another) early at boot
 without the option, and boots with it in the QEMU environment.
 Next step to test it on a real (and SMPable) hardware.


 Now tested on a real 2xXeon 3.0 w/ HTT enabled w/ PRINTF_BUFR_SIZE enabled.

 Received the following panic:

 And how big is PRINTF_BUFR_SIZE ?

Hi.

I set options PRINTF_BUFR_SIZE=128

And maybe it's not enough (?) because I stress-tested server triggering
to appear many kernel messages simultaneously.
I don't know coherence between buffer size and this panic though.


 --
 Paul

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: PRINTF_BUFR_SIZE in freebsd6

2008-12-17 Thread pluknet
2008/12/16 Kostik Belousov kostik...@gmail.com:
 On Tue, Dec 16, 2008 at 03:23:28PM +0300, pluknet wrote:
 Hi.

 Could the PRINTF_BUFR_SIZE option be safely merged into RELENG_6 without
 merging a possible underlining infrastructure and breaking something else?
 I want to use it in my custom freebsd6 because I see interspersed strings
 written from different CPUs at the same time:

 uuusseseerrvmrem: vlmivmeimtme :e mx:ceed eldi bly 2i89m68m (iihttt t
 pde) eaxtx cfcorke1 22e3e
 deded ebyd  by28 296898 68(h t(tpdh) att ftorkp1 22d3
 ) at fork1 223

 I'm talking about only merging kern/subr_prf.c 1.126, 1.128, 1.129.

 Thanks.

 I did a backport of the option some time ago, see
 http://people.freebsd.org/~kib/misc/releng_6_printf_bufr.3.patch


Thank you!

6.3 system panics (many page faults, one after another) early at boot
without the option, and boots with it in the QEMU environment.
Next step to test it on a real (and SMPable) hardware.

--
wbr,
pluknet
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: FreeBSD (russian)

2008-12-10 Thread pluknet
2008/12/10 Julian Elischer [EMAIL PROTECTED]:
 Eygene Ryabinkin wrote:

 Wed, Dec 10, 2008 at 04:17:48AM +0200, Юлия Смолик wrote:

 Hello dear command of developers of FreeBSD. I wish to take part in the
 project on developing out of FreeBSD and to subscribe for dispatch.


 http://lists.freebsd.org/pipermail/freebsd-hackers/2008-November/026566.html
 and especially http://www.freebsd.org/projects/index.html
 http://wiki.freebsd.org/ will be good too.


 can we have a russian speaking developer contact him too?

it's her :)

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

Re: who on FreeBSD 8.0 - AMD64

2008-12-09 Thread pluknet
2008/12/9 Vadim Goncharov [EMAIL PROTECTED]:
 Hi Rink Springer!

 On Mon, 24 Nov 2008 13:27:18 +0100; Rink Springer wrote about 'Re: who on 
 FreeBSD 8.0 - AMD64':

 By the way, are there pseudo-terminal names renamed in -CURRENT ? Why?
 Yes, this is the result of the new giant-free TTY layer that was
 imported a few months ago.

 What was the reason to rename? Isn't that a POLA violation for both
 users/older software?


You should read pty(4).

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


Re: kernel vm_submap's

2008-12-04 Thread pluknet
2008/12/4 Alexej Sokolov [EMAIL PROTECTED]:
 Hello,
 Where/How can I get information about vm_submap's in the actual stable
 kernel:
 % uname -v
 FreeBSD 7.0-RELEASE-p5 #0: Tue Oct  7 19:05:20 CEST 2008
 And what kind of data is present in these submaps (mallocs, mbufs,
 DMA-buffer..)?


vm_map_submap(9) might help you.
btw, it's called only from one place I can find: kmem_suballoc.

 Thanks,

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


Re: crash at in_pcb.c

2008-10-29 Thread pluknet
 (kgdb) l
 553 in /usr/src/sys/kern/uipc_socket.c
 (kgdb) f 11
 #11 0xc077e141 in tcp_usr_connect (so=0xc9897000, nam=0xc98a1ba0,
 td=0xc990e180)
at /usr/src/sys/netinet/tcp_usrreq.c:369
 369 /usr/src/sys/netinet/tcp_usrreq.c: No such file or directory.
in /usr/src/sys/netinet/tcp_usrreq.c
 (kgdb)


Could you please get the following from kgdb?
f 7
p *inp
p *inp-inp_laddr

P.S. It's definitely 7.0 backtrace (or close to).. 6.2 has different
line numbers.

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


Re: Stupid driver build/debug questions

2008-03-27 Thread pluknet
On 27/03/2008, Alexander Sack [EMAIL PROTECTED] wrote:
 On Thu, Mar 27, 2008 at 3:25 PM, Julian Elischer [EMAIL PROTECTED] wrote:
   Alexander Sack wrote:
 Hello:

 New to the FreeBSD kernel and I'm investigating a driver problem
 (wasn't sure what list this should go on).

 I was wondering how to make a driver statically built instead of a
 loadable module?  Is this an artifact of the driver source build or
 the generic kernel configuration mechanism via options etc.?  i.e.
 does a driver need to use something different than the bsd.kmod.mk
 template make file to build a static driver.

 What I am trying to do is break at attach time more easily than
 stepping through driver_probe_and_attach()/driver_attach_child() until
 the attach routine gets called.  I realize I can add a kdb_enter() but
 I was trying to do this on a live system without rebuilding the kernel
 (I understand this contradicts my first question but I still want to
 know how to build drivers statically).
  
put the filennames in /sys/conf/files or files.i386 (or whatever)
  
at one stage you could also have a files.{CONFIGNAME} but I haven't
tried that for a long time.


 Thanks for the response.  I will try this but I do have an obvious
  question, the build scripts do not need to be edited at all with the
  extra directory/files?  It will just pickup my driver directory and
  link against the kernel automagically?

Yes, It will if you add them to standard files list (see conf/files).
(Otherwise if you want it as options directive in your kernel config
than you should mark its module name in conf/files and also put
an appropriate record into conf/options).

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


Re: pfind() in ithread handler

2008-02-28 Thread pluknet
On 28/02/2008, Yuri Pankov [EMAIL PROTECTED] wrote:
 Hi,

  I'm trying to understand the cause of following panic.

  panic: Trying sleep, but thread marked as sleeping prohibited
  cpuid = 0
  KDB: stack backtrace:
  db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
  panic() at panic+0x17d
  sleepq_add() at sleepq_add+0x2e1
  _sx_slock_hard() at _sx_slock_hard+0x15d
  _sx_slock() at _sx_slock+0xc1
  pfind() at pfind+0x24
  saa_intr() at saa_intr+0x313
  ithread_loop() at ithread_loop+0xda
  fork_exit() at fork_exit+0x12a
  fork_trampoline() at fork_trampoline+0xe
  --- trap 0, rip = 0, rsp = 0xac3c0d30, rbp = 0 ---

  Can someone enlighten me on what is causing the panic and is it ok to
  use pfind() in interrupt handler (I have very limited understanding of
  kernel internals)?

  Code in question (taken from saa driver
  http://freebsd.ricin.com/ports/distfiles/kbtv-1.92.tbz) can be found at
  http://www.pastebin.ca/921830


  TIA,
  Yuri

You cannot sleep in high priority ithread handler, pfind() uses
sleepable sx(9) lock.
In your case it fail to acquire a shared lock and trying to sleep.
Probably you should call pfind() elsewhere.

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


Re: struct devstat's bytes[] meaning

2008-01-30 Thread pluknet
On 29/01/2008, Pietro Cerutti [EMAIL PROTECTED] wrote:
 Hi list,

 I'm trying to get device IO status (i.e. read and written bytes) by
 using the devstat interface, and I wrote this small program (mostly
 inspired by the gkrellm2 port freebsd.c system-dependent module).
[snip]

 Now, I suppose that those two numbers represent the amount of IO
 generated within some time slice, but I can't find any documentation on
 it...

Did you look at devstat(3) ?
I think there is all you need to know about devstat library.

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