Linux????е??????????:fd?????--get_unused_fd
???????????? ???????[ 2013/1/16 10:32:29 ] ????????
??????Щ?????????趨?????????????????linux??????fork????????????????????????????????????????????????????Щ????????Щ???????????е????????????????????????????task_struct???????г??????????
linux/arch/arm/kernel/init_task.c
struct task_struct init_task = INIT_TASK(init_task);
#define INIT_TASK(tsk)
{
...
.signal = &init_signals??
...
}
????init_signals????????£?
#define INIT_SIGNALS(sig) {
.count = ATOMIC_INIT(1)??
.wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit)??
.shared_pending = {
.list = LIST_HEAD_INIT(sig.shared_pending.list)??
.signal = {{0}}}??
.posix_timers = LIST_HEAD_INIT(sig.posix_timers)??
.cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers)??
.rlim = INIT_RLIMITS??
}
includeasm-generic
esource.h
#define INIT_RLIMITS
{
[RLIMIT_CPU] = { RLIM_INFINITY?? RLIM_INFINITY }??
[RLIMIT_FSIZE] = { RLIM_INFINITY?? RLIM_INFINITY }??
[RLIMIT_DATA] = { RLIM_INFINITY?? RLIM_INFINITY }??
[RLIMIT_STACK] = { _STK_LIM?? _STK_LIM_MAX }??
[RLIMIT_CORE] = { 0?? RLIM_INFINITY }??
[RLIMIT_RSS] = { RLIM_INFINITY?? RLIM_INFINITY }??
[RLIMIT_NPROC] = { 0?? 0 }??
[RLIMIT_NOFILE] = { INR_OPEN?? INR_OPEN }??
[RLIMIT_MEMLOCK] = { MLOCK_LIMIT?? MLOCK_LIMIT }??
[RLIMIT_AS] = { RLIM_INFINITY?? RLIM_INFINITY }??
[RLIMIT_LOCKS] = { RLIM_INFINITY?? RLIM_INFINITY }??
[RLIMIT_SIGPENDING] = { 0?? 0 }??
[RLIMIT_MSGQUEUE] = { MQ_BYTES_MAX?? MQ_BYTES_MAX }??
[RLIMIT_NICE] = { 0?? 0 }??
[RLIMIT_RTPRIO] = { 0?? 0 }??
}
#define NR_OPEN (1024*1024) /* Absolute upper limit on fd num */
#define INR_OPEN 1024 /* Initial setting for nfile rlimits */
????????????????????????rlim_cur = 1024???????????????1024???????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11