List of commits:
Subject Hash Author Date (UTC)
ulinux improvements and more patterns a458c52301d3a34e8b51794fea7c1cb06c1c34f8 Sylvain BERTRAND 2011-12-22 22:09:06
ulinux patterns:network server 60c167bcd530f95d0a57189035620c3bc80f1e34 Sylvain BERTRAND 2011-12-20 00:39:56
ulinux cleanup and samples 92c893f28ef42f11943c0bf80a037a5b5f34ebef Sylvain BERTRAND 2011-12-16 01:51:22
uevent listener 55657699f291575139858aec466340e7624cd66a Sylvain BERTRAND 2011-12-15 18:01:06
uevent monitor e241bd4db4af8510902a5c606eee0e1e2dbdecda Sylvain BERTRAND 2011-12-13 00:37:45
block signals 91772917669645b5634563d0c06e361c87cf3e84 Sylvain BERTRAND 2011-12-09 17:04:34
initial commit 5310fde2d021e3505f8f1d5d9091726c236967ec Sylvain BERTRAND 2011-12-07 11:29:18
Commit a458c52301d3a34e8b51794fea7c1cb06c1c34f8 - ulinux improvements and more patterns
Author: Sylvain BERTRAND
Author date (UTC): 2011-12-22 22:09
Committer name: Sylvain BERTRAND
Committer date (UTC): 2011-12-22 22:09
Parent(s): 60c167bcd530f95d0a57189035620c3bc80f1e34
Signing key:
Tree: 9c445f0a4887aeb561361c3d4286ebfe89d7f30a
File Lines added Lines deleted
ulinux/archs/x86_64/args.h 3 3
ulinux/archs/x86_64/args.s 12 0
ulinux/archs/x86_64/epoll.h 5 4
ulinux/archs/x86_64/mmap.h 5 4
ulinux/archs/x86_64/sysc.h 1 1
ulinux/args.h 4 4
ulinux/error.h 5 4
ulinux/file.h 2 2
ulinux/fs.h 36 0
ulinux/patterns/INDEX 13 0
ulinux/patterns/args/args.c 16 0
ulinux/patterns/args/makefile 29 0
ulinux/patterns/network_server/pre-fork_socket_unix_tcp/makefile 16 2
ulinux/patterns/network_server/pre-fork_socket_unix_tcp/pre-fork_socket_unix_tcp.c 5 5
ulinux/time.h 6 3
ulinux/types.h 1 1
File ulinux/archs/x86_64/args.h copied from file modules.h (similarity 79%) (mode: 100644) (index f5e162a..2e8850f)
1 #ifndef MODULES_H
2 #define MODULES_H
1 #ifndef ULINUX_ARCH_ARGS_H
2 #define ULINUX_ARCH_ARGS_H
3 3 //****************************************************************************** //******************************************************************************
4 4 //*this code is protected by the GNU affero GPLv3 //*this code is protected by the GNU affero GPLv3
5 5 //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com> //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
6 6 //* <digital.ragnarok AT gmail dot com> //* <digital.ragnarok AT gmail dot com>
7 7 //****************************************************************************** //******************************************************************************
8 void modules_load(void);
8 void start(k_i argc,k_u8 **argv);
9 9 #endif #endif
File ulinux/archs/x86_64/args.s added (mode: 100644) (index 0000000..ec6860b)
1 /* this code is protected by the GNU affero GPLv3
2 author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
3 <digital.ragnarok AT gmail dot com> */
4 .text
5 .globl _start
6 .type _start,@function
7 _start:
8 xorl %ebp, %ebp/*suggested by abi*/
9 popq %rdi/*argc*/
10 movq %rsp, %rsi/*argv*/
11 andq $~31, %rsp/*32 bytes aligned stack*/
12 jmp start
File ulinux/archs/x86_64/epoll.h changed (mode: 100644) (index 1bfc80f..c4857d2)
1 //**********************************************************************************************
2 //*this code is protected by the GNU affero GPLv3
3 //*author:Sylvain BERTRAND (sylvain.bertrand AT gmail dot com)
4 //**********************************************************************************************
5 1 #ifndef ULINUX_ARCH_EPOLL_H #ifndef ULINUX_ARCH_EPOLL_H
6 2 #define ULINUX_ARCH_EPOLL_H #define ULINUX_ARCH_EPOLL_H
3 //******************************************************************************
4 //*this code is protected by the GNU affero GPLv3
5 //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
6 //* <digital.ragnarok AT gmail dot com>
7 //******************************************************************************
7 8 union k_epoll_data{ union k_epoll_data{
8 9 void *ptr; void *ptr;
9 10 k_i fd; k_i fd;
File ulinux/archs/x86_64/mmap.h changed (mode: 100644) (index 6b006b3..91da1a8)
1 //**********************************************************************************************
2 //*this code is protected by the GNU affero GPLv3
3 //*author:Sylvain BERTRAND (sylvain.bertrand AT gmail dot com)
4 //**********************************************************************************************
5 1 #ifndef ULINUX_ARCH_MMAP_H #ifndef ULINUX_ARCH_MMAP_H
6 2 #define ULINUX_ARCH_MMAP_H #define ULINUX_ARCH_MMAP_H
3 //******************************************************************************
4 //*this code is protected by the GNU affero GPLv3
5 //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
6 //* <digital.ragnarok AT gmail dot com>
7 //******************************************************************************
7 8 #define K_PAGE_SIZE 4096 #define K_PAGE_SIZE 4096
8 9 #endif #endif
File ulinux/archs/x86_64/sysc.h changed (mode: 100644) (index 60cf45f..3cf3db3)
2 2 #define ULINUX_ARCH_SYSC_H #define ULINUX_ARCH_SYSC_H
3 3 //****************************************************************************** //******************************************************************************
4 4 //*this code is protected by the GNU affero GPLv3 //*this code is protected by the GNU affero GPLv3
5 //*author:Sylvain BERTRAND (sylvain.bertrand AT gmail dot com)
5 //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
6 6 //* <digital.ragnarok AT gmail dot com> //* <digital.ragnarok AT gmail dot com>
7 7 //****************************************************************************** //******************************************************************************
8 8
File ulinux/args.h copied from file modules.h (similarity 80%) (mode: 100644) (index f5e162a..3c79eb9)
1 #ifndef MODULES_H
2 #define MODULES_H
1 #ifndef ULINUX_ARGS_H
2 #define ULINUX_ARGS_H
3 3 //****************************************************************************** //******************************************************************************
4 4 //*this code is protected by the GNU affero GPLv3 //*this code is protected by the GNU affero GPLv3
5 5 //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com> //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
6 6 //* <digital.ragnarok AT gmail dot com> //* <digital.ragnarok AT gmail dot com>
7 7 //****************************************************************************** //******************************************************************************
8 void modules_load(void);
9 #endif
8 #include <ulinux/arch/types.h>
9 #endif
File ulinux/error.h changed (mode: 100644) (index ed6132d..f4688ac)
1 //**********************************************************************************************
2 //*this code is protected by the GNU affero GPLv3
3 //*author:Sylvain BERTRAND (sylvain.bertrand AT gmail dot com)
4 //**********************************************************************************************
5 1 #ifndef ULINUX_ERROR_H #ifndef ULINUX_ERROR_H
6 2 #define ULINUX_ERROR_H #define ULINUX_ERROR_H
3 //******************************************************************************
4 //*this code is protected by the GNU affero GPLv3
5 //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
6 //* <digital.ragnarok AT gmail dot com>
7 //******************************************************************************
7 8
8 9 #define K_ISERR(x) (-4095<=(x)&&(x)<=-1) #define K_ISERR(x) (-4095<=(x)&&(x)<=-1)
9 10 #define K_EPERM 1//Operation not permitted #define K_EPERM 1//Operation not permitted
File ulinux/file.h changed (mode: 100644) (index 4238ddb..a03d4fa)
1 #ifndef ULINUX_FILE_H
2 #define ULINUX_FILE_H
1 3 //****************************************************************************** //******************************************************************************
2 4 //*this code is protected by the GNU affero GPLv3 //*this code is protected by the GNU affero GPLv3
3 5 //*author:Sylvain BERTRAND (sylvain.bertrand AT gmail dot com) //*author:Sylvain BERTRAND (sylvain.bertrand AT gmail dot com)
4 6 //* <digital.ragnarok AT gmail dot com> //* <digital.ragnarok AT gmail dot com>
5 7 //****************************************************************************** //******************************************************************************
6 #ifndef ULINUX_FILE_H
7 #define ULINUX_FILE_H
8 8 #define K_O_ACCMODE 00000003 #define K_O_ACCMODE 00000003
9 9 #define K_O_RDONLY 00000000 #define K_O_RDONLY 00000000
10 10 #define K_O_WRONLY 00000001 #define K_O_WRONLY 00000001
File ulinux/fs.h added (mode: 100644) (index 0000000..5125790)
1 #ifndef ULINUX_FS_H
2 #define ULINUX_FS_H
3 //******************************************************************************
4 //*this code is protected by the GNU affero GPLv3
5 //*author:Sylvain BERTRAND (sylvain.bertrand AT gmail dot com)
6 //* <digital.ragnarok AT gmail dot com>
7 //******************************************************************************
8 #define K_MS_RDONLY 1//mount read-only
9 #define K_MS_NOSUID 2//ignore suid and sgid bits
10 #define K_MS_NODEV 4//disallow access to device special files
11 #define K_MS_NOEXEC 8//disallow program execution
12 #define K_MS_SYNCHRONOUS 16//writes are synced at once
13 #define K_MS_REMOUNT 32//alter flags of a mounted fs
14 #define K_MS_MANDLOCK 64//allow mandatory locks on an fs
15 #define K_MS_DIRSYNC 128//directory modifications are synchronous
16 #define K_MS_NOATIME 1024//do not update access times
17 #define K_MS_NODIRATIME 2048//do not update directory access times
18 #define K_MS_BIND 4096
19 #define K_MS_MOVE 8192
20 #define K_MS_REC 16384
21 #define K_MS_VERBOSE 32768//MS_VERBOSE is deprecated
22 #define K_MS_SILENT 32768
23 #define K_MS_POSIXACL (1<<16)//vfs does not apply the umask
24 #define K_MS_UNBINDABLE (1<<17)//change to unbindable
25 #define K_MS_PRIVATE (1<<18)//change to private
26 #define K_MS_SLAVE (1<<19)//change to slave
27 #define K_MS_SHARED (1<<20)//change to shared
28 #define K_MS_RELATIME (1<<21)//update atime relative to mtime/ctime
29 #define K_MS_KERNMOUNT (1<<22)//this is a kern_mount call
30 #define K_MS_I_VERSION (1<<23)//update inode i_version field
31 #define K_MS_STRICTATIME (1<<24)//always perform atime updates
32 #define K_MS_NOSEC (1<<28)
33 #define K_MS_BORN (1<<29)
34 #define K_MS_ACTIVE (1<<30)
35 #define K_MS_NOUSER (1<<31)
36 #endif
File ulinux/patterns/INDEX added (mode: 100644) (index 0000000..8a67160)
1 o args
2 use of command line arguments
3
4 o epoll:
5 use of epoll with signalfd
6
7 o network_server
8 o pre-fork_socket_unix_tcp:
9 a TCP/IPv4 network server with pre-fork for connexion processing. Connexion
10 sockets are passed using unix sockets
11
12 o thread
13 create a thread
File ulinux/patterns/args/args.c added (mode: 100644) (index 0000000..69aa1eb)
1 #include <stdarg.h>
2 #include <ulinux/compiler_types.h>
3 #include <ulinux/sysc.h>
4 #include <ulinux/types.h>
5 #include <ulinux/args.h>
6
7 #include <ulinux/utils/ascii/string/string.h>
8 #include <ulinux/utils/ascii/string/vsprintf.h>
9
10 void start(k_i argc,k_u8 **argv)
11 {
12 k_u8 buf[1024];
13 u_a_dprintf(1,buf,1024,(k_u8*)"argc=%d\n",argc);
14 while(argc--) u_a_dprintf(1,buf,1024,(k_u8*)"argv[%d]=%s\n",argc,argv[argc]);
15 sysc(exit_group,1,0);
16 }
File ulinux/patterns/args/makefile added (mode: 100644) (index 0000000..09250c7)
1 .PHONY:clean
2
3 ARCH?=$(shell uname -m | sed -e s/i.86/i386/ -e s/parisc64/parisc/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/sh.*/sh/)
4
5 args:args.c ../../../ulinux/arch
6 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../.. -S \
7 ../../arch/utils/mem.c -o mem.s
8 as mem.s -o mem.o
9 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../.. -S \
10 ../../utils/ascii/string/vsprintf.c -o vsprintf.s
11 as vsprintf.s -o vsprintf.o
12 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../.. -S \
13 ../../utils/ascii/string/string.c -o string.s
14 as string.s -o string.o
15 as ../../arch/args.s -o arch_args.o
16 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../.. -S \
17 args.c -o args.s
18 as args.s -o args.o
19 ld -O -nostdlib -Bstatic --strip-all args.o arch_args.o string.o mem.o vsprintf.o --output args
20
21 ../../../ulinux/arch:
22 ln -s archs/$(ARCH) ../../../ulinux/arch
23
24 clean:
25 -rm -f ../../../ulinux/arch args.s args.o args \
26 mem.s mem.o \
27 string.s string.o \
28 vsprintf.s vsprintf.o \
29 arch_args.o
File ulinux/patterns/network_server/pre-fork_socket_unix_tcp/makefile changed (mode: 100644) (index f404cc0..6a38cdc)
... ... pre-fork_socket_unix_tcp:pre-fork_socket_unix_tcp.c ../../../../ulinux/arch
12 12 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../../.. -S \ gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../../.. -S \
13 13 ../../../utils/ascii/string/string.c -o string.s ../../../utils/ascii/string/string.c -o string.s
14 14 as string.s -o string.o as string.s -o string.o
15 as ../../../arch/args.s -o args.o
16 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../../.. -S \
17 ../../../utils/ascii/block/conv/net/net.c -o net.s
18 as net.s -o net.o
19 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../../.. -S \
20 ../../../utils/ascii/string/conv/decimal/decimal.c -o string_decimal.s
21 as string_decimal.s -o string_decimal.o
22 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../../.. -S \
23 ../../../utils/ascii/block/conv/decimal/decimal.c -o block_decimal.s
24 as block_decimal.s -o block_decimal.o
15 25 gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../../.. -S \ gcc -Wall -Wextra -std=gnu99 -O3 -march=native -fverbose-asm -I../../../.. -S \
16 26 pre-fork_socket_unix_tcp.c -o pre-fork_socket_unix_tcp.s pre-fork_socket_unix_tcp.c -o pre-fork_socket_unix_tcp.s
17 27 as pre-fork_socket_unix_tcp.s -o pre-fork_socket_unix_tcp.o as pre-fork_socket_unix_tcp.s -o pre-fork_socket_unix_tcp.o
18 ld -O -nostdlib -Bstatic --strip-all string.o mem.o vsprintf.o pre-fork_socket_unix_tcp.o --output pre-fork_socket_unix_tcp
28 ld -O -nostdlib -Bstatic --strip-all block_decimal.o string_decimal.o net.o args.o string.o mem.o vsprintf.o pre-fork_socket_unix_tcp.o --output pre-fork_socket_unix_tcp
19 29
20 30 ../../../../ulinux/arch: ../../../../ulinux/arch:
21 31 ln -s archs/$(ARCH) ../../../../ulinux/arch ln -s archs/$(ARCH) ../../../../ulinux/arch
 
... ... clean:
27 37 pre-fork_socket_unix_tcp \ pre-fork_socket_unix_tcp \
28 38 mem.s mem.o \ mem.s mem.o \
29 39 string.s string.o \ string.s string.o \
30 vsprintf.s vsprintf.o
40 vsprintf.s vsprintf.o \
41 args.o \
42 net.s net.o \
43 string_decimal.s string_decimal.o \
44 block_decimal.s block_decimal.o
File ulinux/patterns/network_server/pre-fork_socket_unix_tcp/pre-fork_socket_unix_tcp.c changed (mode: 100644) (index 7f276ee..1f408ee)
17 17 #include <ulinux/types.h> #include <ulinux/types.h>
18 18 #include <ulinux/sysc.h> #include <ulinux/sysc.h>
19 19
20 #include <ulinux/args.h>
20 21 #include <ulinux/file.h> #include <ulinux/file.h>
21 22 #include <ulinux/socket/socket.h> #include <ulinux/socket/socket.h>
22 23 #include <ulinux/socket/in.h> #include <ulinux/socket/in.h>
 
... ... static k_i _allow_n=0;//ipv4 address to allow traffic from
104 105 #define _DPRINTF_BUF_SZ 1024 #define _DPRINTF_BUF_SZ 1024
105 106 static k_u8 *_dprintf_buf; static k_u8 *_dprintf_buf;
106 107 #define POUTC(s) {k_l rl;do{rl=sysc(write,3,0,s,sizeof(s));}\ #define POUTC(s) {k_l rl;do{rl=sysc(write,3,0,s,sizeof(s));}\
107 while(rl!=-K_EINTR||rl!=-K_EAGAIN);}
108 while(rl==-K_EINTR||rl==-K_EAGAIN);}
108 109 #define PERRC(s) {k_l rl;do{rl=sysc(write,3,2,s,sizeof(s));}\ #define PERRC(s) {k_l rl;do{rl=sysc(write,3,2,s,sizeof(s));}\
109 while(rl!=-K_EINTR||rl!=-K_EAGAIN);}
110 while(rl==-K_EINTR||rl==-K_EAGAIN);}
110 111 #define PERR(f,...) u_a_dprintf(2,_dprintf_buf,_DPRINTF_BUF_SZ,(k_u8*)f,\ #define PERR(f,...) u_a_dprintf(2,_dprintf_buf,_DPRINTF_BUF_SZ,(k_u8*)f,\
111 112 __VA_ARGS__) __VA_ARGS__)
112 113 #define SIGBIT(sig) (1<<(sig-1)) #define SIGBIT(sig) (1<<(sig-1))
 
... ... static void _loop(void)
859 860 //***************************************************************************** //*****************************************************************************
860 861 //XXX:may do the daemonic stuff if really we need it:logger instead of tty, //XXX:may do the daemonic stuff if really we need it:logger instead of tty,
861 862 // own session... // own session...
862 void _start(void)
863 void start(k_i argc,k_u8 **argv)
863 864 { {
864 865 k_u8 dprintf_buf[_DPRINTF_BUF_SZ]; k_u8 dprintf_buf[_DPRINTF_BUF_SZ];
865 866 _dprintf_buf=&dprintf_buf[0]; _dprintf_buf=&dprintf_buf[0];
866 867
867 //TODO:follow x86_64 ABI for argument passing (need an arch abstract util)
868 //_cmdline_options((k_i)argc,(k_u8 **)argv);
868 _cmdline_options(argc,argv);
869 869 _setup(); _setup();
870 870 _loop(); _loop();
871 871 } }
File ulinux/time.h copied from file modules.h (similarity 75%) (mode: 100644) (index f5e162a..37b6383)
1 #ifndef MODULES_H
2 #define MODULES_H
1 #ifndef ULINUX_TIME_H
2 #define ULINUX_TIME_H
3 3 //****************************************************************************** //******************************************************************************
4 4 //*this code is protected by the GNU affero GPLv3 //*this code is protected by the GNU affero GPLv3
5 5 //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com> //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
6 6 //* <digital.ragnarok AT gmail dot com> //* <digital.ragnarok AT gmail dot com>
7 7 //****************************************************************************** //******************************************************************************
8 void modules_load(void);
8 struct timespec{
9 long sec;//seconds
10 long nsec;//nanoseconds
11 };
9 12 #endif #endif
File ulinux/types.h changed (mode: 100644) (index 9373676..12df4cb)
2 2 #define ULINUX_TYPES_H #define ULINUX_TYPES_H
3 3 //****************************************************************************** //******************************************************************************
4 4 //*this code is protected by the GNU affero GPLv3 //*this code is protected by the GNU affero GPLv3
5 //*author:Sylvain BERTRAND (sylvain.bertrand AT gmail dot com)
5 //*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
6 6 //* <digital.ragnarok AT gmail dot com> //* <digital.ragnarok AT gmail dot com>
7 7 //****************************************************************************** //******************************************************************************
8 8 #include <ulinux/arch/types.h> #include <ulinux/arch/types.h>
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/cinitramfs

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/cinitramfs

Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/cinitramfs

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main