Re: Error in adding system call in OpenBSD 6.3

2018-04-21 Thread Neeraj Pal
On Sun, Apr 22, 2018 at 3:14 AM, Paul Irofti  wrote:
> On Sun, Apr 22, 2018 at 12:23:09AM +0530, Neeraj Pal wrote:
>> Hello guys,
>>
>> I am facing some issue during adding system call on OpenBSD 6.3. I
>> have shown my pathways to add system call, please guys correct me if
>> somewhere I have forgotten something to add or build.
>>
>> 1) echo "331 { int sys_hello(void); }" >> /usr/src/sys/kern/syscalls.master
>>
>> 2) make init_sysent.c
>
> I don't know what this does, but you are supposed to run
> kern/makesyscalls.sh after modifying syscalls.master.

Oh, okay. But, "make init_sysent.c" will regenerate the init_sysent.c,
syscalls.c, syscallargs.h, and syscalls.h files, all of which depend
on syscalls.master.
And, I think all are same, I mean if you do "sh makesyscalls.sh
syscalls.conf syscalls.master" or "make syscalls" or "make
init_sysent.c", they all produce the same result.



report fb_queue error in fuse_lookup to simplify debugging [tiny patch]

2018-04-21 Thread IL Ka
There are some people on @misc faced with
"libfuse vnode reclaim failed" error.

http://openbsd-archive.7691.n7.nabble.com/sshfuse-fusefs-libfuse-vnode-reclaim-failed-td341072.html

I suggest to report errno explicitly so, people
will be able to use intro(2) to find description of error


diff --git sys/miscfs/fuse/fuse_lookup.c sys/miscfs/fuse/fuse_lookup.c
index 5ccc9fe81..a3c57abdf 100644
--- sys/miscfs/fuse/fuse_lookup.c
+++ sys/miscfs/fuse/fuse_lookup.c
@@ -196,8 +196,10 @@ fusefs_lookup(void *v)
 reclaim:
if (nid != dp->ufs_ino.i_number && nid != FUSE_ROOTINO) {
fbuf = fb_setup(0, nid, FBT_RECLAIM, p);
-   if (fb_queue(fmp->dev, fbuf))
-   printf("fusefs: libfuse vnode reclaim failed\n");
+   int queue_error;
+   queue_error = fb_queue(fmp->dev, fbuf);
+   if (queue_error != 0)
+   printf("fusefs: libfuse vnode reclaim failed:
%d\n", queue_error);
fb_delete(fbuf);
}
return (error);


Despite the man, wsmouse(4) can't be shared between X(1) and wsmoused(8) (workaround included)

2018-04-21 Thread IL Ka
man wsmoused:
"wsmoused will happily coexist with the X Window System, provided that the
mouse device is supported by wsmouse(4). "

I have wsmouse0 on pms0 (PS/2 controller emulation running on VirtualBox)

When moused works on /dev/wsmouse, X reports
that device /dev/wsmouse is busy and mouse does not work.

To investigate it, I tried to open(2) it and perror(3) said "Device busy":
I then stopped wsmoused, and open(2) worked.
So, X is right: it can't share /dev/wsmouse with wsmoused.

I then created custom ServerLayout for X
with InputDevice backed by "ws" driver pointing to "/dev/wsmouse0"

and it worked.

So, X can access my mouse directly (via /dev/wsmouse0) but not
via multiplex (/dev/wsmouse)

I have 2 approaches to fix it:
1) Update wsmoused(8) man page and write that user must stop it before X
2) Patch "ws" to probe first N mice: it will start X with mouse even if
wsmoused runs

Which one should I take?

I also suggest to move following phrase from wsmoused(8) to wsmouse(4) man:
"/dev/wsmouse (the multiplexer device that receives all mouse events from
all wsmouse compatible mice on the system)"

This information is vital to understand how wsmouse works, and it is not
easy to find now.
Should I do that?


Ilya.


Re: Error in adding system call in OpenBSD 6.3

2018-04-21 Thread Paul Irofti
On Sun, Apr 22, 2018 at 12:23:09AM +0530, Neeraj Pal wrote:
> Hello guys,
> 
> I am facing some issue during adding system call on OpenBSD 6.3. I
> have shown my pathways to add system call, please guys correct me if
> somewhere I have forgotten something to add or build.
> 
> 1) echo "331 { int sys_hello(void); }" >> /usr/src/sys/kern/syscalls.master
> 
> 2) make init_sysent.c

I don't know what this does, but you are supposed to run
kern/makesyscalls.sh after modifying syscalls.master.



Error in adding system call in OpenBSD 6.3

2018-04-21 Thread Neeraj Pal
Hello guys,

I am facing some issue during adding system call on OpenBSD 6.3. I
have shown my pathways to add system call, please guys correct me if
somewhere I have forgotten something to add or build.

1) echo "331 { int sys_hello(void); }" >> /usr/src/sys/kern/syscalls.master

2) make init_sysent.c

3) /usr/src/sys/kern/sys_hello.c

#include 
#include 
#include 
#include 

int
sys_hello(struct proc *p, void *v, register_t *retval)
{
printf("Hello world from kernel space.\n");
return (0);
}

4) echo "file kern/sys_hello.c" >> /usr/src/sys/conf/files

5) cd /usr/src/sys/arch/amd64/compile/CUSTOM.MP/

6) make obj && make -j4

And, then, It throws an error given below,

"
ld -T ld.script -X --warn-common -nopie -o bsd ${SYSTEM_HEAD} vers.o ${OBJS}

init_sysent.o:(.data+0x14b8): undefined reference to `sys_hello'

*** Error 1 in /usr/src/sys/arch/amd64/compile/CUSTOM.MP (Makefile:918
'bsd': @echo ld -T ld.script -X --warn-common -nopie -o bsd
'${SYSTEM...)
"

I have even tried to "make" with "-n" and "-d"options, so, that I can
debug make process, but, it didn't help me.

I have also tried to manually include sys.hello.o in {OBJS} in file
"/usr/src/sys/arch/amd64/compile/CUSTOM.MP/obj/Makefile" and also in
{CFILES} etc. like all other system calls files included. For example,
sys_generic.c etc.

But, some days ago, I did the same with OpenBSD 6.2 or 6.3 (I forgot)
in VirtualBox and it was working at that time.
The system call was added successfully at that time.